From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6403691d6db186c8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-20 10:37:26 PST Path: archiver1.google.com!news2.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Getting a symbol table from Gnat 3.15p on Windows Date: 20 Feb 2003 13:30:52 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1045766627 21166 128.183.235.92 (20 Feb 2003 18:43:47 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 20 Feb 2003 18:43:47 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:34289 Date: 2003-02-20T18:43:47+00:00 List-Id: "Marin David Condic" writes: > I've got an application I'm investigating that looks something like a > debugger. What I think I need is some means of getting the addresses of data > items from a linked image such that I can interrogate the image for data > values and set the contents of variables as needed. Basically one app will > communicate with the other, knowing the other apps symbol table. Here's the > question(s): > > Is there a means of getting a symbol table for an app that is compiled & > linked with Gnat 3.15p on Windows? the gnu linker 'ld' will dump a file containing the symbol table; see http://www.gnu.org/manual/ld-2.9.1/ld.html Note you can pass 'ld' options to gnatmake via -largs. But I think you mean you want to do this via an API, not a command line tool. In that case, you need to include some of the linker code in your program. That is possible; the linker code is written as a set of libraries providing access to object files. See the sources for binutils. > What switches or secret handshakes are needed to get that to happen? > (We can worry about formats, etc. at a later point - right now I > need to know if it is possible and how to make it happen to > demonstrate proof of concept.) Trivial for command line, some work required for API access. > Also, would there be any obvious problems with passing an address > into an app and having it interrogate its own memory using a > variable of type Address? (Such as different address formats from > the data in the symbol table or OS related memory restrictions.) Different object file formats have different meanings for "address". But the gnu linker provides a way to get the "process virtual address" (my name, not the Gnu name), which is what 'address gives. As long as the address is not supposed to have physical meaning (ie, this is the serial port command register), you should have no problem. > If this doesn't happen readily with Gnat/Windows, I can consider > other environments such as a different compiler or platform so long > as it doesn't get too far afield from a workstation & easily > obtainable software. It's not the OS, it's the linker and object file format. -- -- Stephe