From patchwork Mon Jul 28 19:04:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 2198 Received: (qmail 16745 invoked by alias); 28 Jul 2014 19:04:34 -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 16731 invoked by uid 89); 28 Jul 2014 19:04:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 28 Jul 2014 19:04:33 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6SJ4VWS016228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 28 Jul 2014 15:04:31 -0400 Received: from barimba.redhat.com (ovpn-113-151.phx2.redhat.com [10.3.113.151]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6SJ4UR7006814; Mon, 28 Jul 2014 15:04:31 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] make "set debug target" take effect immediately Date: Mon, 28 Jul 2014 13:04:27 -0600 Message-Id: <1406574267-5212-1-git-send-email-tromey@redhat.com> Right now, "set debug target" acts a bit strangely. Most target APIs only notice that it has changed when the target stack is changed in some way. This is because many methods implement the setting using the special debug target. However, a few spots do change their behavior immediately -- any place explicitly checking "targetdebug". Some of this peculiar behavior is documented. However, I think that it just isn't very useful for it to work this way. So, This patch changes "set debug target" to take effect immediately in all cases. This is done by simply calling update_current_target when the setting is changed. This required one small change in the test suite. Here a test was expecting the current behavior. Built and regtested on x86-64 Fedora 20. 2014-07-28 Tom Tromey * target.c (set_targetdebug): New function. (initialize_targets): Pass set_targetdebug when creating "set debug target". 2014-07-28 Tom Tromey * gdb.texinfo (Debugging Output): Update for change to "set debug target". 2014-07-28 Tom Tromey * gdb.base/sss-bp-on-user-bp-2.exp: Expect output from "set debug target 0". --- gdb/ChangeLog | 6 ++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 3 +-- gdb/target.c | 11 ++++++++++- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp | 2 +- 6 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 32f709a..8d9148c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -22996,8 +22996,7 @@ Show the current state of symbol table creation debugging. Turns on or off display of @value{GDBN} target debugging info. This info includes what is going on at the target level of GDB, as it happens. The default is 0. Set it to 1 to track events, and to 2 to also track the -value of large memory transfers. Changes to this flag do not take effect -until the next time you connect to a target or use the @code{run} command. +value of large memory transfers. @item show debug target Displays the current state of displaying @value{GDBN} target debugging info. diff --git a/gdb/target.c b/gdb/target.c index d9b471b..a54494f 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -120,6 +120,8 @@ static void init_dummy_target (void); static void debug_to_open (char *, int); +static void update_current_target (void); + /* Pointer to array of target architecture structures; the size of the array; the current index into the array; the allocated size of the array. */ @@ -175,6 +177,13 @@ int may_stop = 1; /* Non-zero if we want to see trace of target level stuff. */ static unsigned int targetdebug = 0; + +static void +set_targetdebug (char *args, int from_tty, struct cmd_list_element *c) +{ + update_current_target (); +} + static void show_targetdebug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -3556,7 +3565,7 @@ Show target debugging."), _("\ When non-zero, target debugging is enabled. Higher numbers are more\n\ verbose. Changes do not take effect until the next \"run\" or \"target\"\n\ command."), - NULL, + set_targetdebug, show_targetdebug, &setdebuglist, &showdebuglist); diff --git a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp index a196f68..dd793bd 100644 --- a/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp +++ b/gdb/testsuite/gdb.base/sss-bp-on-user-bp-2.exp @@ -76,7 +76,7 @@ if { $hardware_step } { return } -gdb_test_no_output "set debug target 0" +gdb_test "set debug target 0" "->to_log_command.*\\)" set line_re "\[^\r\n\]*"