comp.lang.ada
 help / color / mirror / Atom feed
* Debugger for GNAT
@ 2005-11-18 12:43 markp
  2005-11-18 14:07 ` Jeff Creem
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: markp @ 2005-11-18 12:43 UTC (permalink / raw)


We are currently using the GPS debugger for our GNAT Ada applications.
We feel it is not a very robust debugger, although that could be our
limited experience with it. For example, we would to be able to break
on any exceptions and view the offending line in the debugger and trace
to the source. Also, we would like to be able to set breakpoints in
tasks while the program is running without stopping everything, i.e.
stopping a single task.

Are there any other debuggers out the to debug our GNAT Ada?

Thank you.




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

* Re: Debugger for GNAT
  2005-11-18 12:43 Debugger for GNAT markp
@ 2005-11-18 14:07 ` Jeff Creem
  2005-11-18 14:11 ` Marc A. Criley
  2005-11-18 22:47 ` Simon Wright
  2 siblings, 0 replies; 11+ messages in thread
From: Jeff Creem @ 2005-11-18 14:07 UTC (permalink / raw)


markp wrote:
> We are currently using the GPS debugger for our GNAT Ada applications.
> We feel it is not a very robust debugger, although that could be our
> limited experience with it. For example, we would to be able to break
> on any exceptions and view the offending line in the debugger and trace
> to the source. Also, we would like to be able to set breakpoints in

This should work.

enter break exception in the command window.

Perhaps I am not understanding the question/concern because this is 
pretty clear in the GNAT/gdb documentation.

> tasks while the program is running without stopping everything, i.e.
> stopping a single task.

Not sure about this one. All GNAT debuggers I know of are based on gdb 
so I think the question (in terms that make sense to gdb people) to look 
into is it possible to set a breakpoint in a single thread under gdb 
such that when one thread stops at a breakpoint, other threads still 
continue.

The answer may end up depending on the OS..


> 
> Are there any other debuggers out the to debug our GNAT Ada?
> 
> Thank you.
> 

I have used ddd quite a bit. Most gdb GUI front ends will work. 
Sometimes to use them with Ada you have to get used to a few quirks or 
worse yet read the documentation :)



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

* Re: Debugger for GNAT
  2005-11-18 12:43 Debugger for GNAT markp
  2005-11-18 14:07 ` Jeff Creem
@ 2005-11-18 14:11 ` Marc A. Criley
  2005-11-18 22:47 ` Simon Wright
  2 siblings, 0 replies; 11+ messages in thread
From: Marc A. Criley @ 2005-11-18 14:11 UTC (permalink / raw)


markp wrote:
> We are currently using the GPS debugger for our GNAT Ada applications.
> We feel it is not a very robust debugger, although that could be our
> limited experience with it. For example, we would to be able to break
> on any exceptions and view the offending line in the debugger and trace
> to the source. Also, we would like to be able to set breakpoints in
> tasks while the program is running without stopping everything, i.e.
> stopping a single task.
> 
> Are there any other debuggers out the to debug our GNAT Ada?

GPS is built around gdb, and while I still use the old gvd interface for 
3.15p, I know you can certainly set a breakpoint on any or all 
user-defined and predefined exceptions and trace them back to the 
source.  At the very least set a breakpoint on all exceptions (the gdb 
command is "b except" and when it breaks, go up the call stack to get 
back to the offending line of your code.

I'm hard pressed to see how one could break on a task and provide an 
interactive interface to the user, while allowing the rest of the 
program to continue running.  I'm not saying it can't be done, but it 
sure looks tricky.

I think it would behoove y'all to increase your limited experience with 
the debugger :-)

Ask how to do things here, or over on the GPS mailing list, and you 
should find advice and suggestions readily available.

-- Marc A. Criley
-- McKae Technologies
-- www.mckae.com
-- DTraq - XPath In Ada - XML EZ Out



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

* Re: Debugger for GNAT
  2005-11-18 12:43 Debugger for GNAT markp
  2005-11-18 14:07 ` Jeff Creem
  2005-11-18 14:11 ` Marc A. Criley
@ 2005-11-18 22:47 ` Simon Wright
  2005-11-19 15:39   ` Anonymous Coward
  2 siblings, 1 reply; 11+ messages in thread
From: Simon Wright @ 2005-11-18 22:47 UTC (permalink / raw)


"markp" <markwork66@yahoo.com> writes:

> We are currently using the GPS debugger for our GNAT Ada applications.
> We feel it is not a very robust debugger, although that could be our
> limited experience with it. For example, we would to be able to break
> on any exceptions and view the offending line in the debugger and trace
> to the source. Also, we would like to be able to set breakpoints in
> tasks while the program is running without stopping everything, i.e.
> stopping a single task.

I don't see how your problem with breaking on exceptions can be said
to make the debugger not _robust_.

To set breakpoints on all exceptions via menus, try Debug / Initialize
/ your_program, then Debug / Data / Edit breakpoints and go to the
Exception tab, then immediately click on the Add button at top right
-- this selects all exceptions. If I remember correctly you could
also type eg Constraint_Error where it starts off saying 'All
exceptions'.

Under VxWorks the recommended method of debugging indeed stops just
the current task while the rest of the system trundles on. Not always
the most convenient thing to happen, and you can't just skip over to
another task to see what it's up to. I believe that most conventional
OSs stop the whole program.



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

* Re: Debugger for GNAT
  2005-11-18 22:47 ` Simon Wright
@ 2005-11-19 15:39   ` Anonymous Coward
  2005-11-19 16:47     ` Ludovic Brenta
  2005-11-19 23:55     ` Georg Bauhaus
  0 siblings, 2 replies; 11+ messages in thread
From: Anonymous Coward @ 2005-11-19 15:39 UTC (permalink / raw)


Regarding this discussion as to whether GDB is robust, I've
encountered many problems with GDB, many of which I believe are not
user errors.  I'd like to post some examples of the anomalies I've
observed, to see if you folks can discover user errors that I'm
unaware of.

Here is the first example.  Keeping it simple, I'm merely asking gdb
to list the functions that I can set breakpoints in.

[hello_world.adb]

   with Ada.Text_IO;

   procedure Hello_World is

      function Hello_World_String return String is
      begin

         return "Hello world!";

      end Hello_World_String;

   begin

      Ada.Text_IO.Put_Line(Hello_World_String);

   end Hello_World;

compiled as:

   $ gnatmake -O0 -ggdb hello_world.adb
   gcc -c -O0 -ggdb hello_world.adb
   gnatbind -x hello_world.ali
   gnatlink -ggdb hello_world.ali

GDB session:

   GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
   (gdb) file hello_world
   Reading symbols from hello_world...done.
   (gdb) info function
   internal error - unimplemented function unk_lang_create_fundamental_type called.
   (gdb) break hello_world.adb:14
   internal error - unimplemented function unk_lang_create_fundamental_type called.

So GDB finds no functions, and it also fails to set a breakpoint on
line 14.



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

* Re: Debugger for GNAT
  2005-11-19 15:39   ` Anonymous Coward
@ 2005-11-19 16:47     ` Ludovic Brenta
  2005-11-19 23:55     ` Georg Bauhaus
  1 sibling, 0 replies; 11+ messages in thread
From: Ludovic Brenta @ 2005-11-19 16:47 UTC (permalink / raw)


Anonymous Coward <spam@spam.com> writes:
>    GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)

Is this the Ada-aware GDB from AdaCore?  On Debian, the package gdb is
not Ada-aware, only gnat-gdb is.

-- 
Ludovic Brenta.




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

* Re: Debugger for GNAT
  2005-11-19 15:39   ` Anonymous Coward
  2005-11-19 16:47     ` Ludovic Brenta
@ 2005-11-19 23:55     ` Georg Bauhaus
  2005-11-20  0:17       ` Anonymous Coward
  1 sibling, 1 reply; 11+ messages in thread
From: Georg Bauhaus @ 2005-11-19 23:55 UTC (permalink / raw)


On Sat, 2005-11-19 at 15:39 +0000, Anonymous Coward wrote:
> Regarding this discussion as to whether GDB is robust, I've
> encountered many problems with GDB, many of which I believe are not
> user errors. 

Results will likely improve when you use a GDB that has
been make aware of Ada.

$ gdb
GNU gdb 6.3 for GNAT GPL 2005 Edition (20050615)
Copyright 2004 Free Software Foundation, Inc.
AdaCore version of GDB for GNAT GPL Edition
...
(gdb) file hello_world
Reading symbols from /tmp/hello_world...done.
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
(gdb) info function
All defined functions:

File b~hello_world.adb:
procedure adafinal;
procedure adainit;
function main (a1: integer; a2: system.address;
    a3: system.address) return integer;

File hello_world.adb:
procedure hello_world;
function hello_world.hello_world_string return string;

...






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

* Re: Debugger for GNAT
  2005-11-19 23:55     ` Georg Bauhaus
@ 2005-11-20  0:17       ` Anonymous Coward
  2005-11-24  5:47         ` GDB 2.8.1 defect Anonymous Coward
  0 siblings, 1 reply; 11+ messages in thread
From: Anonymous Coward @ 2005-11-20  0:17 UTC (permalink / raw)


In article <1132444533.17109.3.camel@sonnenregen>, Georg Bauhaus wrote:
> On Sat, 2005-11-19 at 15:39 +0000, Anonymous Coward wrote:
>> Regarding this discussion as to whether GDB is robust, I've
>> encountered many problems with GDB, many of which I believe are not
>> user errors. 
> 
> Results will likely improve when you use a GDB that has
> been make aware of Ada.

Thanks for the tip.  The problems I've observed were on an
installation that was Ada aware, but I just tried to reproduce those
problems on a non-Ada aware GDB, and the error I posted was produced.
I'll have to upgrade this RedHat 9 installation to include the Ada
aware version so I can get down to the real problems that I found on
the Ada aware GDB.

One such problem is that the "finish" command does not work.  I had a
function that returned a float constrained to -1.0 to 1.0.  The
"finish" command incorrectly reported the function to return -1.999xxx
when it actually returned 0.89xxx.  So the "finish" command cannot be
trusted on version 2.8.1.  I'll try to isolate that code into a small
demonstration, which I will post if someone wants to see it.

Or does someone know if this is a known problem that may have been
fixed?  



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

* GDB 2.8.1 defect
  2005-11-20  0:17       ` Anonymous Coward
@ 2005-11-24  5:47         ` Anonymous Coward
  2005-11-24  7:01           ` Brian May
  0 siblings, 1 reply; 11+ messages in thread
From: Anonymous Coward @ 2005-11-24  5:47 UTC (permalink / raw)


In article.., Anonymous Coward wrote:
> 
> One such problem is that the "finish" command does not work.  I had
> a function that returned a float constrained to -1.0 to 1.0.  The
> "finish" command incorrectly reported the function to return
> -1.999xxx when it actually returned 0.89xxx.  So the "finish"
> command cannot be trusted on version 2.8.1.  I'll try to isolate
> that code into a small demonstration, which I will post if someone
> wants to see it.

Okay, here is a piece of code to illustrate the defect:

   procedure GDB_Final_Failure is

      function Simple_Float return Float is
      begin
         return 5.5;
      end Simple_Float;

      Some_Float : Float;

   begin

      Some_Float := Simple_Float;
      null;

   end GDB_Final_Failure;

Run these commands in gdb:

   tbreak gdb_final_failure.adb:5
   run
   finish # observe that it claims to return ~-1.999
   next
   info locals # notice that it actually returned 5.5

I'm not sure if this defect has been corrected in recent versions.



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

* Re: GDB 2.8.1 defect
  2005-11-24  5:47         ` GDB 2.8.1 defect Anonymous Coward
@ 2005-11-24  7:01           ` Brian May
  2005-11-24 12:17             ` Georg Bauhaus
  0 siblings, 1 reply; 11+ messages in thread
From: Brian May @ 2005-11-24  7:01 UTC (permalink / raw)


>>>>> "Anonymous" == Anonymous Coward <spam@spam.com> writes:

    Anonymous> tbreak gdb_final_failure.adb:5
    Anonymous> run
    Anonymous> finish # observe that it claims to return ~-1.999
    Anonymous> next
    Anonymous> info locals # notice that it actually returned 5.5

on debian/sarge, powerpc, gnat 3.15p-12 compiler:

# gdb gdb_final_failure
GNU gdb 6.3-debian
Copyright 2004 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 "powerpc-linux"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) tbreak gdb_final_failure.adb:5
Breakpoint 1 at 0x1800c2c: file gdb_final_failure.adb, line 5.
(gdb) run
Starting program: /home/bam/tmp/gdb_final_failure
gdb_final_failure.simple_float () at gdb_final_failure.adb:5
5                return 5.5;
(gdb) finish
Run till exit from #0  gdb_final_failure.simple_float ()
    at gdb_final_failure.adb:5
0x01800c68 in gdb_final_failure () at gdb_final_failure.adb:12
12            Some_Float := Simple_Float;
Value returned is $1 = 5.5
(gdb) next
13            null;
(gdb) info locals
some_float = 5.5
(gdb) c
Continuing.

Program exited normally.
(gdb) q

It looks OK to me...
-- 
Brian May <bam@snoopy.apana.org.au>



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

* Re: GDB 2.8.1 defect
  2005-11-24  7:01           ` Brian May
@ 2005-11-24 12:17             ` Georg Bauhaus
  0 siblings, 0 replies; 11+ messages in thread
From: Georg Bauhaus @ 2005-11-24 12:17 UTC (permalink / raw)


On Thu, 2005-11-24 at 18:01 +1100, Brian May wrote:

> (gdb) finish
> Run till exit from #0  gdb_final_failure.simple_float ()
>     at gdb_final_failure.adb:5
> 0x01800c68 in gdb_final_failure () at gdb_final_failure.adb:12
> 12            Some_Float := Simple_Float;
> Value returned is $1 = 5.5
> (gdb)

I get a similar result using the GNAT GPL Edition's gdb.





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

end of thread, other threads:[~2005-11-24 12:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-18 12:43 Debugger for GNAT markp
2005-11-18 14:07 ` Jeff Creem
2005-11-18 14:11 ` Marc A. Criley
2005-11-18 22:47 ` Simon Wright
2005-11-19 15:39   ` Anonymous Coward
2005-11-19 16:47     ` Ludovic Brenta
2005-11-19 23:55     ` Georg Bauhaus
2005-11-20  0:17       ` Anonymous Coward
2005-11-24  5:47         ` GDB 2.8.1 defect Anonymous Coward
2005-11-24  7:01           ` Brian May
2005-11-24 12:17             ` Georg Bauhaus

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