From: Paruthi <sathishveluswamy@gmail.com>
Subject: Re: How to print string, record variable while debugging with GDB using GPS
Date: Fri, 20 Feb 2009 05:21:40 -0800 (PST)
Date: 2009-02-20T05:21:40-08:00 [thread overview]
Message-ID: <f9761708-7259-4aaa-aa59-37050b45e5e6@i18g2000prf.googlegroups.com> (raw)
In-Reply-To: 04feea45-5bf3-475d-a37d-b4e8c7db4c66@r10g2000prf.googlegroups.com
On Feb 20, 3:43 pm, Paruthi <sathishvelusw...@gmail.com> wrote:
> On Feb 19, 7:30 pm, Georg Bauhaus <rm.dash-bauh...@futureapps.de>
> wrote:
>
>
>
>
>
> > Paruthi schrieb:
>
> > > Hi,
>
> > > Can any one please help me how to print the value of the variable
> > > which is of a string type, instance of a record..etc while debugging
> > > with GDB using Ada code. For simple string I get the value in ascii
> > > value. Is there any way where I get the actual string value instead of
> > > ASCII value.
>
> > Did you use the GDB provided with your Ada environement?
>
> > (gdb) list
> > 1 procedure test is
> > 2 x: string(1..10);
> > 3 begin
> > 4 x := "ABCDEFGHIJ";
> > 5 x(1) := x(2);
> > 6 end;
> > (gdb) display x
> > 4: x = "["00"]["00"]["00"]["00"]["00"]["00"]["00"]["00"]&["1d"]"
> > (gdb) n
> > 5 x(1) := x(2);
> > 4: x = "ABCDEFGHIJ"
> > (gdb) n
> > 6 end;
> > 4: x = "BBCDEFGHIJ"
> > (gdb)
>
> Hello Georg,
>
> Thanks for the quick response and help. I tried your instruction it
> works well for the sample code. But I have a sample piece of code in
> that if i try to print the string value then the value is printed in
> ASCII. Please help me to print the value in actual string. The sample
> code is :
>
> package lib is
> type T_Int is range -2**31 .. 2**31-1;
> for T_Int'Size use 4 * 8;
> type T_Char is new Character;
> for T_Char'Size use 1 * 8;
> subtype T_Pos is T_Int range 1 .. T_Int'Last;
> type T_string is array (T_Pos range <>) of T_Char;
> function Get_Val(Status : in boolean) return t_string;
> end lib;
>
> with ada.text_io;
> with ada.integer_text_io;
> with lib;
> use lib;
> use ada.text_io;
> use ada.integer_text_io;
>
> procedure A is
>
> type T_str (Size : T_Pos) is
> record
> tab : T_string(1..Size);
> T_Nab : integer:=0;
> end record;
> type t_str_access is access all t_str;
> A: T_string(1..10):= (' ',' ',' ',' ',' ',' ',' ',' ',' ',' ');
> B:T_str(3);
> c : integer;
> status : boolean;
> begin
> B.tab := "Var";
> get(c);
> if c = 1 then
> status := false;
> elsif c =2 then
> status := true;
> else
> null;
> end if;
>
> c:= c+1;
> put(c-1);
> A := Get_Val(status);
> -- put(standard.string(A));
>
> end A ;
>
> With the above code try to print variable 'B.tab' this prints in
> ASCII. Please suggest some solution.
>
> Thanks in advance.
>
> Regards,
> Sathish V- Hide quoted text -
>
> - Show quoted text -
Along with the above I face one more problem. That is I get the below
error:
gdb-internal-error: virtual memory exhausted: can't allocate 4072
bytes.
1 [sig] gdb 15804 open_stackdumpfile: Dumping stack trace to
gdb.exe.stackdump
How to solve this problem? Please help me for this problem.
Thanks in advance.
prev parent reply other threads:[~2009-02-20 13:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-19 11:56 How to print string, record variable while debugging with GDB using GPS Paruthi
2009-02-19 14:30 ` Georg Bauhaus
2009-02-20 10:43 ` Paruthi
2009-02-20 13:21 ` Paruthi [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox