comp.lang.ada
 help / color / mirror / Atom feed
From: "John R. Strohm" <strohm@airmail.net>
Subject: Re: Getting a symbol table from Gnat 3.15p on Windows
Date: Sat, 1 Mar 2003 12:25:53 -0600
Date: 2003-03-01T12:25:53-06:00	[thread overview]
Message-ID: <D714C36D8E85018F.A1CA2AB3455A6F97.8596DFE9010DDD5B@lp.airnews.net> (raw)
In-Reply-To: 6AP7a.297368$be.266482@rwcrnsc53

This is probably one of those places where AWK would be a better choice.

Build a file with variable name and type.

Use one AWK script to read that file and write the necessary Ada package
spec to create the variables.

Use another AWK script to read that file and generate the monitoring code
for the variables.

Then your build process ("makefile") runs the AWK scripts when the variable
file changes, and then recompiles the created package spec and monitoring
code.

<tmoran@acm.org> wrote in message news:6AP7a.297368$be.266482@rwcrnsc53...
> 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.





  reply	other threads:[~2003-03-01 18:25 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
2003-03-01 18:25                               ` John R. Strohm [this message]
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