comp.lang.ada
 help / color / mirror / Atom feed
* stacktrace on linux
@ 2003-08-14  7:17 Martin Moosbrucker
  2003-08-14 14:39 ` Ludovic Brenta
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Martin Moosbrucker @ 2003-08-14  7:17 UTC (permalink / raw)


Hi,

I'd like to get the stack trace of a program running on a RedHat 7.3
operating system as I get it on a windows2000 os.

The stack trace on windows looks like that:

1/ 0
Exception name: CONSTRAINT_ERROR
Message: stack_trace.adb:13
Call stack traceback locations:
0x40144b 0x4015f3 0x401806 0x401265 0x401103 0x77e8ca8e
0040144B in testexception.outer.inner at stack_trace.adb:13
004015F3 in testexception.outer at stack_trace.adb:19
00401806 in testexception at stack_trace.adb:26
00401265 in ?? at crt1.c:0
00401103 in ?? at crt1.c:0
77E8CA8E in ?? at fake:0

on RedHat I don't get any information of the lines in my sourcecode:

Exception name: CONSTRAINT_ERROR
Message: stack_trace.adb:13
Call stack traceback locations:
0x804a090 0x804a3e3 0x804a6df 0x8049d91 0x42017497
0x804a090 in ?? at ??:0
0x804a3e3 in ?? at ??:0
0x804a6df in ?? at ??:0
0x8049d91 in ?? at ??:0
0x42017497 in ?? at ??:0

I am using the following compile / bind and link switches on both ops:

compiler: -O3 -gnatf -gnatwu -gnato -funwind-tables
binder: -f -E
linker: -g -i

The source code generating the exceptions above:

with Ada.Exceptions;
with Gnat.Traceback.Symbolic;

with Text_Io;
use  Text_Io;

procedure Testexception is

type Float_32 is digits  6 range Interfaces.Ieee_Float_32'First ..
                                   Interfaces.Ieee_Float_32'Last;

  procedure Outer is
    procedure Inner(y:integer) is
      x : integer;
    begin
      text_io.put_line("1/"&integer'image(y));
      X := 1 / Y;
      x:=x**2;
      text_io.put_line("finished." & integer'image(x));
    end;
  begin
    begin
      Inner(0);
    exception
      when E : others =>
Text_Io.Put_Line(Ada.Exceptions.Exception_Information(E) &
Gnat.Traceback.Symbolic.Symbolic_Traceback(E));
    end;
  end;
begin

Text_Io.Put_Line("Float_32'Machine_Overflows"&Boolean'Image(Float_32'Machine
_Overflows));
  Outer;
exception
  when e : others =>
Text_io.put_line(Ada.Exceptions.Exception_Information(E) &
Gnat.Traceback.Symbolic.Symbolic_Traceback(E));
end;

Thanks,
Martin






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: stacktrace on linux
  2003-08-14  7:17 stacktrace on linux Martin Moosbrucker
@ 2003-08-14 14:39 ` Ludovic Brenta
  2003-08-15  9:44 ` 
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Ludovic Brenta @ 2003-08-14 14:39 UTC (permalink / raw)


"Martin Moosbrucker" <martin_moosbrucker@web.de> writes:

> Hi,
> 
> I'd like to get the stack trace of a program running on a RedHat 7.3
> operating system as I get it on a windows2000 os.
> 
[...] 
> on RedHat I don't get any information of the lines in my sourcecode:
[...]
> I am using the following compile / bind and link switches on both ops:
> 
> compiler: -O3 -gnatf -gnatwu -gnato -funwind-tables
> binder: -f -E
> linker: -g -i
[...]


I assume you're using the binary distribution of GNAT for GNU/Linux
from ftp://ftp.cs.nyu.edu; it has support for symbolic stack traces.
Most GNU/Linux distributions that include GNAT have this support
disabled.

I think you need to add -g to the compiler switches.  You may combine
it with -O3.

You may also need to link against libaddr2line.a, which comes with
GNAT, as I'm not sure whether or not the linker does it automatically
for you.

HTH

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: stacktrace on linux
  2003-08-14  7:17 stacktrace on linux Martin Moosbrucker
  2003-08-14 14:39 ` Ludovic Brenta
@ 2003-08-15  9:44 ` 
  2003-08-17 18:31   ` Gautier Write-only
  2003-08-15 19:26 ` Simon Wright
  2003-08-19  7:50 ` nicolas
  3 siblings, 1 reply; 6+ messages in thread
From:  @ 2003-08-15  9:44 UTC (permalink / raw)


As piece of advice: do not switch optimization on when you want to debug 
a program.

Related to your problem, I am afraid you are not using the "Ada enabled" 
gdb that comes with GNAT. Try the command "set language ada" in the gdb 
prompt. If the result is "Unknown language 'ada'", you have to set in 
your path first the gdb distributed with GNAT.

Rodrigo

Martin Moosbrucker wrote:
> Hi,
> 
> I'd like to get the stack trace of a program running on a RedHat 7.3
> operating system as I get it on a windows2000 os.
> 
> The stack trace on windows looks like that:
> 
> 1/ 0
> Exception name: CONSTRAINT_ERROR
> Message: stack_trace.adb:13
> Call stack traceback locations:
> 0x40144b 0x4015f3 0x401806 0x401265 0x401103 0x77e8ca8e
> 0040144B in testexception.outer.inner at stack_trace.adb:13
> 004015F3 in testexception.outer at stack_trace.adb:19
> 00401806 in testexception at stack_trace.adb:26
> 00401265 in ?? at crt1.c:0
> 00401103 in ?? at crt1.c:0
> 77E8CA8E in ?? at fake:0
> 
> on RedHat I don't get any information of the lines in my sourcecode:
> 
> Exception name: CONSTRAINT_ERROR
> Message: stack_trace.adb:13
> Call stack traceback locations:
> 0x804a090 0x804a3e3 0x804a6df 0x8049d91 0x42017497
> 0x804a090 in ?? at ??:0
> 0x804a3e3 in ?? at ??:0
> 0x804a6df in ?? at ??:0
> 0x8049d91 in ?? at ??:0
> 0x42017497 in ?? at ??:0
> 
> I am using the following compile / bind and link switches on both ops:
> 
> compiler: -O3 -gnatf -gnatwu -gnato -funwind-tables
> binder: -f -E
> linker: -g -i
> 
> The source code generating the exceptions above:
> 
> with Ada.Exceptions;
> with Gnat.Traceback.Symbolic;
> 
> with Text_Io;
> use  Text_Io;
> 
> procedure Testexception is
> 
> type Float_32 is digits  6 range Interfaces.Ieee_Float_32'First ..
>                                    Interfaces.Ieee_Float_32'Last;
> 
>   procedure Outer is
>     procedure Inner(y:integer) is
>       x : integer;
>     begin
>       text_io.put_line("1/"&integer'image(y));
>       X := 1 / Y;
>       x:=x**2;
>       text_io.put_line("finished." & integer'image(x));
>     end;
>   begin
>     begin
>       Inner(0);
>     exception
>       when E : others =>
> Text_Io.Put_Line(Ada.Exceptions.Exception_Information(E) &
> Gnat.Traceback.Symbolic.Symbolic_Traceback(E));
>     end;
>   end;
> begin
> 
> Text_Io.Put_Line("Float_32'Machine_Overflows"&Boolean'Image(Float_32'Machine
> _Overflows));
>   Outer;
> exception
>   when e : others =>
> Text_io.put_line(Ada.Exceptions.Exception_Information(E) &
> Gnat.Traceback.Symbolic.Symbolic_Traceback(E));
> end;
> 
> Thanks,
> Martin
> 
> 
> 





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: stacktrace on linux
  2003-08-14  7:17 stacktrace on linux Martin Moosbrucker
  2003-08-14 14:39 ` Ludovic Brenta
  2003-08-15  9:44 ` 
@ 2003-08-15 19:26 ` Simon Wright
  2003-08-19  7:50 ` nicolas
  3 siblings, 0 replies; 6+ messages in thread
From: Simon Wright @ 2003-08-15 19:26 UTC (permalink / raw)


"Martin Moosbrucker" <martin_moosbrucker@web.de> writes:

> on RedHat I don't get any information of the lines in my sourcecode:
> 
> Exception name: CONSTRAINT_ERROR
> Message: stack_trace.adb:13
> Call stack traceback locations:
> 0x804a090 0x804a3e3 0x804a6df 0x8049d91 0x42017497
> 0x804a090 in ?? at ??:0
> 0x804a3e3 in ?? at ??:0
> 0x804a6df in ?? at ??:0
> 0x8049d91 in ?? at ??:0
> 0x42017497 in ?? at ??:0

You probably need -g, as others have said.

Also, you should have addr2line installed or installable: in your case,

$ addr2line -e executable 0x804a090 0x804a3e3 0x804a6df 0x8049d91 0x42017497



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: stacktrace on linux
  2003-08-15  9:44 ` 
@ 2003-08-17 18:31   ` Gautier Write-only
  0 siblings, 0 replies; 6+ messages in thread
From: Gautier Write-only @ 2003-08-17 18:31 UTC (permalink / raw)


Rodrigo Garc�a:

> Related to your problem, I am afraid you are not using the "Ada enabled"
> gdb that comes with GNAT. Try the command "set language ada" in the gdb
> prompt. If the result is "Unknown language 'ada'", you have to set in
> your path first the gdb distributed with GNAT.

Are you sure you need gdb ?
At least on executables for Win32 the trace-back code is standalone.
You obtain the same output after removing gbd.exe .
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: stacktrace on linux
  2003-08-14  7:17 stacktrace on linux Martin Moosbrucker
                   ` (2 preceding siblings ...)
  2003-08-15 19:26 ` Simon Wright
@ 2003-08-19  7:50 ` nicolas
  3 siblings, 0 replies; 6+ messages in thread
From: nicolas @ 2003-08-19  7:50 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2796 bytes --]

Which version of Gnat are you using ?

I had a similar problem with Gnat 3.14p and RedHat 7.2 last year.
The problem came from libbfd version
Gnat 3.14p required  libbfd-2.9 for correct stacktrace, and RedHat 7.2
included a libbfd-2.11.
To solve the problem, I retrieved libbfd-2.9.5.0.22.so and copied it in
/usr/gnat/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/
I added
-largs /usr/gnat/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/libbfd-2.9.5.0.22.so
to my gnatmake command

Nicolas

"Martin Moosbrucker" <martin_moosbrucker@web.de> a �crit dans le message de
news:bhfd36$42gt$1@ID-169866.news.uni-berlin.de...
> Hi,
>
> I'd like to get the stack trace of a program running on a RedHat 7.3
> operating system as I get it on a windows2000 os.
>
> The stack trace on windows looks like that:
>
> 1/ 0
> Exception name: CONSTRAINT_ERROR
> Message: stack_trace.adb:13
> Call stack traceback locations:
> 0x40144b 0x4015f3 0x401806 0x401265 0x401103 0x77e8ca8e
> 0040144B in testexception.outer.inner at stack_trace.adb:13
> 004015F3 in testexception.outer at stack_trace.adb:19
> 00401806 in testexception at stack_trace.adb:26
> 00401265 in ?? at crt1.c:0
> 00401103 in ?? at crt1.c:0
> 77E8CA8E in ?? at fake:0
>
> on RedHat I don't get any information of the lines in my sourcecode:
>
> Exception name: CONSTRAINT_ERROR
> Message: stack_trace.adb:13
> Call stack traceback locations:
> 0x804a090 0x804a3e3 0x804a6df 0x8049d91 0x42017497
> 0x804a090 in ?? at ??:0
> 0x804a3e3 in ?? at ??:0
> 0x804a6df in ?? at ??:0
> 0x8049d91 in ?? at ??:0
> 0x42017497 in ?? at ??:0
>
> I am using the following compile / bind and link switches on both ops:
>
> compiler: -O3 -gnatf -gnatwu -gnato -funwind-tables
> binder: -f -E
> linker: -g -i
>
> The source code generating the exceptions above:
>
> with Ada.Exceptions;
> with Gnat.Traceback.Symbolic;
>
> with Text_Io;
> use  Text_Io;
>
> procedure Testexception is
>
> type Float_32 is digits  6 range Interfaces.Ieee_Float_32'First ..
>                                    Interfaces.Ieee_Float_32'Last;
>
>   procedure Outer is
>     procedure Inner(y:integer) is
>       x : integer;
>     begin
>       text_io.put_line("1/"&integer'image(y));
>       X := 1 / Y;
>       x:=x**2;
>       text_io.put_line("finished." & integer'image(x));
>     end;
>   begin
>     begin
>       Inner(0);
>     exception
>       when E : others =>
> Text_Io.Put_Line(Ada.Exceptions.Exception_Information(E) &
> Gnat.Traceback.Symbolic.Symbolic_Traceback(E));
>     end;
>   end;
> begin
>
>
Text_Io.Put_Line("Float_32'Machine_Overflows"&Boolean'Image(Float_32'Machine
> _Overflows));
>   Outer;
> exception
>   when e : others =>
> Text_io.put_line(Ada.Exceptions.Exception_Information(E) &
> Gnat.Traceback.Symbolic.Symbolic_Traceback(E));
> end;
>
> Thanks,
> Martin
>
>
>





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-08-19  7:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-14  7:17 stacktrace on linux Martin Moosbrucker
2003-08-14 14:39 ` Ludovic Brenta
2003-08-15  9:44 ` 
2003-08-17 18:31   ` Gautier Write-only
2003-08-15 19:26 ` Simon Wright
2003-08-19  7:50 ` nicolas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox