From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (lndn.lancelotsix.com [51.195.220.111]) by sourceware.org (Postfix) with ESMTPS id 49F6F385828D; Mon, 16 Oct 2023 09:31:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 49F6F385828D Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 49F6F385828D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=51.195.220.111 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697448720; cv=none; b=TwDytRhIU164QfkZT0a0WY4jL+L8anQci1Liw/UbY5RvZZTZAg5qBtirm4roJotX4sY2qkoRmcppgdohgn7ameIohlc/SSqy4YuZm6mt9M1wLVto4lZPWu94YkVXaACXDlgNOJToWyNdpqqhfb3k8k/BkRbev7lpkPLtHrobf9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697448720; c=relaxed/simple; bh=+1o+We9RD8VAbPTg471eA5nzx+sSSK8GiwDJQf1Vq6I=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=uhYNBX/5ZN5sZFEhWIAJsARMN5ekh+b8iJxu+iNL671MBLSrO8WeH4+jnXY+zZFM5ztX73Cj1NcRy4duBmzEG7/odXsb+H67cv0sgWi8/m/9ebo09YrWYZlVp6Nx2/DNGqUpLHdeeTL68Pmilzgrmf4wVmznHvQuvsp/7imWji8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from octopus (cust120-dsl54.idnet.net [212.69.54.120]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 3A97884CB8; Mon, 16 Oct 2023 09:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lancelotsix.com; s=2021; t=1697448717; bh=+1o+We9RD8VAbPTg471eA5nzx+sSSK8GiwDJQf1Vq6I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=s1tGLZVuRdua7sANWe9/Rse95zlUIwvK7MLU3NfmtbZOVeTjtQ6bubAtcPc2mmCwf jHSbfW76k6XCO7wHM3LK90GYivo6y3hyNyc6UvaJHLXRu+O4AALe82spVNF7kH6sS/ jv8R5A8ScA6St3YtpCEiJ0aJV1NmwLwh7tJ8bEjwmnEWloVPG6Zv1CUm1hpIHPZflM Eyejjc+PaZ01ISbwPkCMBsyI/3DvpXQ/sjmxMUsuz+6Ds5mslFjDEogsxaFYnzl3oN ShZ40ZLopXFss2JEKXO5LbZCm4V+Ot74oVqI135De6hawrP3Jq2pWBkv5x7wrKvCHv E1CicoNi8JsLg== Date: Mon, 16 Oct 2023 10:31:52 +0100 From: Lancelot SIX To: John Baldwin Cc: gdb-patches@sourceware.org, Willgerodt@sourceware.org, Felix , George@sourceware.org, Jini Susan , Simon Marchi Subject: Re: [RFC 10/13] {amd64, i386}-fbsd-tdep: Include NT_X86_CPUID notes in core dumps from gcore Message-ID: <20231016093152.pu5xmxf32gc4ptjg@octopus> References: <20231009183617.24862-1-jhb@FreeBSD.org> <20231009183617.24862-11-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009183617.24862-11-jhb@FreeBSD.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (lndn.lancelotsix.com [0.0.0.0]); Mon, 16 Oct 2023 09:31:57 +0000 (UTC) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, Just a forating nit below (again, feel free to discard as this is a RFC series) On Mon, Oct 09, 2023 at 11:36:12AM -0700, John Baldwin wrote: > Override the gdbarch make_corefile_notes method for the FreeBSD x86 > arches with a new function that calls fbsd_make_corefile_notes and > x86_elf_make_cpuid_note to generate the core dump notes. > --- > gdb/amd64-fbsd-tdep.c | 1 + > gdb/i386-fbsd-tdep.c | 15 +++++++++++++++ > gdb/i386-fbsd-tdep.h | 7 +++++++ > 3 files changed, 23 insertions(+) > > diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c > index 1789f3921fd..810ecc90df1 100644 > --- a/gdb/i386-fbsd-tdep.c > +++ b/gdb/i386-fbsd-tdep.c > @@ -26,6 +26,7 @@ > #include "tramp-frame.h" > #include "i386-fbsd-tdep.h" > > +#include "x86-tdep.h" > #include "i386-tdep.h" > #include "i387-tdep.h" > #include "fbsd-tdep.h" > @@ -370,6 +371,19 @@ i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, > return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset); > } > > +/* See i386-fbsd-tdep.h. */ > + > +gdb::unique_xmalloc_ptr > +i386_fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, > + int *note_size) > +{ > + gdb::unique_xmalloc_ptr note_data = > + fbsd_make_corefile_notes (gdbarch, obfd, note_size); In GDB's coding style, the linebreak should be before the "=". Best, Lancelot. > + > + x86_elf_make_cpuid_note (obfd, ¬e_data, note_size); > + return note_data; > +} > + > static void > i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > { > @@ -403,6 +417,7 @@ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > > set_gdbarch_core_read_description (gdbarch, > i386fbsd_core_read_description); > + set_gdbarch_make_corefile_notes (gdbarch, i386_fbsd_make_corefile_notes); > > /* FreeBSD uses SVR4-style shared libraries. */ > set_solib_svr4_fetch_link_map_offsets > diff --git a/gdb/i386-fbsd-tdep.h b/gdb/i386-fbsd-tdep.h > index c49cb1eba68..fc7bb1c521d 100644 > --- a/gdb/i386-fbsd-tdep.h > +++ b/gdb/i386-fbsd-tdep.h > @@ -40,6 +40,13 @@ bool i386_fbsd_core_read_x86_xsave_layout (struct gdbarch *gdbarch, > matches the layout on Linux. */ > #define I386_FBSD_XSAVE_XCR0_OFFSET 464 > > +/* Create appropriate note sections for a corefile, returning them in > + allocated memory. Extends fbsd_make_corefile_notes to add a > + NT_X86_CPUID note. */ > + > +gdb::unique_xmalloc_ptr i386_fbsd_make_corefile_notes > +(struct gdbarch *gdbarch, bfd *obfd, int *note_size); > + > extern const struct regset i386_fbsd_gregset; > > #endif /* i386-fbsd-tdep.h */ > -- > 2.41.0 >