From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17165 invoked by alias); 7 Feb 2010 21:25:30 -0000 Received: (qmail 17119 invoked by uid 22791); 7 Feb 2010 21:25:30 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f223.google.com (HELO mail-ew0-f223.google.com) (209.85.219.223) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 07 Feb 2010 21:25:26 +0000 Received: by ewy23 with SMTP id 23so213890ewy.4 for ; Sun, 07 Feb 2010 13:25:23 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.85.5 with SMTP id t5mr68945wee.176.1265577923641; Sun, 07 Feb 2010 13:25:23 -0800 (PST) In-Reply-To: <201002072115.o17LFFnT030072@glazunov.sibelius.xs4all.nl> References: <20100207174213.GA10424@lucon.org> <201002072115.o17LFFnT030072@glazunov.sibelius.xs4all.nl> Date: Sun, 07 Feb 2010 21:25:00 -0000 Message-ID: <6dc9ffc81002071325g55c34753je8089b31cc9229e8@mail.gmail.com> Subject: Re: PATCH: Check section size for valid core sections From: "H.J. Lu" To: Mark Kettenis Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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-02/txt/msg00183.txt.bz2 On Sun, Feb 7, 2010 at 1:15 PM, Mark Kettenis wro= te: >> Date: Sun, 7 Feb 2010 09:42:13 -0800 >> From: "H.J. Lu" >> >> I added a new core section, .reg-xstate, to support x86 XSAVE extended >> state. =A0We can read it on any machine. But we can only write it on >> machines with x86 XSAVE extended state. I have >> >> /* Supported register note sections. =A0*/ >> static struct core_regset_section amd64_linux_regset_sections[] =3D >> { >> =A0 { ".reg", 144, "general-purpose" }, >> =A0 { ".reg2", 512, "floating-point" }, >> =A0 { ".reg-xstate", 0, "XSAVE extended state" }, >> =A0 { NULL, 0 } >> }; >> >> I update its size with >> >> =A0/* Update the XSAVE extended state size on Linux/x86 host. =A0Need it >> =A0 =A0 for "gcore". =A0*/ >> =A0 i386_xstate_init (); >> =A0 amd64_linux_regset_sections[2].size =3D i386_xstate.size; >> >> If the machine suppors XSAVE, size will be non-zero. We can still >> read the core section since size is only used for gcore. OK to install? > > Sorry, but this makes no sense to me. Which part doesn't it make sense to you? Thanks. H.J. ---- >> 2010-02-07 =A0H.J. Lu =A0 >> >> =A0 =A0 =A0 * linux-nat.c (linux_nat_do_thread_registers): Check section >> =A0 =A0 =A0 size instead of section name for valid core sections. >> >> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c >> index 7fc9584..44a3288 100644 >> --- a/gdb/linux-nat.c >> +++ b/gdb/linux-nat.c >> @@ -4112,9 +4112,12 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t = ptid, >> =A0 =A0/* The loop below uses the new struct core_regset_section, which = stores >> =A0 =A0 =A0 the supported section names and sizes for the core file. =A0= Note that >> =A0 =A0 =A0 note PRSTATUS needs to be treated specially. =A0But the othe= r notes are >> - =A0 =A0 structurally the same, so they can benefit from the new struct= . =A0*/ >> + =A0 =A0 structurally the same, so they can benefit from the new struct= . =A0We >> + =A0 =A0 check section size instead of section name for valid core sect= ions >> + =A0 =A0 since we can read x86 XSAVE extended state core section, but w= e can >> + =A0 =A0 write it only if x86 XSAVE extended state is available nativel= y. =A0*/ >> =A0 =A0if (core_regset_p && sect_list !=3D NULL) >> - =A0 =A0while (sect_list->sect_name !=3D NULL) >> + =A0 =A0while (sect_list->size !=3D 0) >> =A0 =A0 =A0 =A0{ >> =A0 =A0 =A0 /* .reg was already handled above. =A0*/ >> =A0 =A0 =A0 if (strcmp (sect_list->sect_name, ".reg") =3D=3D 0) >> > --=20 H.J.