From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by sourceware.org (Postfix) with ESMTP id 082053851C39 for ; Mon, 20 Jul 2020 17:43:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 082053851C39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=jhb@FreeBSD.org Received: from ralph.com (unknown [71.198.231.75]) by mail.baldwin.cx (Postfix) with ESMTPSA id B309210A77C for ; Mon, 20 Jul 2020 13:33:18 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH 5/5] Assume FreeBSD kernels always report exec events. Date: Mon, 20 Jul 2020 10:31:36 -0700 Message-Id: <20200720173136.10514-6-jhb@FreeBSD.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200720173136.10514-1-jhb@FreeBSD.org> References: <20200720173136.10514-1-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 20 Jul 2020 13:33:19 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KHOP_HELO_FCRDNS, SPF_HELO_PASS, SPF_SOFTFAIL, 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: Mon, 20 Jul 2020 17:43:10 -0000 FreeBSD kernels have reported exec events via the PL_FLAG_EXEC flag since 8.2 release. The most recent release that did not support this flag is 7.4 released in November of 2011. Note that the FreeBSD native target already assumed that PL_FLAG_SCE and PL_FLAG_SCX were always supported on systems supporting PT_LWPINFO, but those flags were added at the same time as PL_FLAG_EXEC. Building the native target on a system without PL_FLAG_EXEC would have failed to build before this change already as a result. gdb/ChangeLog: * fbsd-nat.c (fbsd_nat_target::wait): Always check for PL_FLAG_EXEC. (fbsd_nat_target::insert_exec_catchpoint) (fbsd_nat_target::remove_exec_catchpoint): Always define. * fbsd-nat.h (fbsd_nat_target::insert_exec_catchpoint) (fbsd_nat_target::remove_exec_catchpoint): Always declare. --- gdb/ChangeLog | 9 +++++++++ gdb/fbsd-nat.c | 7 +------ gdb/fbsd-nat.h | 2 -- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8201b357a5..a5fb48f091 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2020-07-20 John Baldwin + + * fbsd-nat.c (fbsd_nat_target::wait): Always check for + PL_FLAG_EXEC. + (fbsd_nat_target::insert_exec_catchpoint) + (fbsd_nat_target::remove_exec_catchpoint): Always define. + * fbsd-nat.h (fbsd_nat_target::insert_exec_catchpoint) + (fbsd_nat_target::remove_exec_catchpoint): Always declare. + 2020-07-20 John Baldwin * fbsd-nat.c (fbsd_read_mapping): Remove diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index ac88fbc87f..0ab7f83d68 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -1335,7 +1335,6 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, #endif #endif -#ifdef PL_FLAG_EXEC if (pl.pl_flags & PL_FLAG_EXEC) { ourstatus->kind = TARGET_WAITKIND_EXECD; @@ -1343,7 +1342,6 @@ fbsd_nat_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus, = xstrdup (pid_to_exec_file (pid)); return wptid; } -#endif #ifdef USE_SIGTRAP_SIGINFO if (fbsd_handle_debug_trap (this, wptid, pl)) @@ -1508,9 +1506,7 @@ fbsd_nat_target::post_attach (int pid) fbsd_add_threads (this, pid); } -#ifdef PL_FLAG_EXEC -/* If the FreeBSD kernel supports PL_FLAG_EXEC, then traced processes - will always stop after exec. */ +/* Traced processes always stop after exec. */ int fbsd_nat_target::insert_exec_catchpoint (int pid) @@ -1523,7 +1519,6 @@ fbsd_nat_target::remove_exec_catchpoint (int pid) { return 0; } -#endif #ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE int diff --git a/gdb/fbsd-nat.h b/gdb/fbsd-nat.h index b49bf8cbaf..c3c5cccf7e 100644 --- a/gdb/fbsd-nat.h +++ b/gdb/fbsd-nat.h @@ -83,10 +83,8 @@ class fbsd_nat_target : public inf_ptrace_target int remove_vfork_catchpoint (int) override; #endif -#ifdef PL_FLAG_EXEC int insert_exec_catchpoint (int) override; int remove_exec_catchpoint (int) override; -#endif #ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE int set_syscall_catchpoint (int, bool, int, gdb::array_view) -- 2.25.1