This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Relocation question


Hello!
Can someone explain to me how gdb is supposed to handle relocated
executables? I am porting gdb to AmigaOS4 which relocates its executables
when they are loaded. However, when I run an application through gdb, gdb
uses the bfd functions to build its map over the file. However, the bfd
library always relocates everything relative to 0 (since it obviously
doesn't know anything else to relocate it to)

So, in order for gdb to build the symbol tables etc. it needs to use the
relocated addresses instead of the ones retreived directly from the file.
What is the prefered way of doing this? I tried to set up the section
offsets (real address - address from the bfd code) in the section offsets
field, but I am not quite sure exactly when I can set up this table. I tried
to set it up in the default_symfile_offsets function and that results in the
small symbol table to be correct. However, the addr and endaddr ptrs in the
objfile/osections are already set up at this point and will then contain
addresses near 0 instead. Which means that every search for an address vill
fail since it wont fall between addr and endaddr of the sections loaded from
the bfd file.

Is this possible to solive in a nice way?

regards,
Stefan Burström


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]