🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #46412

Help with machine code layout

#46412
From: Croix
Date: Wed, 23 Nov 1994 08:25
25 lines
2098 bytes
I'm writing a profiling tool and am looking for documentation about the machine
code layout of GCC compiled programs.  Basically, given an interrupted program,
I want to use ptrace() to walk the call stack and report the functions invoked
(from main() or start() up to the point at which the interrupt occurred).

Without giving too many details away, I'm writing this for my IBM RS/6000
system at work.  However, I'm doing it on my own time and would like to create
a version that would work for 80x86 platforms running Linux (which I run at
home) that I could CopyLeft and distribute on the net.  I used the IBM Assembly
Language reference to complete most of the port at work (for programs compiled
under IBM's compilers).  However, I can't find any documentation to describe
the process I need to use under Linux and GCC.  I tried looking through GDB
source, but 15Mb is a lot to wade through.  I need to at least pick up the
function name, the program counter when the interrupt occurred, and the
instruction address of the last instruction in the function executing when the
interrupt occurred.  If possible, I'd also like to demangle C++ names on the
fly, extract line numbers, and the parameter list.

If someone could point me in the appropriate direction, I'd be very grateful.
Pointers to documentation and/or source code (i.e. lines xxx-yyy in file aaa
of gdb) would be great!

Thanks and regards,
John Croix
IBM - Austin
Technical Details
Message-ID: <9411230825.AA15623@rx7t.austin.ibm.com>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!news.cac.psu.edu!news.pop.psu.edu!psuvax1!uwm.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!austin.ibm.com!jcroix

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,4a727560a38db34c,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1994-11-23 17:50:24 PST
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!news.cac.psu.edu!news.pop.psu.edu!psuvax1!uwm.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!austin.ibm.com!jcroix
From: jcroix@austin.ibm.com (Croix)
Newsgroups: gnu.gcc.help
Subject: Help with machine code layout
Date: 23 Nov 1994 03:25:41 -0500
Organization: GNUs Not Usenet
Lines: 26
Sender: daemon@cis.ohio-state.edu
Distribution: gnu
Message-ID: <9411230825.AA15623@rx7t.austin.ibm.com>