* Need help at extracting debug line info from executable.
@ 1994-12-28 15:21 Steven W Orr
1995-01-03 10:25 ` Mark Wassell
0 siblings, 1 reply; 4+ messages in thread
From: Steven W Orr @ 1994-12-28 15:21 UTC (permalink / raw)
Running Alpha OSF1 and I need to access the debug line data in the
ECOFF executable. Specifically, I need to perform the only two
operations that are possible:
(I define a compilation number to refer to a specific compiled unit
in an executable)
1. I need a function that takes a compilation number, a filename or
number and a line number, and returns it's pc address.
2. I need the inverse, i.e., I need to take a pc and turn it into a
compile number, a filename, and a line number.
I have read the assembler manual in the Bookreader, and in particular
section 8.2.2 (Symbol Table/line Numbers) and am left with that
confused and empty feeling. I have read the man pages for (4) ldfcn
and don't see how that helps with the line numbers. If anyone can
help, give me a pointer, point to something better to read, or send
me a code frag that will jumpstart me, I'd be major grateful.
Many thanks in advance.
--
----------Time flies like the wind. Fruit flies like a banana.----------------
--------Stranger things have happened but none stranger than this.-------------
Steven W. Orr steveo@uniprise.com <site of former bang addr:-)>
---------------"Listen to me! We are all individuals."-------------------------
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Need help at extracting debug line info from executable.
1994-12-28 15:21 Need help at extracting debug line info from executable Steven W Orr
@ 1995-01-03 10:25 ` Mark Wassell
1995-01-04 14:25 ` Jeff Diewald
1995-01-10 16:18 ` Tim Lucia
0 siblings, 2 replies; 4+ messages in thread
From: Mark Wassell @ 1995-01-03 10:25 UTC (permalink / raw)
In article <D1J1BD.2LF@world.std.com> steveo@world.std.com (Steven W Orr)
wrote:
>Running Alpha OSF1 and I need to access the debug line data in the
>ECOFF executable. Specifically, I need to perform the only two
>operations that are possible:
I'm also trying to do something similar (see below) but haven't really got much
further but an idea I did have was to look at the source code for gdb (the GNU
debugger) for some ideas on how to extract debug information.
> ..am left with that confused and empty
Yes, I also have this confused and empty feeling when reading the documentation.
What I'm trying to do is to write some code that prints a calling trace of a
running program on demand. Using the ld* man pages I have managed to
come up with something that converts a pc into a function and that can skip
back through the stack to print a trace. However, if there are functions from
shared libraries in the way then it fails (as pc>function and frame
information won't be stored in the executable file).
___ ___
|\ | | Mark Wassell
| \ |\ \ | N.C. Graphics,
| \| \__ \__| Waterbeach, Cambridge
N.C. Graphics (Cambridge) Ltd. Tel:(0223) 861539 UK, CB5 9NN
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Need help at extracting debug line info from executable.
1995-01-03 10:25 ` Mark Wassell
@ 1995-01-04 14:25 ` Jeff Diewald
1995-01-10 16:18 ` Tim Lucia
1 sibling, 0 replies; 4+ messages in thread
From: Jeff Diewald @ 1995-01-04 14:25 UTC (permalink / raw)
In article <D1trMI.DDG@ncgrafix.demon.co.uk>, mark@ncgrafix.demon.co.uk (Mark Wassell) writes:
|>
|>In article <D1J1BD.2LF@world.std.com> steveo@world.std.com (Steven W Orr)
|>wrote:
|>
|>>Running Alpha OSF1 and I need to access the debug line data in the
|>>ECOFF executable. Specifically, I need to perform the only two
|>>operations that are possible:
|>
|>I'm also trying to do something similar (see below) but haven't really got much
|>further but an idea I did have was to look at the source code for gdb (the GNU
|>debugger) for some ideas on how to extract debug information.
|>
|>> ..am left with that confused and empty
|>Yes, I also have this confused and empty feeling when reading the documentation.
Trying to make sense of the debug symbol table information is a *much* bigger
job than anyone ever expects. There's no good, simple answer, even though
there should be. I ought to know - I'm one of the DECladebug developers
responsible for maintaining and improving the symbol table support in the
debugger. The exact details of the information in the symbol table vary
from compiler to compiler and sometimes even from version of compiler to
version of compiler. Everyone interprets the "COFF standard" in different
ways.
You might ask yourself if there's another way to get the information you
want or need. Can you pre/post-process the source to produce data that's
easier to access and use? Why do you want this line information? Is it
something you can get the compiler to tell you using __LINE__?
If you still think you need to get at this data, has someone already written
code you can use? Does the FSF binutils package contain what you need?
Do you need a class library that supports these features? (DECladebug is
implemented as a class library. There's a paper that was presented at
OOPSLA 93 entitled 'Experiences and Using an Object-Oriented Library for
Program Manipulation' by Tim Bingham, David Husson, and Nancy Hobbs that
you might find enlightening.)
|>
|>What I'm trying to do is to write some code that prints a calling trace of a
|>running program on demand. Using the ld* man pages I have managed to
|>come up with something that converts a pc into a function and that can skip
|>back through the stack to print a trace. However, if there are functions from
|>shared libraries in the way then it fails (as pc>function and frame
|>information won't be stored in the executable file).
Doing stack walks on Alpha is even more of a challenge, due the calling
standard. Stack frames are not always full frames. There are other
complications; you've only discovered one of the cases. Again - this is
something best left to someone who has access to all the details.
-----------------------------------------------------------------------------
Jeff Diewald EASYNET: VIRRUS::DIEWALD
DECladebug group INTERNET: diewald@virrus.zko.dec.com
Digital Equipment Corp.
Note: I don't read every article in this group. If you have debugger
questions, I may be able to get you an answer. You're much more likely to
get an answer if you put "Debug" somewhere in your subject line.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Need help at extracting debug line info from executable.
1995-01-03 10:25 ` Mark Wassell
1995-01-04 14:25 ` Jeff Diewald
@ 1995-01-10 16:18 ` Tim Lucia
1 sibling, 0 replies; 4+ messages in thread
From: Tim Lucia @ 1995-01-10 16:18 UTC (permalink / raw)
In article <D1trMI.DDG@ncgrafix.demon.co.uk>, mark@ncgrafix.demon.co.uk (Mark Wassell) writes:
|>What I'm trying to do is to write some code that prints a calling trace of a
|>running program on demand. Using the ld* man pages I have managed to
|>come up with something that converts a pc into a function and that can skip
|>back through the stack to print a trace. However, if there are functions from
|>shared libraries in the way then it fails (as pc>function and frame
|>information won't be stored in the executable file).
DECladebug does exactly this. If you are running on OSF V3.0, simply
attach to the running process, hit control-C thereby temporarily stopping
it, and then ask DECladebug 'where'. Instant stack trace. You may have
to load shared libraries along the way, but why re-invent the wheel?
It's probably unsafe to try and do the stack trace on a *running* program
anyway, since while you are figuring out the stack trace, it will be
changing.
===========================================================================
Timothy J. Lucia
DECladebug
Digital Equipment Corporation
lucia@zko.dec.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1995-01-10 16:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-12-28 15:21 Need help at extracting debug line info from executable Steven W Orr
1995-01-03 10:25 ` Mark Wassell
1995-01-04 14:25 ` Jeff Diewald
1995-01-10 16:18 ` Tim Lucia
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox