comp.lang.ada
 help / color / mirror / Atom feed
* Debugger difference between GPS 2008/2009 and 2010
@ 2010-11-30 15:10 ldries46
  2010-12-04 22:12 ` Simon Wright
  2010-12-21 17:54 ` John McCormick
  0 siblings, 2 replies; 5+ messages in thread
From: ldries46 @ 2010-11-30 15:10 UTC (permalink / raw)


While debugging an ADA program in GPS I observed a rather annoying 
difference between the older versions of 2008 and 2009 versus the version of 
2010. In the program I'm trying to create I do use a lot of Unbounded 
Strings. Trying to display these strings in the older versions I could use 
'Debug' / 'Display "name"' which gave me a box with four elements, next, 
previous, reference and last. The first two are for internal use, the last 
presents the number of characters in the string and reference gave a pointer 
to the string (in blue). Clicking on that pointer revealed the stringunder 
the name of reference.all . In GPS 2010 reference.all always presents a 
message "unknown variable", however the unbounded string in the program 
itself can be correctly used.
May be I used a wrong setting but I cannot find which, can anybody help me.

L. Dries 




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

* Re: Debugger difference between GPS 2008/2009 and 2010
  2010-11-30 15:10 Debugger difference between GPS 2008/2009 and 2010 ldries46
@ 2010-12-04 22:12 ` Simon Wright
  2010-12-05 10:50   ` ldries46
  2010-12-21 17:54 ` John McCormick
  1 sibling, 1 reply; 5+ messages in thread
From: Simon Wright @ 2010-12-04 22:12 UTC (permalink / raw)


"ldries46" <bertus.dries@planet.nl> writes:

> While debugging an ADA program in GPS I observed a rather annoying
> difference between the older versions of 2008 and 2009 versus the
> version of 2010. In the program I'm trying to create I do use a lot of
> Unbounded Strings. Trying to display these strings in the older
> versions I could use 'Debug' / 'Display "name"' which gave me a box
> with four elements, next, previous, reference and last. The first two
> are for internal use, the last presents the number of characters in
> the string and reference gave a pointer to the string (in
> blue). Clicking on that pointer revealed the stringunder the name of
> reference.all . In GPS 2010 reference.all always presents a message
> "unknown variable", however the unbounded string in the program itself
> can be correctly used.
> May be I used a wrong setting but I cannot find which, can anybody
> help me.

Same behaviour here on Mac OS X.

With this program

   with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
   procedure Ubs is
      S : Unbounded_String;
   begin
      for J in 1 .. 10 loop
         S := S & "j";
      end loop;
   end Ubs;

and setting a break on line 6, using GPS 'Debug > Print S' I get this in
the debugger console window:
   (gdb) print S
   $3 = (
     prev => 0x0, 
     next => 0x0, 
     reference => 0x1001000a0
   )

If *in the debugger console window* I type this
   (gdb) p s.reference
   $4 = (access ada.strings.unbounded.shared_string) 0x1001000a0

and then this
   (gdb) p s.reference.all
   $5 = (
     max_length => 20, 
     counter => 1, 
     last => 2, 
     data => "j"
   )

So you can get there, just not as easily as you would have hoped or as
you used to.

The same behaviour occurs with GNAT GPL 2009, so the situation is that
GDB used to have (may still have!) special circuitry for dealing with
Unbounded_String as it was in GNAT GPL 2009, but doesn't for 2010.



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

* Re: Debugger difference between GPS 2008/2009 and 2010
  2010-12-04 22:12 ` Simon Wright
@ 2010-12-05 10:50   ` ldries46
  0 siblings, 0 replies; 5+ messages in thread
From: ldries46 @ 2010-12-05 10:50 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> schreef in bericht 
news:m24oattceu.fsf@pushface.org...
> "ldries46" <bertus.dries@planet.nl> writes:
>
>> While debugging an ADA program in GPS I observed a rather annoying
>> difference between the older versions of 2008 and 2009 versus the
>> version of 2010. In the program I'm trying to create I do use a lot of
>> Unbounded Strings. Trying to display these strings in the older
>> versions I could use 'Debug' / 'Display "name"' which gave me a box
>> with four elements, next, previous, reference and last. The first two
>> are for internal use, the last presents the number of characters in
>> the string and reference gave a pointer to the string (in
>> blue). Clicking on that pointer revealed the stringunder the name of
>> reference.all . In GPS 2010 reference.all always presents a message
>> "unknown variable", however the unbounded string in the program itself
>> can be correctly used.
>> May be I used a wrong setting but I cannot find which, can anybody
>> help me.
>
> Same behaviour here on Mac OS X.
>
> With this program
>
>   with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
>   procedure Ubs is
>      S : Unbounded_String;
>   begin
>      for J in 1 .. 10 loop
>         S := S & "j";
>      end loop;
>   end Ubs;
>
> and setting a break on line 6, using GPS 'Debug > Print S' I get this in
> the debugger console window:
>   (gdb) print S
>   $3 = (
>     prev => 0x0,
>     next => 0x0,
>     reference => 0x1001000a0
>   )
>
> If *in the debugger console window* I type this
>   (gdb) p s.reference
>   $4 = (access ada.strings.unbounded.shared_string) 0x1001000a0
>
> and then this
>   (gdb) p s.reference.all
>   $5 = (
>     max_length => 20,
>     counter => 1,
>     last => 2,
>     data => "j"
>   )
>
> So you can get there, just not as easily as you would have hoped or as
> you used to.
>
> The same behaviour occurs with GNAT GPL 2009, so the situation is that
> GDB used to have (may still have!) special circuitry for dealing with
> Unbounded_String as it was in GNAT GPL 2009, but doesn't for 2010.
Thanks for the useful suggestion.  I have experimented somewhat further and 
typed
display s.reference.all
which resulted in printing the variable every time I stepped through the 
program 




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

* Re: Debugger difference between GPS 2008/2009 and 2010
  2010-11-30 15:10 Debugger difference between GPS 2008/2009 and 2010 ldries46
  2010-12-04 22:12 ` Simon Wright
@ 2010-12-21 17:54 ` John McCormick
  2010-12-21 20:22   ` Simon Wright
  1 sibling, 1 reply; 5+ messages in thread
From: John McCormick @ 2010-12-21 17:54 UTC (permalink / raw)


I just found a similar problem in a debugger tutorial I use for my
Freshman students.  In the following procedure

   procedure Swap (Word : in out String) is
      Index : Positive;
   begin
      Index := Word'First;
      loop
         exit when Index > Word'Last  or else  Word (Index) in
Uppercase;
         Index := Index + 1;
      end loop;

      if Index <= Word'Last then
         Word := Word (Index .. Word'Last) & Word (Word'First .. Index
- 1);
      end if;
   end Swap;

we want to examine the parameter Word.  When we display Word, we see a
box with an address (of this formal parameter).  Double clicking on
the address used to open up another box (Word.all) with the value of
the string.  But now that we have changed over to GPS 2010, the
Word.all box shows "unknown variable" rather than the value of the
string.  Interestingly, if we ask to print the value of Word.all
rather than display the value of Word.all, the correct value of the
string is displayed in the debugger console window.

As I used this tutorial successfully with GPS 2008 and 2009, this is
definetely a new "feature" of GPS 2010.

John

On Nov 30, 9:10 am, "ldries46" <bertus.dr...@planet.nl> wrote:
> While debugging an ADA program in GPS I observed a rather annoying
> difference between the older versions of 2008 and 2009 versus the version of
> 2010. In the program I'm trying to create I do use a lot of Unbounded
> Strings. Trying to display these strings in the older versions I could use
> 'Debug' / 'Display "name"' which gave me a box with four elements, next,
> previous, reference and last. The first two are for internal use, the last
> presents the number of characters in the string and reference gave a pointer
> to the string (in blue). Clicking on that pointer revealed the stringunder
> the name of reference.all . In GPS 2010 reference.all always presents a
> message "unknown variable", however the unbounded string in the program
> itself can be correctly used.
> May be I used a wrong setting but I cannot find which, can anybody help me.
>
> L. Dries




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

* Re: Debugger difference between GPS 2008/2009 and 2010
  2010-12-21 17:54 ` John McCormick
@ 2010-12-21 20:22   ` Simon Wright
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Wright @ 2010-12-21 20:22 UTC (permalink / raw)


John McCormick <mccormick@cs.uni.edu> writes:

> As I used this tutorial successfully with GPS 2008 and 2009, this is
> definetely a new "feature" of GPS 2010.

It's always possible to use GPS 2009 with GNAT 2010; you lose some
features, and have a slightly more complex setup procedure (though, come
to think, on Windows you'd normally install GNAT first & then GPS, which
picks up whichever GNAT it finds -- I think --)



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

end of thread, other threads:[~2010-12-21 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-30 15:10 Debugger difference between GPS 2008/2009 and 2010 ldries46
2010-12-04 22:12 ` Simon Wright
2010-12-05 10:50   ` ldries46
2010-12-21 17:54 ` John McCormick
2010-12-21 20:22   ` Simon Wright

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