comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Getting a symbol table from Gnat 3.15p on Windows
Date: Fri, 28 Feb 2003 20:24:34 GMT
Date: 2003-02-28T20:24:34+00:00	[thread overview]
Message-ID: <6AP7a.297368$be.266482@rwcrnsc53> (raw)
In-Reply-To: b3njhg$5mp$1@slb9.atl.mindspring.net

Write a source code scanner (ASIS?) to find variables you want to
monitor/modify.  This should produce as output a package that looks
like this:

package my_symbols is
  pragma elaborate_body;
  global : integer;  -- a line like this for each variable of interest
end my_symbols;

with ada.streams,
     ada.streams.stream_io,
     system;
package body my_symbols is
  f : ada.streams.stream_io.file_type;
  s : ada.streams.stream_io.stream_access;
begin
  ada.streams.stream_io.create(f, ada.streams.stream_io.out_file,
                               "my_symbols.dat");
  s := ada.streams.stream_io.stream(f);
  --
  String'Output(S, "Global");           -- this line pair for each variable
  System.Address'Output(S, Global'address);
  --
  ada.streams.stream_io.close(f);
end my_symbols;

Then add "with my_symbols" to your testee program.  Recompilation will compile
my_symbols.ads, my_symbols.adb, and testee.adb, which should be pretty quick.  Then
Relink and run testee just long enough for elaboration to produce the
my_symbols.dat file.

my_symbols.dat is your desired symbol table.  Massage it, read it into a
database, print it in hex, generate source code like
  Addr_Global : constant System.Address := 16#1234#;
or whatever.  Your monitor program now has the symbol table and can do
whatever you want using it.  My_symbols still exists and runs as part of
elaboration of testee, so addresses don't change, but once it's written
its output it should have no further effect on the running of testee.



  parent reply	other threads:[~2003-02-28 20: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
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 [this message]
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