From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29746 invoked by alias); 22 Mar 2010 21:56:27 -0000 Received: (qmail 29734 invoked by uid 22791); 22 Mar 2010 21:56:24 -0000 X-SWARE-Spam-Status: No, hits=2.1 required=5.0 tests=AWL,BAYES_00,KAM_STOCKTIP,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.156) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Mar 2010 21:56:19 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.2/jtpda-5.5pre1) with ESMTP id o2MLuFM5091425 for ; Mon, 22 Mar 2010 22:56:15 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms3.u-strasbg.fr [IPv6:2001:660:2402:d::12]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o2MLuFTk055699 for ; Mon, 22 Mar 2010 22:56:15 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o2MLuEdU076956 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 22 Mar 2010 22:56:14 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: References: <000201cac54d$246dcdd0$6d496970$@muller@ics-cnrs.unistra.fr> In-Reply-To: <000201cac54d$246dcdd0$6d496970$@muller@ics-cnrs.unistra.fr> Subject: PING [RFC] Support for const char and strings in stabs reader Date: Mon, 22 Mar 2010 21:56:00 -0000 Message-ID: <000c01caca0a$865b3b10$9311b130$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00780.txt.bz2 The official stabs reader maintainer is Elena Zannoni, but I could find any recent=20 email from her on this or on gdb list. I wonder if se is still reading this list. Is there someone else able to review this patch or should I try to contact Elena directly? Pierre Muller > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pierre Muller > Envoy=E9=A0: Tuesday, March 16, 2010 10:11 PM > =C0=A0: gdb-patches@sourceware.org > Objet=A0: [RFC] Support for const char and strings in stabs reader >=20 > Stabs reader currently only supports constants > of integer, real or enum types. >=20 > This patch adds support for char and string types, as described in > http://sourceware.org/gdb/current/onlinedocs/stabs/Constants.html#Const > ants >=20 > I tried to implement support for both single and double > quote in the code. > The string type is currently used for > Free Pascal compiler, so I could directly test it. >=20 > I also tried to add some check to gdb.stabs testsuite, > but I got caught by some typical tcl expansion > problems while trying to test the second form > using double quotes... >=20 >=20 > The original lines in gdb.stabs/weird.def > # Test string constant > .stabs "constString1:c=3Ds'String1'", N_LSYM,0,0, 0 > .stabs "constString2:c=3Ds\"String2\"", N_LSYM,0,0, 0 > .stabs "constString3:c=3Ds'String3 with embedded quote \' in the > middle'", > N_LSYM,0,0, 0 >=20 > become >=20 > .stabs "constString1:c=3Ds'String1'", 0x80,0,0, 0 > .stabs "constString2:c=3Ds\\"String2\"", 0x80,0,0, 0 > .stabs "constString3:c=3Ds'String3 with embedded quote \\' in the > middle'", > 0x80,0,0, 0 >=20 > Note the fact that only one of the two escaped double quote > is transformed into \\".. > I tried all combination, and nothing seemed to work... >=20 >=20 > Comments welcome, >=20 >=20 > Pierre Muller > Pascal language support maintainer for GDB >=20 > PS: I left the boolean support out > because currently objfile builtin_types > do not have a builtin_bool, which would be required > here. >=20 >=20 > 2010-03-16 Pierre Muller >=20 > * stabsread.c (define_symbol): Add support for char > and string constants. >=20 > Index: stabsread.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/stabsread.c,v > retrieving revision 1.123 > diff -u -p -r1.123 stabsread.c > --- stabsread.c 8 Jan 2010 08:55:16 -0000 1.123 > +++ stabsread.c 16 Mar 2010 21:07:48 -0000 > @@ -793,6 +793,56 @@ define_symbol (CORE_ADDR valu, char *str > SYMBOL_CLASS (sym) =3D LOC_CONST; > } > break; > + > + case 'c': > + { > + SYMBOL_TYPE (sym) =3D objfile_type (objfile)->builtin_char; > + SYMBOL_VALUE (sym) =3D atoi (p); > + SYMBOL_CLASS (sym) =3D LOC_CONST; > + } > + break; > + > + case 's': > + { > + struct type *range_type; > + char quote =3D *p++; > + char *startp =3D p; > + gdb_byte *string_value; > + if (quote !=3D '\'' && quote !=3D '"') > + { > + SYMBOL_CLASS (sym) =3D LOC_CONST; > + SYMBOL_TYPE (sym) =3D error_type (&p, objfile); > + SYMBOL_DOMAIN (sym) =3D VAR_DOMAIN; > + add_symbol_to_list (sym, &file_symbols); > + return sym; > + } > + /* Find matching quote, rejecting escaped quotes. */ > + while (*p && *p !=3D quote) > + { > + if (*p =3D=3D '\\') > + p++; > + if (*p) > + p++; > + } > + *p =3D '\0'; > + range_type =3D create_range_type (NULL, > + objfile_type (objfile)->builtin_int, > + 0, strlen(startp)); > + SYMBOL_TYPE (sym) =3D create_array_type (NULL, > + objfile_type (objfile)->builtin_char, > + range_type); > + string_value =3D > + obstack_alloc (&objfile->objfile_obstack, > + strlen (startp) + 1); > + strcpy ((char *)string_value, startp); > + *p =3D quote; > + p++; > + > + SYMBOL_VALUE_BYTES (sym) =3D string_value; > + SYMBOL_CLASS (sym) =3D LOC_CONST_BYTES; > + } > + break; > + > case 'e': > /* SYMBOL:c=3DeTYPE,INTVALUE for a constant symbol whose value > can be represented as integral. > Index: testsuite/gdb.stabs/weird.def > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/testsuite/gdb.stabs/weird.def,v > retrieving revision 1.3 > diff -u -p -r1.3 weird.def > --- testsuite/gdb.stabs/weird.def 8 Jan 2010 08:55:16 -0000 1.3 > +++ testsuite/gdb.stabs/weird.def 16 Mar 2010 21:07:49 -0000 > @@ -286,6 +286,15 @@ attr69: > # Test constant with the type embedded. > .stabs "const70:c=3De190=3Dbs2;0;16;,70", N_LSYM,0,0, 0 >=20 > +# Test char constant > +.stabs "constchar:c=3D70", N_LSYM,0,0, 0 > + > +# Test string constant > +.stabs "constString1:c=3Ds'String1'", N_LSYM,0,0, 0 > +.stabs "constString2:c=3Ds\"String2\"", N_LSYM,0,0, 0 > +.stabs "constString3:c=3Ds'String3 with embedded quote \' in the > middle'", > N_LSYM,0,0, 0 > + > + > .stabs "attr38:G338=3D@& > !#$%&'()*+,- > ./0123456789:<=3D>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmno > pqrstuvwxyz{|}~;1",N_GSYM,0,0, 0 >=20 > # Unrecognized negative type number. > Index: testsuite/gdb.stabs/weird.exp > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/testsuite/gdb.stabs/weird.exp,v > retrieving revision 1.18 > diff -u -p -r1.18 weird.exp > --- testsuite/gdb.stabs/weird.exp 1 Jan 2010 07:32:06 -0000 1.18 > +++ testsuite/gdb.stabs/weird.exp 16 Mar 2010 21:07:49 -0000 > @@ -164,6 +164,11 @@ proc do_tests {} { >=20 > gdb_test "p sizeof (const70)" " =3D 2" "'e' constant with embedded > type" >=20 > + gdb_test "p /x constchar" " =3D 0x46" "char constant" > + gdb_test "p constString1" " =3D \"String1\"" "String constant 1" > + gdb_test "p constString2" " =3D \"String2\"" "String constant 2" > + gdb_test "p constString3" " =3D \"String3 with embedded quote ' > in > the middle\"" "String constant 3" > + > gdb_test "p bad_neg0" " =3D \{field0 =3D 42, field2 =3D.*field3 =3D 45\= }" > "p > bad_neg0" >=20 > gdb_test "ptype inttype" "type =3D (unsigned int|inttype)" "ptype > on > inttype"