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-03-01 10:33:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.airnews.net!cabal12.airnews.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.ada Subject: Re: Getting a symbol table from Gnat 3.15p on Windows Date: Sat, 1 Mar 2003 12:25:53 -0600 Organization: Airnews.net! at Internet America Message-ID: X-Orig-Message-ID: References: <6AP7a.297368$be.266482@rwcrnsc53> Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library1-aux.airnews.net NNTP-Posting-Time: Sat Mar 1 12:30:09 2003 NNTP-Posting-Host: !_qZ"1k-We_;Z;1 (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:34778 Date: 2003-03-01T12:25:53-06:00 List-Id: 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. 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.