comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <mcondic.auntie.spam@acm.org>
Subject: Re: Getting a symbol table from Gnat 3.15p on Windows
Date: Thu, 20 Feb 2003 22:24:56 -0500
Date: 2003-02-21T03:26:35+00:00	[thread overview]
Message-ID: <b3469b$v6p$1@slb4.atl.mindspring.net> (raw)
In-Reply-To: ulm0als83.fsf@nasa.gov

Stephen Leake <Stephen.A.Leake@nasa.gov> 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<someswitches>' 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
======================================================================






  reply	other threads:[~2003-02-21  3:24 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20 13:24 Getting a symbol table from Gnat 3.15p on Windows Marin David Condic
2003-02-20 15:15 ` David C. Hoos, Sr.
2003-02-21  2:16   ` Marin David Condic
2003-02-20 18:30 ` Stephen Leake
2003-02-21  3:24   ` Marin David Condic [this message]
2003-02-21 16:01     ` Stephen Leake
2003-02-21 16:14       ` Preben Randhol
2003-02-21  6:37 ` sk
2003-02-21 12:38   ` Marin David Condic
2003-02-21 20:02     ` Randy Brukardt
2003-02-21 21:33       ` Stephen Leake
2003-02-22 15:01       ` Marin David Condic
2003-02-22  5:46     ` sk
2003-02-22 15:23       ` Marin David Condic
2003-02-22 18:05         ` Jeffrey Creem
2003-02-23 15:06           ` Marin David Condic
2003-02-24 18:30             ` Simon Wright
2003-02-25 12:56               ` Marin David Condic
2003-02-26  1:26                 ` Randy Brukardt
2003-02-26 13:27                   ` Marin David Condic
2003-02-26 18:10                     ` tmoran
2003-02-27 13:11                       ` Marin David Condic
2003-02-27 18:01                         ` tmoran
2003-02-28 12:08                           ` Marin David Condic
2003-02-28 18:18                             ` tmoran
2003-02-28 20:24                             ` tmoran
2003-03-01 18:25                               ` John R. Strohm
2003-02-26 18:54                 ` Stephen Leake
2003-02-27 13:22                   ` Marin David Condic
2003-02-27 17:14                     ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2003-02-21  3:24 David C. Hoos, Sr.
2003-02-21  4:00 ` Marin David Condic
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox