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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no 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 19:26:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!beamish.news.atl.earthlink.net!guinness.news.atl.earthlink.net!news.atl.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Getting a symbol table from Gnat 3.15p on Windows Date: Thu, 20 Feb 2003 22:24:56 -0500 Organization: MindSpring Enterprises Message-ID: References: NNTP-Posting-Host: d1.56.b6.7b X-Server-Date: 21 Feb 2003 03:26:35 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Xref: archiver1.google.com comp.lang.ada:34327 Date: 2003-02-21T03:26:35+00:00 List-Id: Stephen Leake wrote in message news:ulm0als83.fsf@nasa.gov... > > the gnu linker 'ld' will dump a file containing the symbol table; see > http://www.gnu.org/manual/ld-2.9.1/ld.html > Thanks for the pointer. I'll take a look - although I am loathe to RTFM. :-) BTW I'm not sure if this is Linux, or gnu specific - does it come as the "standard" linker with the Gnat Windows distribution? I thought it used the Windows linker. The rules may change there. > Note you can pass 'ld' options to gnatmake via -largs. > I knew about the largs. I was really hoping someone out there would say "Hey, Marin, its intuitively obvious to even the most casual observer that all you have to do is type 'gnatmake something -largs' and viola - you get a symbol table in XXX format!" > But I think you mean you want to do this via an API, not a command > line tool. > Not really. I want to take some batch of wrapper code and compile it with a bunch of application code and get a symbol table. Command line is fine for that. Once you have that in hand, you feed it to another program that uses the symbol table to interrogate and write to balues in the wrapper/app image you built. Clear as mud? I thought so. :-) > 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. > Why? Maybe a pragma to pass something to the linker, O.K. But what else is needed except the object files that the linker is going to build into an image. I don't need anything magic - just the addresses at which the linker put stuff. > > Trivial for command line, some work required for API access. > Not sure why you've got some kind of distinction going here. If you link program X, the linker has to put variables and stuff at specific addresses (relative to virtual address space, maybe, but that's it) All I need is a symbol table that tells me where variables were located in such a way that given the addresses, I can interrogate & write to those addresses via a second app communicating with my wrapper code. Is there something I'm missing? > > 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. > No - just so long as the image that produced the symbol table would recognize the number and be able to store & fetch from that address, I'd be golden. > > It's not the OS, it's the linker and object file format. > OS's have a nasty habit of trying to save you from yourself. An elephant is a mouse with an operating system. Not knowing from any technical basis - I just have a suspicion that if I tried to get the contents of bytes at "Address X" (where X is a read-in value) the OS may try to "protect" me and cause trouble. It may or may not be an issue, but I could probably do some proof-of-concept tests rather quickly if I could get a symbol table out of an image. Write a "Hello World app that reads in an address and tries to tell you what is at that location. You get that far and the rest is left as an exercise for the student. :-) MDC -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/ Send Replies To: m c o n d i c @ a c m . o r g "Going cold turkey isn't as delicious as it sounds." -- H. Simpson ======================================================================