From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3cbef66f8e2b7fa3 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!i18g2000prf.googlegroups.com!not-for-mail From: Paruthi Newsgroups: comp.lang.ada Subject: Re: How to print string, record variable while debugging with GDB using GPS Date: Fri, 20 Feb 2009 05:21:40 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <1b69a7f1-49f4-4bae-9c9c-94286309b13d@b8g2000pre.googlegroups.com> <499d6d02$0$31879$9b4e6d93@newsspool3.arcor-online.net> <04feea45-5bf3-475d-a37d-b4e8c7db4c66@r10g2000prf.googlegroups.com> NNTP-Posting-Host: 125.17.18.162 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1235136100 13929 127.0.0.1 (20 Feb 2009 13:21:40 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 20 Feb 2009 13:21:40 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i18g2000prf.googlegroups.com; posting-host=125.17.18.162; posting-account=wBFvTwoAAADicInq0DvvS5VTnb_5upmw User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:4687 Date: 2009-02-20T05:21:40-08:00 List-Id: On Feb 20, 3:43=A0pm, Paruthi wrote: > On Feb 19, 7:30=A0pm, Georg Bauhaus > 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 o= f > > > ASCII value. > > > Did you use the GDB provided with your Ada environement? > > > (gdb) list > > 1 =A0 =A0 =A0 procedure test is > > 2 =A0 =A0 =A0 =A0 =A0 =A0 =A0 x: string(1..10); > > 3 =A0 =A0 =A0 begin > > 4 =A0 =A0 =A0 =A0 =A0 =A0 =A0 x :=3D "ABCDEFGHIJ"; > > 5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 x(1) :=3D x(2); > > 6 =A0 =A0 =A0 end; > > (gdb) display x > > 4: x =3D "["00"]["00"]["00"]["00"]["00"]["00"]["00"]["00"]&["1d"]" > > (gdb) n > > 5 =A0 =A0 =A0 =A0 =A0 =A0 =A0 x(1) :=3D x(2); > > 4: x =3D "ABCDEFGHIJ" > > (gdb) n > > 6 =A0 =A0 =A0 end; > > 4: x =3D "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 > =A0 type T_Int is range -2**31 .. 2**31-1; > =A0 for T_Int'Size use 4 * 8; > =A0 type T_Char is new Character; > =A0 for T_Char'Size use 1 * 8; > =A0 subtype T_Pos is =A0T_Int range 1 .. T_Int'Last; > =A0 type T_string is array (T_Pos range <>) of T_Char; > =A0 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 > > =A0 type T_str (Size : T_Pos) is > =A0 =A0 =A0record > =A0 =A0 =A0 =A0 tab : T_string(1..Size); > =A0 =A0 =A0 =A0 T_Nab : integer:=3D0; > =A0 =A0 =A0end record; > =A0 type t_str_access is access all t_str; > =A0 A: T_string(1..10):=3D (' ',' ',' ',' ',' ',' ',' ',' ',' ',' '); > =A0 B:T_str(3); > =A0 c : integer; > =A0 status : boolean; > begin > =A0 B.tab :=3D "Var"; > =A0 get(c); > =A0 if c =3D 1 then > =A0 =A0 =A0status :=3D false; > =A0 elsif c =3D2 then > =A0 =A0 =A0status :=3D true; > =A0 else > =A0 =A0 =A0null; > =A0 end if; > > =A0 c:=3D c+1; > =A0 put(c-1); > =A0 A :=3D Get_Val(status); > -- =A0 =A0 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.