comp.lang.ada
 help / color / mirror / Atom feed
* Problem with gnatgdb and "break exception"
@ 1999-09-22  0:00 durif_philippe
  1999-09-23  0:00 ` Robert Dewar
  0 siblings, 1 reply; 2+ messages in thread
From: durif_philippe @ 1999-09-22  0:00 UTC (permalink / raw)


Hello,

Using Gnat, I'd like to be able to see the content of the stack
(subprogram called, line number, ...) when an unhandled
exception occurs and stop my program (with Alsys/Aonix Ada
this is a "standard" and extremely usefull feature).

It seems that gnatgdb could do that (with "break exception unhandled")
and I tried it but did'nt get any good information.


Precisely :
  uname -a 
  Linux saison.lifl.fr 2.2.5-15 #1 Mon Apr 19 23:00:46 EDT 1999 i686 unknown

  rpm -q -a |grep -i gnat
  gnat-3.11p-1-14
  gnat-3.11p-devel-1-14

Here is my test program :

  cat essai.adb 
        procedure essai is
           procedure q (S : STRING ; I : INTEGER) is
           begin
              raise Constraint_Error ;
           end q ;
           procedure p (S : STRING ; I : INTEGER) is
           begin
              q (S & '*', 2*I) ;
           end p ;
        begin
           p ("chaine", 12) ;
        end essai ;

Here is how I compiled it :

  gnatmake -v -g essai

  GNATMAKE 3.11p  (981118) Copyright 1995-1998 Free Software Foundation, Inc.
    "essai.ali" being checked ...
    -> "essai.adb" time stamp mismatch
  gnatgcc -c -g essai.adb
  gnatbind -x essai.ali
  gnatlink -g essai.ali


  ls -l essai
  -rwxr-xr-x   1 durif    rd2p        24845 Sep 22 10:35 essai*

The execution :
  essai

  raised CONSTRAINT_ERROR

The debugging :

[saison-/home/rd2p/durif/cl/tp/linux] gnatgdb essai
GNU gdb 4.17.0.11 with Linux and GNAT 3.11p support
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-Ada-linux"...
(gdb) show language
The current source language is "auto; currently ada".

--  ok

(gdb)
(gdb) begin
Function "__gnat_break_start" not defined.

--  strange, try something else

(gdb) break essai
Breakpoint 1 at 0x80490cb: file essai.adb, line 11.

--  ok

(gdb)
(gdb) directory /usr/lib/gcc-lib/i386-Ada-linux/2.8.1/adainclude/
Source directories searched:
 /usr/lib/gcc-lib/i386-Ada-linux/2.8.1/adainclude:$cdir:$cwd

--  ok

(gdb)
(gdb) run
Starting program: /.automount/home/rd2p/durif/cl/tp/linux/essai 

Breakpoint 1, essai () at essai.adb:11
11                 p ("chaine", 12) ;

--  ok

(gdb)
(gdb) break exception 
Breakpoint 2 at 0x40081850: file a-except.adb, line 868.

--  ok

(gdb) 
(gdb) continue
Continuing.

Breakpoint 2, <__gnat_raise_nodefer_with_msg>
 (e=Cannot access memory at address 0x21.) at a-except.adb:868
868        procedure Raise_Current_Excep (E : Exception_Id) is

--  ok

(gdb) 
(gdb) backtrace
#0  <__gnat_raise_nodefer_with_msg> (e=Cannot access memory at address 0x21.
) at a-except.adb:868
#1  0x40081aef in <__gnat_raise_with_msg>
 (e=Cannot access memory at address 0x11.) at a-except.adb:1031

--  nothing very helpfull

(gdb) cont
Continuing.

Breakpoint 2, 0x80490e0 in essai () at essai.adb:11
11                 p ("chaine", 12) ;

--  I did'nt expect that !

(gdb) backtrace
#0  <__gnat_raise_nodefer_with_msg> (e=0x401fbcb3) at a-except.adb:868
#1  0x40081b9b in ada.exceptions.reraise_occurrence_no_defer (x=@0x8048e4f)
    at a-except.adb:1066
#2  0x80490e0 in essai () at essai.adb:11
#3  0x8048e4f in main (argc=1, argv=0xbffff1a4, envp=0xbffff1ac)
    at b_essai.c:61
#4  0x401fbcb3 in __libc_start_main (main=0x8048e20 <main>,
    argc=1, argv=0xbffff1a4, init=0x8048b5c <_init>, 
    fini=0x8049128 <_fini>, rtld_fini=0x4000a350 <_dl_fini>,
    stack_end=0xbffff19c) at ../sysdeps/generic/libc-start.c:78

(gdb) cont
Continuing.

raised CONSTRAINT_ERROR

Program exited with code 01.

--  ok

(gdb) 



I certainly missed something, but what ?
Any help will be very appreciated !

Philippe Durif
-- 
Philippe Durif, Directeur de l'IUP GMI de Lille | email: durif@lifl.fr
     bureau 330 bis, LIFL bat. M3 USTL          | tel: 33 (0)3 20 43 42 66
       59655 Villeneuve d'Ascq Cedex            | fax: 33 (0)3 20 33 63 21
http://www.fil.univ-lille1.fr




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

* Re: Problem with gnatgdb and "break exception"
  1999-09-22  0:00 Problem with gnatgdb and "break exception" durif_philippe
@ 1999-09-23  0:00 ` Robert Dewar
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Dewar @ 1999-09-23  0:00 UTC (permalink / raw)


In article <uimso47ux9z.fsf@saison.lifl.fr>,
  durif_philippe <durif@lifl.fr> wrote:
> Hello,
>
> Using Gnat, I'd like to be able to see the content of the
stack
> (subprogram called, line number, ...) when an unhandled
> exception occurs and stop my program (with Alsys/Aonix Ada
> this is a "standard" and extremely usefull feature).

I would suggest that highly GNAT specific questions like this
be addressed to the chat@gnat.com list, subscribe by sending
a subscribe message to chat-request@gnat.com.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




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

end of thread, other threads:[~1999-09-23  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-09-22  0:00 Problem with gnatgdb and "break exception" durif_philippe
1999-09-23  0:00 ` Robert Dewar

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