Confused about how to apply add-symbol-file in gdb
Hello,
I found from the manual,
(https://sourceware.org/gdb/onlinedocs/gdb/Files.html#:~:text=The%20add%2Dsy
mbol%2Dfile%20command,text%20section%20has%20been%20loaded.) By giving "-o 0x10000" I can follow the kernel source in the virtual address. (and follow sources after start_kernel)
Thank you.
Chan Kim
Quoted 8 lines
-----Original Message-----
From: Chan Kim <[email protected]>
Sent: Monday, July 18, 2022 5:43 PM
To: [email protected]
Subject: Confused about how to apply add-symbol-file in gdbHello all,
Quoted 7 lines
I thought I know how to apply add-symbol-file command in gdb but now I'm confused.
I'm using qemu to test booting linux using u-boot. (arm64) I've loaded u- boot at0x4000000and loaded linux Image (binary, not elf) at0x80010000. The dtb is loaded at0x80000000.
(because qemu loads the dtb file at the first address of RAM (which is0x80000000) I moved kernel image to0x80010000) After the PC jumps to
linux,
Quoted 35 lines
I can follow the source while the PC value uses physical address. I think this is possible that I gave gdb this command. add-symbol-file vmlinux -s .head.text
0x80010000-s .text0x80020000(using readelf -e vmlinux command, I can see the section offsets relative to the start of the Image file. The output starts like this.
Section Headers:[Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .head.text PROGBITS ffffffc010000000 00010000 0000000000010000 0000000000000000 AX 0 0 65536 [ 2] .text PROGBITS ffffffc010010000 00020000 0000000000aa4dc8 0000000000000008 AX 0 0 2048 [ 3] .got.plt PROGBITS ffffffc010ab4dc8 00ac4dc8 0000000000000018 0000000000000008 WA 0 0 8 [ 4] .rodata PROGBITS ffffffc010ac0000 00ad0000 0000000000645018 0000000000000000 WA 0 0 4096 [ 5] .pci_fixup PROGBITS ffffffc011105020 01115020 00000000000025e0 0000000000000000 A 0 0 16 [ 6] __ksymtab PROGBITS ffffffc011107600 01117600 000000000000b3b8 0000000000000000 A 0 0 4 [ 7] __ksymtab_gpl PROGBITS ffffffc0111129b8 011229b8...
Now, at the end of
__primary_switchfunction, the PC value becomes virtual. But I can't follow kernel source from that point.
Until now, I have placed kernel Image at0x80000000and dtb was at0x82800000and just by giving "add-symbol-file vmlinux" again, there was no problem following the kernel source in virtual address.
How should I give the add-symbol-file command when the Image is now at0x80010000??
Any comment welcome.
Thank you.
Quoted 1 line
Chan Kim
_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies