From patchwork Wed Feb 28 01:46:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 26114 Received: (qmail 113270 invoked by alias); 28 Feb 2018 01:48:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 112909 invoked by uid 89); 28 Feb 2018 01:48:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy= 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; Wed, 28 Feb 2018 01:48:36 +0000 Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 73E8610A8BA for ; Tue, 27 Feb 2018 20:48:34 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH 2/3] Add a new debug knob for the FreeBSD native target. Date: Tue, 27 Feb 2018 17:46:55 -0800 Message-Id: <20180228014656.32372-3-jhb@FreeBSD.org> In-Reply-To: <20180228014656.32372-1-jhb@FreeBSD.org> References: <20180228014656.32372-1-jhb@FreeBSD.org> X-IsSubscribed: yes For now this just logs information about the state of the current LWP for each STOPPED event in fbsd_wait(). gdb/ChangeLog: * NEWS (Changes since GDB 8.1): Add "set/show debug fbsd-nat". * fbsd-nat.c (debug_fbsd_nat): New variable. (show_fbsd_nat_debug): New function. (fbsd_wait): Log LWP info if "debug_fbsd_nat" is enabled. (_initialize_fbsd_nat): Add "fbsd-nat" debug boolean command. gdb/doc/ChangeLog: * gdb.texinfo (Debugging Output): Document "set/show debug fbsd-nat". --- gdb/ChangeLog | 8 ++++++++ gdb/NEWS | 6 ++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 5 +++++ gdb/fbsd-nat.c | 29 +++++++++++++++++++++++++++++ 5 files changed, 53 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0b4a308ef5..b8412304b6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2018-02-28 John Baldwin + + * NEWS (Changes since GDB 8.1): Add "set/show debug fbsd-nat". + * fbsd-nat.c (debug_fbsd_nat): New variable. + (show_fbsd_nat_debug): New function. + (fbsd_wait): Log LWP info if "debug_fbsd_nat" is enabled. + (_initialize_fbsd_nat): Add "fbsd-nat" debug boolean command. + 2018-02-28 John Baldwin * nat/x86-dregs.c (x86_dr_stopped_by_breakpoint): New function. diff --git a/gdb/NEWS b/gdb/NEWS index 1767cef920..867e268a2a 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -6,6 +6,12 @@ * 'info proc' now works on running processes on FreeBSD systems and core files created on FreeBSD systems. +* New commands + +set debug fbsd-nat +show debug fbsd-nat + Control display of debugging info regarding the FreeBSD native target. + *** Changes in GDB 8.1 * GDB now supports dynamically creating arbitrary register groups specified diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 037173ce0a..29757481b3 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2018-02-28 John Baldwin + + * gdb.texinfo (Debugging Output): Document "set/show debug + fbsd-nat". + 2018-02-19 Andrew Burgess * gdb.texinfo (Machine Code): Additional information about "info diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index ee7adc8df2..74e0fdb4a4 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -24554,6 +24554,11 @@ Displays the current state of displaying debugging info about Turns on or off debugging messages from the FreeBSD LWP debug support. @item show debug fbsd-lwp Show the current state of FreeBSD LWP debugging messages. +@item set debug fbsd-nat +@cindex FreeBSD native target debug messages +Turns on or off debugging messages from the FreeBSD native target. +@item show debug fbsd-nat +Show the current state of FreeBSD native target debugging messages. @item set debug frame @cindex frame debugging info Turns on or off display of @value{GDBN} frame debugging info. The diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c index 3a216abf18..2516ac5552 100644 --- a/gdb/fbsd-nat.c +++ b/gdb/fbsd-nat.c @@ -765,6 +765,7 @@ fbsd_xfer_partial (struct target_ops *ops, enum target_object object, #ifdef PT_LWPINFO static int debug_fbsd_lwp; +static int debug_fbsd_nat; static void (*super_resume) (struct target_ops *, ptid_t, @@ -782,6 +783,14 @@ show_fbsd_lwp_debug (struct ui_file *file, int from_tty, fprintf_filtered (file, _("Debugging of FreeBSD lwp module is %s.\n"), value); } +static void +show_fbsd_nat_debug (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, _("Debugging of FreeBSD native target is %s.\n"), + value); +} + /* FreeBSD's first thread support was via a "reentrant" version of libc (libc_r) that first shipped in 2.2.7. This library multiplexed all @@ -1212,6 +1221,18 @@ fbsd_wait (struct target_ops *ops, wptid = ptid_build (pid, pl.pl_lwpid, 0); + if (debug_fbsd_nat) + { + fprintf_unfiltered (gdb_stdlog, + "FNAT: stop for LWP %u event %d flags %#x\n", + pl.pl_lwpid, pl.pl_event, pl.pl_flags); + if (pl.pl_flags & PL_FLAG_SI) + fprintf_unfiltered (gdb_stdlog, + "FNAT: si_signo %u si_code %u\n", + pl.pl_siginfo.si_signo, + pl.pl_siginfo.si_code); + } + #ifdef PT_LWP_EVENTS if (pl.pl_flags & PL_FLAG_EXITED) { @@ -1569,5 +1590,13 @@ Enables printf debugging output."), NULL, &show_fbsd_lwp_debug, &setdebuglist, &showdebuglist); + add_setshow_boolean_cmd ("fbsd-nat", class_maintenance, + &debug_fbsd_nat, _("\ +Set debugging of FreeBSD native target."), _("\ +Show debugging of FreeBSD native target."), _("\ +Enables printf debugging output."), + NULL, + &show_fbsd_nat_debug, + &setdebuglist, &showdebuglist); #endif }