From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26419 invoked by alias); 30 Nov 2012 06:03:59 -0000 Received: (qmail 26404 invoked by uid 22791); 30 Nov 2012 06:03:57 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_XZ X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Nov 2012 06:03:51 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TeJhV-00008l-U9 from Hafiz_Abid@mentor.com ; Thu, 29 Nov 2012 22:03:49 -0800 Received: from SVR-IES-FEM-05.mgc.mentorg.com ([137.202.0.112]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 29 Nov 2012 22:03:49 -0800 Received: from EU-MBX-03.mgc.mentorg.com ([169.254.2.46]) by SVR-IES-FEM-05.mgc.mentorg.com ([137.202.0.112]) with mapi id 14.01.0289.001; Fri, 30 Nov 2012 06:03:48 +0000 From: "Abid, Hafiz" To: Hui Zhu , "Qi, Yao" CC: "Zhu, Hui" , gdb-patches ml Subject: RE: [PATCH] target attributes [1/5] core and load from target function Date: Fri, 30 Nov 2012 06:03:00 -0000 Message-ID: References: <503DCEC5.2010308@mentor.com> <503E2A7A.2030709@codesourcery.com> In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2012-11/txt/msg00907.txt.bz2 Hi, >+ ta =3D xzalloc (sizeof (struct target_attribute)); >+ ta->name =3D xstrdup (name); This name is not freed and will leak. >+ if (*tap) >+ (*tap)->next =3D ta; >+ else >+ target_attributes_list =3D ta; >+ *tap =3D ta; >+ >+ user_data =3D &ta; So you are assigning ta to (*tap) and (*tap)->next. Then user_data is also = being assigned. It did not look right to me. I wanted to bring it in your a= ttention in case it is a typo. >+ unsigned int agent_access; >+ unsigned int gdb_access; I can understand the access mode for GDB. But what agent_access means and h= ow it will effect a user? > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Hui Zhu > Sent: Wednesday, November 21, 2012 8:55 AM > To: Qi, Yao > Cc: Zhu, Hui; gdb-patches ml > Subject: Re: [PATCH] target attributes [1/5] core and load from target > function >=20 > On Sun, Sep 2, 2012 at 6:37 PM, Hui Zhu wrote: > > On Wed, Aug 29, 2012 at 10:43 PM, Yao Qi > wrote: > >> On 08/29/2012 04:11 PM, Hui Zhu wrote: > >>> +static void > >>> +target_attribute_address_handler (struct gdb_xml_parser *parser, > >>> + const struct gdb_xml_element > *element, > >>> + void *user_data, > >>> + VEC(gdb_xml_value_s) *attributes) { > >>> + int i, len; > >>> + struct gdb_xml_value *attrs =3D VEC_address (gdb_xml_value_s, > >>> +attributes); > >>> + struct target_attribute *ta =3D *(struct target_attribute > >>> +**)user_data; > >>> + CORE_ADDR start, end; > >>> + struct target_attribute_address *ta_addr; > >> > >> I happen to see some compilation warnings on my new Fedora 16 box, > >> while these warnings don't appear on my Ubuntu box. > >> > >> ... -Werror -c -o target-memory.o -MT target-memory.o -MMD -MP -MF > >> .deps/target-memory.Tpo ../../../git/gdb/target-memory.c > >> ../../../git/gdb/target-attributes.c: In function > 'target_attribute_address_handler': > >> ../../../git/gdb/target-attributes.c:487:16: error: 'end' may be > used > >> uninitialized in this function [-Werror=3Duninitialized] > >> ../../../git/gdb/target-attributes.c:486:18: error: 'start' may be > >> used uninitialized in this function [-Werror=3Duninitialized] > >> ../../../git/gdb/target-attributes.c: In function > 'target_attribute_attr_handler': > >> ../../../git/gdb/target-attributes.c:376:12: error: 'type' may be > >> used uninitialized in this function [-Werror=3Duninitialized] > >> ../../../git/gdb/target-attributes.c: In function > 'target_attribute_type': > >> ../../../git/gdb/target-attributes.c:632:3: error: 'ret' may be used > >> uninitialized in this function [-Werror=3Duninitialized] > >> cc1: all warnings being treated as errors > >> make: *** [target-attributes.o] Error 1 > >> > >> The gcc I am using is 4.6.3 > >> $ gcc --version > >> gcc (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2) > >> > >> We have to get these warnings fixed. > >> > >>> + > >>> + len =3D VEC_length (gdb_xml_value_s, attributes); for (i =3D 0; i= < > >>> + len; i++) > >>> + { > >>> + if (strcmp (attrs[i].name, "start") =3D=3D 0) > >>> + start =3D * (ULONGEST *) attrs[i].value; > >>> + else if (strcmp (attrs[i].name, "end") =3D=3D 0) > >>> + end =3D * (ULONGEST *) attrs[i].value; > >>> + else > >>> + gdb_xml_error (parser, _("Unknown attribute name '%s'."), > >>> + attrs[i].name); > >>> + } > >>> + > >>> + ta_addr =3D xmalloc (sizeof (struct target_attribute_address)); > >>> + ta_addr->start =3D start; ta_addr->end =3D end; > >>> + > >>> + ta_addr->prev =3D ta->addresses; > >>> + ta->addresses =3D ta_addr; > >>> +} > >> > >> -- > >> Yao > > > > Thanks. I post a new version. > > > > Best, > > Hui >=20 > Got some error when built with trunk. Post a new version for this > error. >=20 > Thanks, > Hui