This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: GDB with Ada doesn't print variables neither works with GPS
On 7/29/07, Joel Brobecker <brobecker@adacore.com> wrote:
> > It seems I'm unable to print variables properly in GDB when debugging
> > an Ada application. This is the best I can get:
> >
> > (gdb) p /c Hello_String.all
> > $1 = (72 'H', 101 'e', 108 'l', 108 'l', 111 'o')
>
> The only thing that you are missing here is the fact that this string
> is not printed as a usual string but instead an array of characters.
> I suspect that the reason that GDB does not identify your object as
> a string is incomplete/incorrect debugging info.
I've built my application like this:
gnatmake -f -g hello
And also tried:
gnatmake -f -g -gnatdA -gnatdV hello
What am I missing here?
> What does ptype Hello_String.all say? It should say "array of
> character". If it doesn't then, the GDB output is expected.
For these variables I get:
Hello_String: constant STRING := "Hello, world! - string variable";
(gdb) ptype Hello_String
type = array (1 .. 31) of <1-byte integer>
Bye_String : String_Access := new String'("Bye! - string access");
(gdb) ptype Bye_String
type = array (<>) of <1-byte integer>
Any ideas on how I can get nicely printed strings like if I were
debugging C code?
Thanks!