[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gdb
Subject:    Re: Determining loaded libraries from a core file?
From:       Daniel Jacobowitz <drow () mvista ! com>
Date:       2003-11-26 4:12:04
Message-ID: 20031126041204.GA4207 () nevyn ! them ! org
[Download RAW message or body]

On Tue, Nov 25, 2003 at 07:50:31PM -0500, Kevin Langman wrote:
> I know this is a bit off topic but I hope someone on this list can help.
> 
> I have build a debugging tool that is very specific to the code that I support. \
> This debugger works directly with core files on other OSs and I have been working \
> to port this debugger to Linux for a verity of platforms but I have hit a road \
> block. 
> My problem is this.. I need to determine what libraries were used by the process \
> that crashed and where they were mapped into memory so that I can virtually map the \
> library to the same address space for my debugger.  GDB manages to find the \
> libraries so I know it's possible but I can't see where in the core file this \
> information is located?  
> It had occurred to me that GDB might be looking at the executable (supplied as a \
> parameter to GDB) and some how finding a way to map the libraries linked in to the \
> executable to the PT_LOAD segments found in the core file defined with a 0 length \
> file size. This seems very unlikely to me as this would mean that GDB would have no \
> information about libraries that are programmatically loaded at run-time. 
> Short and sweet version:  Given a core file that crashes while executing code in \
> library lib123.so, how do I determine that lib123.so was used by the process that \
> crashed and how do I determine what memory address lib123.so was mapped to for that \
> process. 
> Any help would be much appreciated.

You need to walk the _DYNAMIC section of the executable.  Take a look
at <link.h>.  The code in GDB that you're interested in is probably
solib-svr4.[ch].

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic