From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5885 invoked by alias); 13 Dec 2012 15:08:57 -0000 Received: (qmail 5854 invoked by uid 22791); 13 Dec 2012 15:08:55 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,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; Thu, 13 Dec 2012 15:08:46 +0000 Received: from md13.u-strasbg.fr (md13.u-strasbg.fr [130.79.200.248]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id qBDF8ZPD091426 ; Thu, 13 Dec 2012 16:08:36 +0100 (CET) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms11.u-strasbg.fr [130.79.204.111]) by md13.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id qBDF8YlA024504 ; Thu, 13 Dec 2012 16:08:35 +0100 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id qBDF8Y6h005249 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Thu, 13 Dec 2012 16:08:34 +0100 (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'Pedro Alves'" , "'GDB Patches'" References: <20121024194517.GK3555@adacore.com> <011901cdb2ab$48076b90$d81642b0$@muller@ics-cnrs.unistra.fr> <20121105171121.GA2972@adacore.com> <50991f5f.8382440a.1100.ffff82abSMTPIN_ADDED@mx.google.com> <509ABA17.30507@redhat.com> <000301cdbd96$f5cd9f10$e168dd30$@muller@ics-cnrs.unistra.fr> <20121122173019.GF9964@adacore.com> <15690.5992342674$1353883881@news.gmane.org> <87624si9ur.fsf@fleche.redhat.com> <001501cdccaf$ad85e9b0$0891bd10$@muller@ics-cnrs.unistra.fr> <20121207071035.GG31477@adacore.com> <50C20A66.70002@gmail.com> <29545.4593528577$1354894901@news.gmane.org> <50C21696.7040006@gmail.com> <50c21914.a750420a.2ec3.ffffe4ffSMTPIN_ADDED_BROKEN@mx.google.com> <50C222D5.4000802@redhat.com> <50C22C20.8090906@redhat.com> <008101cdd920$907e7580$b17b6080$@muller@ics-cnrs.unistra.fr> <50C9B6E0.1050709@redhat.com> <00a201cdd931$b0ee13f0$12ca3bd0$@muller@ics-cnrs.unistra.fr> <50C9E742.1030207@redhat.com> <001201cdd941$f9d83450$ed889cf0$@muller@ics-cnrs.unistra.fr> In-Reply-To: <001201cdd941$f9d83450$ed889cf0$@muller@ics-cnrs.unistra.fr> Subject: RE: [RFC-v5] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior) Date: Thu, 13 Dec 2012 15:08:00 -0000 Message-ID: <001b01cdd943$b9cc42a0$2d64c7e0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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: 2012-12/txt/msg00449.txt.bz2 > -----Message d'origine----- > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pierre Muller > Envoy=C3=A9 : jeudi 13 d=C3=A9cembre 2012 15:56 > =C3=80 : 'Pedro Alves'; 'GDB Patches' > Objet : RE: [RFC-v5] Fix .text section offset for windows DLL (was Calling > __stdcall functions in the inferior) >=20 >=20 >=20 > > -----Message d'origine----- > > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches- > > owner@sourceware.org] De la part de Pedro Alves > > Envoy=C3=A9 : jeudi 13 d=C3=A9cembre 2012 15:34 > > =C3=80 : Pierre Muller; GDB Patches > > Objet : Re: [RFC-v5] Fix .text section offset for windows DLL (was Call= ing > > __stdcall functions in the inferior) > > > > On 12/13/2012 12:59 PM, Pierre Muller wrote: > > >> > There was also the point that section names in PE headers are stor= ed > in > > 8 > > >> > character arrays, and are not necessarily zero-terminated -- > > >> > get_pe_section_index > > >> > does strcmp without accounting for this (grep for SCNNMLEN in bfd). > > > the section_name are copied using xstrdup from sec_name > > > char array of length 9, (indexes 0 to 8) > > > which is reset using memset for each section. > > > only the indexes 0to 7 are possibly modified by the bfd_bread call, > > > so that sec_name[8] always should remain a valid termination of the > > string, no? > > > > I see now, thanks. I think this would make the code a tiny bit clearer. > > WDYT? >=20 > Yes, you are right... >=20 > Maybe removing the memset before and replacing it by a > sec_name[SCNNMLEN] =3D '\0'; > after the call to bfd_bread > would make it even more clear that you > always get a nicely zero terminated string... I tried it out, compliation fails because the macro is not set. You would still need to set that macro, which is defined in ../include/coff/internal.h or include that header at start of coff-pe-read.c...=20 Pierre=20