I have been thinking about this, and I don't have a solution.  I don't have a working 
Linux system to test ideas on.

I suspect that the only way for this to work right would be if the Dl_info structure 
had the full pathname.

-----Original Message-----
From: Ferguson, Neale [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 4:33 PM
To: [EMAIL PROTECTED]
Subject: Re: API to get fullpath name


I'm doing stack backtracing and lookup of return addresses per stack frame
(using __builtin_frame_address and __builtin_return_address). I use dladdr()
to get the name of the object a given entry point is in. I then use the
bfd_xxxx routines (part of binutils) to locate the symbols within the object
and match it against the return addresses to determine the flow of code.
dladdr() will return the filename in the Dl_info structure. However, it is a
non-absolute pathname.

-----Original Message-----
There is no reliable way.  This is true of Unix, and Linux.

Tell me what you are trying to do and I will probably be able to tell you a
better, and safer way to do it.

Reply via email to