From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58558 invoked by alias); 23 Aug 2018 16:16:11 -0000 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 Received: (qmail 24450 invoked by uid 89); 23 Aug 2018 16:15:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.2 required=5.0 tests=BAYES_00,GIT_PATCH_2,SPF_HELO_PASS,SPF_SOFTFAIL,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=HTo:U*contact X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Aug 2018 16:15:25 +0000 Received: from dhcp-10-248-98-203.eduroam.wireless.private.cam.ac.uk (global-5-141.nat-2.net.cam.ac.uk [131.111.5.141]) by mail.baldwin.cx (Postfix) with ESMTPSA id 18E2010B45E; Thu, 23 Aug 2018 12:15:21 -0400 (EDT) Subject: Re: [PATCH v4] Generate NT_PROCSTAT_{AUXV,VMMAP,PS_STRINGS} in FreeBSD coredumps To: Simon Ser , gdb-patches@sourceware.org References: <_LRTDYZchE3m5uYvETytJBLgsrWRhqIDAXHnzDsU6kJBhItMetbpfxGe8OJD9a4K4b9brDxF9YvXWOzdDfTRBRfrZI-4XLl8mWwlrEpqmm0=@emersion.fr> From: John Baldwin Message-ID: <2cdbddb0-7f21-77e0-adae-c88ced81fd76@FreeBSD.org> Date: Thu, 23 Aug 2018 16:16:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00568.txt.bz2 On 8/23/18 3:02 PM, Simon Ser wrote: > gcore generates NT_AUXV and NT_FILE notes for Linux targets. On > FreeBSD auxv is stored in a NT_PROCSTAT_AUXV section, file mappings > are stored in a NT_PROCSTAT_VMMAP and both are prefixed with the > struct size. > > 2018-08-23 Simon Ser > * target.h (enum target_object): add FreeBSD-specific > TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS > * fbsd-nat.c (fbsd_nat_target::xfer_partial): add support for > TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS > * fbsd-tdep.c (fbsd_make_corefile_notes): write NT_PROCSTAT_AUXV, > NT_PROCSTAT_VMMAP and NT_PROCSTAT_PS_STRINGS notes > --- > + > + memcpy (buf, &struct_size, sizeof (struct_size)); > + if (sysctl (mib, 4, buf + sizeof (struct_size), &buflen, NULL, 0) != 0) One nit here: buflen is too large on input. You should do 'buflen -= sizeof(struct size)' before calling sysctl(). Agreed that auxv sysctl issues belong to a separate patch. -- John Baldwin