• Andrew Morton's avatar
    [PATCH] /proc/PID/auxv file and NT_AUXV core note · 2e54af56
    Andrew Morton authored
    From: Roland McGrath <roland@redhat.com>
    
    gdb really needs some way to know the AT_SYSINFO_EHDR value for a process
    being debugged or for the dead process described by a core file.  Without
    this value, it can't find the information necessary to show backtraces of
    threads waiting in system calls.  There are any number of ways this
    information could be made available.  Here is one solution that provides
    more debugging information in a clean and general fashion.
    
    I've added access to the AT_* values passed to a process for third parties
    to examine for debugging purposes.  The same data passed on the stack at
    startup is made available in /proc/PID/auxv and is written in an NT_AUXV
    note in core dumps.  (Both of these are consistent with what Solaris does
    using the same names.)
    
    Here are two different patches that implement the same thing differently.
    The first patch uses a ref-counted data structure to copy the aux vector
    and shares among forked mm's until they exec and get a new one.  The second
    patch avoids the complexity of that data structure by simply expanding the
    mm_struct with space to hold a copy of the data.  Both patches work
    correctly; I have examined the new /proc/PID/auxv file and core dumps.
    
    I hope you will consider including one of these patches, or at least some
    way of getting at this information from the debugger.  I am certainly open
    to other suggestions on implementing this feature, and to suggestions on
    alternative interfaces for getting the AT_SYSINFO_EHDR value cleanly.
    2e54af56
binfmt_elf.c 39 KB