From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22556 invoked by alias); 18 Feb 2013 11:45:23 -0000 Received: (qmail 22530 invoked by uid 22791); 18 Feb 2013 11:45:21 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,MIME_QP_LONG_LINE,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; Mon, 18 Feb 2013 11:45:07 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1U7P9e-0003El-Gn from Hafiz_Abid@mentor.com ; Mon, 18 Feb 2013 03:45:06 -0800 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 18 Feb 2013 03:45:05 -0800 Received: from abidh-ubunto1104 (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.1.289.1; Mon, 18 Feb 2013 11:45:03 +0000 Date: Mon, 18 Feb 2013 11:45:00 -0000 From: "Abid, Hafiz" Subject: Re: [PATCH] target attributes [1/5] core and load from target function To: Hui Zhu CC: "Abid, Hafiz" , "Qi, Yao" , "Zhu, Hui" , gdb-patches ml In-Reply-To: (from teawater@gmail.com on Mon Feb 18 10:01:10 2013) Message-ID: <1361187903.2217.1@abidh-ubunto1104> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; delsp=Yes; format=Flowed Content-Disposition: inline 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: 2013-02/txt/msg00449.txt.bz2 On 18/02/13 10:01:10, Hui Zhu wrote: > On Fri, Nov 30, 2012 at 2:03 PM, Abid, Hafiz =20=20 > wrote: > > Hi, > > > >>+ ta =3D xzalloc (sizeof (struct target_attribute)); > >>+ ta->name =3D xstrdup (name); > > This name is not freed and will leak. >=20 > Added xfree in clear_target_attributes. >=20 > > > >>+ 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=20=20 > is also being assigned. It did not look right to me. I wanted to=20=20 > bring it in your attention in case it is a typo. >=20 > user_data will always point to the last one of target_attributes_list. > Could you tell me which part is wrong? This code may be right. It just looked a bit confusing. Also tap and=20=20 user_data point to samething. One of the following 2 assignment seems=20=20 redundant. *tap =3D ta; user_data =3D &ta; >=20 > > > >>+ unsigned int agent_access; > >>+ unsigned int gdb_access; > > I can understand the access mode for GDB. But what agent_access=20=20 > means and how it will effect a user? >=20 > There is the introduce of agent > http://sourceware.org/gdb/current/onlinedocs/gdb/Agent-Expressions.html >=20 > Post a new version according to your review. >=20 > Thanks, > Hui >=20 > 2013-02-18 Hui Zhu >=20 > * Makefile.in (SFILES): Add target-attributes.c. > (HFILES_NO_SRCDIR): Add target-attributes.h. > (COMMON_OBS): Add target-attributes.o. > * breakpoint.h (breakpoint): Add target_only_cond_check. > * remote.c (target-attributes.h): New include. > (PACKET_qXfer_target_attributes_read): New enum. > (remote_start_remote): Add handler for target attributes. > (remote_protocol_features): Add "qXfer:target-attributes:read". > (remote_xfer_partial): Add handler for TARGET_OBJECT_ATTRIBUTES. > (_initialize_remote): Add command > "set remote target-attributes-packet". > (target-attributes.c, target-attributes.h): New files. > * tracepoint.c (target-attributes.h): New include. > (find_trace_state_variable_number, > trace_variable_number_check_1, > trace_variable_number_check): New functions. > (trace_variable_command): Call trace_variable_number_check_1. > (merge_uploaded_trace_state_variables): Call > trace_variable_number_check. > tracepoint.h (trace_variable_number_check): New extern. >=20 > > > >> -----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=20=20 > target > >> function > >> > >> 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=20=20 > *parser, > >> >>> + const struct gdb_xml_element > >> *element, > >> >>> + void *user_data, > >> >>> + VEC(gdb_xml_value_s)=20=20 > *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=20=20 > box, > >> >> while these warnings don't appear on my Ubuntu box. > >> >> > >> >> ... -Werror -c -o target-memory.o -MT target-memory.o -MMD -MP=20=20 > -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=20= =20 > 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=20=20 > 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=20= =20 > 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= =20=20 > 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=20=20 > '%s'."), > >> >>> + attrs[i].name); > >> >>> + } > >> >>> + > >> >>> + ta_addr =3D xmalloc (sizeof (struct=20=20 > 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 > >> > >> Got some error when built with trunk. Post a new version for this > >> error. > >> > >> Thanks, > >> Hui >=20