From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by sourceware.org (Postfix) with ESMTPS id 964F53840C0C for ; Tue, 28 Jul 2020 15:47:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 964F53840C0C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gmx.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=n54@gmx.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1595951208; bh=4WGqmXFGqB+qA28yTk91YU8DaXyftIW8A/kG6K4M9yQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Tgipu+akzvCAetYbHu7u6FU8BS6DBw/ypl5Y+jflXg+VBbd8iSKE9/tcEeQP6LJPr isE8A7WrIULHszXpsC4b4Cn+w8Fc6JsdChaIUntXxcq/0nBaD9lpUB2Za8b1jhkOpq tB/rX3TbKl7bYLY8MNP4/y6XWI+Ztn/Ba9PH5SWs= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([89.79.191.25]) by mail.gmx.com (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1M8QS8-1k4rfM1osy-004P5y; Tue, 28 Jul 2020 17:46:48 +0200 From: Kamil Rytarowski To: gdb-patches@sourceware.org, jhb@FreeBSD.org, tom@tromey.com Subject: [PATCH v2 2/2] gdb: Implement native dumpcore function for NetBSD Date: Tue, 28 Jul 2020 17:46:02 +0200 Message-Id: <20200728154602.3824-2-n54@gmx.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200728154602.3824-1-n54@gmx.com> References: <20200727144338.7033-1-n54@gmx.com> <20200728154602.3824-1-n54@gmx.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:a9jHlp83Ej2VlI35YlC6uUfhpRB7zMEJ4287YyKC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EJpToqj5V5bo/rkREOlWlbHJPB9Jj9mfzzK3xfgYu96MHzg bls8cIUho6VXUycz2ZPqRRlILo99rwYbo1AH9DpbaIu3tOyPxzylCbdVJaeBNBbBsrjSc0CoQ N/hocOPjwLutdVxFsh5UjQBHQRFVo/0vYNLtf57j7m5UAcxBTha+NSRYJkihUFNDi+MH3Y0W+ +/eFtJxYUHE0sdCHZSNOI+fmP9kJ/U3hdJt8ll2nDUOR2NVM3wloKg80aC7+sRBsWYXC4g25G g0JmMzQvkrUMqm0VB+aqUuqafVHzhRkb+fYnOObGAxmi26C2tV9EiT6YxAMGkIeV+xs10zJTi UqoIA2jGQUTbm1x9CiBXy8ZgUuNtRwfUb5yzJ0WqaGFeWUJqDJH0wTZExDlYBknF1tF6cmVci UVpX3CI/RxtNtoa2p X-Spam-Status: No, score=-18.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2020 15:47:04 -0000 Define supports_dumpcore and dumpcore for NetBSD, that wraps the ptrace(2) call with the PT_DUMPCORE operation. gdb/ChangeLog: * nbsd-nat.h (nbsd_nat_target::supports_native_dumpcore) (nbsd_nat_target::native_dumpcore): New declarations. * nbsd-nat.c (nbsd_nat_target::supports_native_dumpcore) (nbsd_nat_target::native_dumpcore): New functions. =2D-- gdb/ChangeLog | 7 +++++++ gdb/nbsd-nat.c | 19 +++++++++++++++++++ gdb/nbsd-nat.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 118bb4f89a2..75b9a0bd13d 100644 =2D-- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-07-28 Kamil Rytarowski + + * nbsd-nat.h (nbsd_nat_target::supports_native_dumpcore) + (nbsd_nat_target::native_dumpcore): New declarations. + * nbsd-nat.c (nbsd_nat_target::supports_native_dumpcore) + (nbsd_nat_target::native_dumpcore): New functions. + 2020-07-28 Kamil Rytarowski * target.h (supports_native_dumpcore, native_dumpcore): New diff --git a/gdb/nbsd-nat.c b/gdb/nbsd-nat.c index a9405ebf862..c893c5498bb 100644 =2D-- a/gdb/nbsd-nat.c +++ b/gdb/nbsd-nat.c @@ -845,3 +845,22 @@ nbsd_nat_target::supports_multi_process () { return true; } + +/* Implement the "supports_dumpcore" target_ops method. */ + +bool +nbsd_nat_target::supports_dumpcore () +{ + return true; +} + +/* Implement the "dumpcore" target_ops method. */ + +bool +nbsd_nat_target::dumpcore (const char *filename) +{ + pid_t pid =3D inferior_ptid.pid (); + + return ptrace (PT_DUMPCORE, pid, const_cast(filename), + strlen (filename)) !=3D -1; +} diff --git a/gdb/nbsd-nat.h b/gdb/nbsd-nat.h index 0a7048ecf35..550ea6a5d8d 100644 =2D-- a/gdb/nbsd-nat.h +++ b/gdb/nbsd-nat.h @@ -49,6 +49,8 @@ struct nbsd_nat_target : public inf_ptrace_target override; bool supports_multi_process () override; + bool supports_dumpcore () override; + bool dumpcore (const char* filename) override; }; #endif /* nbsd-nat.h */ =2D- 2.26.2