[Question] debug bionic linker with gdb

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Question] debug bionic linker with gdb

Chen Wang
Hi, android team guys,
I am working on port aosp to other isa than arm/x86. When I am debugging bionic/linker, I find a strange question, that is the gdb can not get file/line info from the linker_main.c, but for other files in linker, it works as normal.
I am running qemu as gdb server and run gdb as client to connect to qemu remotely.
I confirm that all the source files are compiled with "-g" and I can see the linker executable contains debug info with objdump.
Why it's special for the linker_main.c? What should I do to handle this?
Thanks in adv.

--
--
unsubscribe: [hidden email]
website: http://groups.google.com/group/android-porting

---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-porting/c164d1d8-5714-4513-a25a-eefadcaf3748n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Question] debug bionic linker with gdb

Notur Business
please post URL, do you mean https://android.googlesource.com/platform/bionic/+/master/linker/linker_main.cpp ?

I assume being linux the linker makes a .o, first insure the make (script) does make an .o  (sometimes, making a library, separate .o are not made or not made for one of all of the .cpp)

Insure this .cpp is not merely included into another .cpp:  if it is there will be no separate object file for it but there will be a trace for it whenever execution passes through it.  You should know how you can generate a separate object file by hand.

The file does not define main(), it defines ?1 function.  It has various "compiler markings" (like HIDDEN), so the linker may treat it specially even if any .o file contains the function it defines.  There's a 50% chance this is the issue.

It appears to be part of the library loader which, by android guidelines, you aren't allowed to alter.  You shouldn't have a reason for tracing into it.  I can say though even if you persist that the linux loader is "properly" changed by using it's configuration files (to get specific needs done), rather than hacking the loader code.

See:  https://source.android.com/compatibility/android-cdd

That may be all very basic material for you you already know.  I have no idea.
On Monday, December 28, 2020 at 1:34:30 PM UTC-5 [hidden email] wrote:
Hi, android team guys,
I am working on port aosp to other isa than arm/x86. When I am debugging bionic/linker, I find a strange question, that is the gdb can not get file/line info from the linker_main.c, but for other files in linker, it works as normal.
I am running qemu as gdb server and run gdb as client to connect to qemu remotely.
I confirm that all the source files are compiled with "-g" and I can see the linker executable contains debug info with objdump.
Why it's special for the linker_main.c? What should I do to handle this?
Thanks in adv.

--
--
unsubscribe: [hidden email]
website: http://groups.google.com/group/android-porting

---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-porting/caf9e7be-128f-4651-973f-7dccfd89fd48n%40googlegroups.com.