This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb and ada exceptions


Hello,

I am attempting to use gdb to debug some ada code.  My goal is to set a
catchpoint when an exception is raised.

Below is a small example (except for b.ads, which is trivial to create).
The example does nothing other than raise a range_error or explicitly
call an exception.

Using gcc-3.4.6 for the compiler, and gdb-6.8 for gdb.

I looked at gdb source, and here is the pertinent comment for the error
message:


/* At this point, we know that we are debugging an Ada program and
     that the inferior has been started, but we still are not able to
     find the run-time symbols. That can mean that we are in
     configurable run time mode, or that a-except as been optimized
     out by the linker...  In any case, at this point it is not worth
     supporting this feature.  */

So, evidently I am compiling this wrong or linking it in a way which is
not supported by gdb.  

Any ideas ?

Thanks,
Bud Davis





$ cat try.adb
with text_io;
use text_io;
with b;

procedure try is
begin
    for I in 0..10000 loop
       b.run;
    end loop;
exception
        when others=>
             text_io.put_line("in handler");
             raise;
end;
$ cat b.adb
with text_io;
use text_io;
package body b is
  i:natural:=1;
procedure run is
begin
  i:=i - 1;
  raise program_error;
end run;
end b;
$ rm try *.o
$ gnatmake -g try
gcc -c -g try.adb
gcc -c -g b.adb
gnatbind -x try.ali
gnatlink try.ali -g
$ gdb try
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show
copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
(gdb) break main
Breakpoint 1 at 0x80494e5: file b~try.adb, line 132.
(gdb) run
Starting program: /home/users/td24812/aio/try

Breakpoint 1, main (argc=1, argv=(system.address) 0xbfef12f4,
envp=(system.address) 0xbfef12fc) at b~try.adb:132
132           Ensure_Reference : System.Address :=
Ada_Main_Program_Name'Address;
(gdb) catch exception
Cannot insert catchpoints in this configuration.
(gdb)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]