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=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:620a:1228:: with SMTP id v8mr35637970qkj.357.1563549106762; Fri, 19 Jul 2019 08:11:46 -0700 (PDT) X-Received: by 2002:a05:6830:18a:: with SMTP id q10mr35827459ota.114.1563549106306; Fri, 19 Jul 2019 08:11:46 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!82.197.223.106.MISMATCH!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!b26no3561943qtq.0!news-out.google.com!a5ni1075qtd.0!nntp.google.com!b26no3561931qtq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 19 Jul 2019 08:11:45 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=47.185.223.245; posting-account=zwxLlwoAAAChLBU7oraRzNDnqQYkYbpo NNTP-Posting-Host: 47.185.223.245 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <3c063128-bcc4-4758-8b18-91cee75bbc3b@googlegroups.com> Subject: Re: DEC Ada Exception Information From: Optikos Injection-Date: Fri, 19 Jul 2019 15:11:46 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:56888 Date: 2019-07-19T08:11:45-07:00 List-Id: On Friday, July 19, 2019 at 9:06:32 AM UTC-5, Stephen Davies wrote: > I am using DEC Ada 3.5-20, which provides the function > CURRENT_EXCEPTION.EXCEPTION_INFORMATION. >=20 > The string it returns includes the PC value. How do I > convert this to the Ada package/subunit and line number? >=20 > TIA >=20 > Stephen Davies You will need to provide which DEC operating system you are using (e.g., VM= S; OSF). The specific answer (e.g., exact command lines; file naming; file= formats) vary drastically per OS. In general, the technique (nowadays within the source code of an automated = tool in your OS, e.g., a debugger) is to: 1) Obtain from the linker/librarian (or build-time linker/librarian plus ex= ecution-time link-loader on some OSes) a map file of the relocatable layout= of the executable (or DLL). This map will provide the offsets of subrouti= nes (and static data) from the (variable, established per execution-time) b= ase-address. 2) Obtain from the execution-time link-loader the fixed base-address at whi= ch the executable (or DLL) was loaded in this particular execution. 3) Perform the numerous additions of the relocatable addresses of subroutin= es to see in which range/pair of addresses your particular PC that raised t= he exception falls. 4) Obtain the name of subroutine that corresponds to that range/pair of add= resses. The aforementioned steps can be performed manually, if need be. The next s= tep presumes the use of an automated source-debugger: 5) To obtain line number, debug information must already be present in the = executable (or DLL) that raised the exception. The debugger can perform a = variant of the latter half of step 3 above to narrow the range of addresses= to a more fine-grained range that pins it down to a line number and/or exp= ression within a statement. But if you were utilizing a source-debugger to= perform this step 5, you would have already had your answer and wouldn't b= e posting to c.l.a. I give this step 5 for completeness and as recommendat= ion of the automated modern way of doing this without manually performing s= teps 1 through 4 above like we used to do decades ago before the era of bet= ter source-code debuggers being ubiquitous.