ada and gdb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 I posted this question almost a month ago on the gdb mailing list with 
no replies. {this isn't a complaint, just so you know I did try that
avenue). 

Does anyone have a hint from gcc world ?

thanks,
bud davis



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)


-------------------------------------------------     
    * "Consistently separating words by spaces became a general custom about the tenth century A.D., and lasted until about 1957, when FORTRAN abandoned the practice." —Sun FORTRAN Reference Manual
 




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux