* How to print string, record variable while debugging with GDB using GPS
@ 2009-02-19 11:56 Paruthi
2009-02-19 14:30 ` Georg Bauhaus
0 siblings, 1 reply; 4+ messages in thread
From: Paruthi @ 2009-02-19 11:56 UTC (permalink / raw)
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.
Thanks,
Sathish V
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to print string, record variable while debugging with GDB using GPS
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
0 siblings, 1 reply; 4+ messages in thread
From: Georg Bauhaus @ 2009-02-19 14:30 UTC (permalink / raw)
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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to print string, record variable while debugging with GDB using GPS
2009-02-19 14:30 ` Georg Bauhaus
@ 2009-02-20 10:43 ` Paruthi
2009-02-20 13:21 ` Paruthi
0 siblings, 1 reply; 4+ messages in thread
From: Paruthi @ 2009-02-20 10:43 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: How to print string, record variable while debugging with GDB using GPS
2009-02-20 10:43 ` Paruthi
@ 2009-02-20 13:21 ` Paruthi
0 siblings, 0 replies; 4+ messages in thread
From: Paruthi @ 2009-02-20 13:21 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-20 13:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox