From: "Chan Kim" <ckim@etri.re.kr>
To: <kernelnewbies@kernelnewbies.org>
Subject: RE: Confused about how to apply add-symbol-file in gdb
Date: Mon, 18 Jul 2022 17:56:49 +0900 [thread overview]
Message-ID: <02e101d89a84$513862c0$f3a92840$@etri.re.kr> (raw)
In-Reply-To:
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
>-----Original Message-----
>From: Chan Kim <ckim@etri.re.kr>
>Sent: Monday, July 18, 2022 5:43 PM
>To: kernelnewbies@kernelnewbies.org
>Subject: Confused about how to apply add-symbol-file in gdb
>
>Hello all,
>
>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 at 0x4000000 and loaded linux Image (binary, not elf) at 0x80010000.
>The dtb is loaded at 0x80000000.
>(because qemu loads the dtb file at the first address of RAM (which is
>0x80000000) I moved kernel image to 0x80010000) After the PC jumps to
linux,
>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 .text 0x80020000 (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_switch function, the PC value becomes virtual.
>But I can't follow kernel source from that point.
>Until now, I have placed kernel Image at 0x80000000 and dtb was at
>0x82800000 and 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 at
>0x80010000??
>Any comment welcome.
>Thank you.
>
>Chan Kim
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next reply other threads:[~2022-07-18 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 8:56 Chan Kim [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-07-18 8:43 Confused about how to apply add-symbol-file in gdb Chan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='02e101d89a84$513862c0$f3a92840$@etri.re.kr' \
--to=ckim@etri.re.kr \
--cc=kernelnewbies@kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).