← Back to team overview

sslug-teknik team mailing list archive

tracebacks in ada (gnat) ?

 

Hej!
Jag har ett simpelt test program som jag vill få att visa
vilken rad som orsakar en crash. Problemet är att jag inte kan 
tolka vilken rad som är boven.

Jag skulle helst vilja få ut något i stil med

6       bnl     raised mytest
8       hello   bnl.test

vilket man får med Alsys och Aonix kompilatorer.

Jag kanske bara har fel argument till compilator/binde/linker ?

Vet någon om det går överuvudtaget ?


filerna är kompilerade med gnatmake:

gnatmake filenamn -cargs -gnatfoE -funwind-tables -bargs -E 

bnl.adb:
with text_io; use text_io;
package body bnl is
  procedure Test is
  begin
    Put_Line ("Raising mytest from line 5-6 of bnl!");
    raise mytest;
  end Test;
end bnl;

bnl.ads
package bnl is
  mytest :  exception;
  procedure Test ;
end bnl;

hello.adb
with Text_IO; use Text_IO;
with bnl;
with GNAT.Traceback.Symbolic;
with ada.exceptions;
procedure Hello is
begin
  Put_Line ("Hello WORLD!");
  bnl.test;
exception
  when Event:
   others =>
    declare
      Str : constant String :=
         GNAT.Traceback.Symbolic.Symbolic_Traceback (Event);
    begin
      text_io.Put_Line(Str);
    end;
end Hello;

[bnl@della ada]$ ./hello
Hello WORLD!
Raising mytest from line 5-6 of bnl!
0x804945b in ?? at init.c:0
0x80498c7 in ?? at init.c:0
 
[bnl@della ada]$ gnat_addr2line -e hello addr 0x804945b
??:0
/export/home/chmou/rpm/BUILD/glibc-2.2.2/csu/init.c:0
[bnl@della ada]$ gnat_addr2line -e hello addr 0x80498c7
??:0
/export/home/chmou/rpm/BUILD/glibc-2.2.2/csu/init.c:0
[bnl@della ada]$


Follow ups