Fix auxv parsing on Solaris

Vladimir Prus vladimir@codesourcery.com
Thu Apr 10 10:50:00 GMT 2008


Presently, gdb does not properly parse auxv data on Solaris when GDB is
built as 64-bit binary, and the program been debugger is 32-bit. On Solaris,
32-or-64-bitness of the application accessing /proc/*/auxv determines format
of the data read, while GDB presently only uses size of target types during
parsing. 

This issue causes quite some breakage in our testing, because we use AT_BASE
item of auxv data to find linker's base address, and if we misparse auxv we
end up recognizing regular program code as part of dynamic linker, and stepping
out of that code automatically.

The ideal solution is to add a new target method for parsing auxv data, and 
then make sparc-sol2-nat.c define new target ops with that method defined. That,
however, is a little bit tricky, because right now, Solaris uses procfs_target_ops
for running, and procfs.c is not quite written with the expectation that any target
will want to extend it. For that reason, I've made procfs.c itself register new
target method if we sees we're on solaris and compiled as 64-bit application.

OK?

- Volodya

        * target.h (struct target_ops): New field to_auxv_parse.
        * auxv.c (default_auxv_parse): New, renamed from previous
        target_auxv_parse.
        (target_auxv_parse): Try to call target method.  Fallback to
        default_auxv_parse if not found.
        * procfs.c (procfs_auxv_parse): New.
        (init_procfs_ops): On Solaris, in 64-bit mode, install
        procfs_auxv_parse.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: final.diff
Type: text/x-diff
Size: 4542 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20080410/9d24cfec/attachment.bin>


More information about the Gdb-patches mailing list