From patchwork Mon Nov 16 18:44:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 9692 Received: (qmail 67604 invoked by alias); 16 Nov 2015 18:44:48 -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 67559 invoked by uid 89); 16 Nov 2015 18:44:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg21.ericsson.net Received: from usevmg21.ericsson.net (HELO usevmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 16 Nov 2015 18:44:43 +0000 Received: from EUSAAHC001.ericsson.se (Unknown_Domain [147.117.188.75]) by usevmg21.ericsson.net (Symantec Mail Security) with SMTP id E8.D1.26730.806B9465; Mon, 16 Nov 2015 11:55:04 +0100 (CET) Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.75) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 16 Nov 2015 13:44:40 -0500 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 2/2] Fix internal error when saving fast tracepoint definitions Date: Mon, 16 Nov 2015 13:44:25 -0500 Message-ID: <1447699465-28821-2-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1447699465-28821-1-git-send-email-simon.marchi@ericsson.com> References: <1447699465-28821-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes When trying to save fast tracepoints to file, gdb returns internal failure: gdb/breakpoint.c:13446: internal-error: unhandled tracepoint type 27 A problem internal to GDB has been detected, further debugging may prove unreliable. And no file including the fast tracepoints definition is created. The patch also extends save-trace.exp to test saving tracepoint with a fast tracepoint in there. Note that because this test doesn't actually inserts the tracepoints in the program, we can run it with targets that don't actually support fast tracepoints (or tracepoints at all). gdb/ChangeLog: * breakpoint.c (tracepoint_print_recreate): Fix logic error if -> else if. gdb/testsuite/ChangeLog: * gdb.trace/actions.c: Include trace-common.h. (main): Add a location for a fast tracepoint. * gdb.trace/save-trace.exp: Set a fast tracepoint in addition to the normal tracepoints. (gdb_verify_tracepoints): Adjust number of expected tracepoints. --- gdb/breakpoint.c | 2 +- gdb/testsuite/gdb.trace/actions.c | 4 ++++ gdb/testsuite/gdb.trace/save-trace.exp | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 5863573..a290acb 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -13483,7 +13483,7 @@ tracepoint_print_recreate (struct breakpoint *self, struct ui_file *fp) if (self->type == bp_fast_tracepoint) fprintf_unfiltered (fp, "ftrace"); - if (self->type == bp_static_tracepoint) + else if (self->type == bp_static_tracepoint) fprintf_unfiltered (fp, "strace"); else if (self->type == bp_tracepoint) fprintf_unfiltered (fp, "trace"); diff --git a/gdb/testsuite/gdb.trace/actions.c b/gdb/testsuite/gdb.trace/actions.c index 4b7b887..e728635 100644 --- a/gdb/testsuite/gdb.trace/actions.c +++ b/gdb/testsuite/gdb.trace/actions.c @@ -21,6 +21,8 @@ #include +#include "trace-common.h" + static char gdb_char_test; static short gdb_short_test; static long gdb_long_test; @@ -136,6 +138,8 @@ main (argc, argv, envp) int i; unsigned long myparms[10]; + FAST_TRACEPOINT_LABEL (fast_tracepoint_loc); + begin (); for (i = 0; i < sizeof (myparms) / sizeof (myparms[0]); i++) myparms[i] = i; diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp index 31a4097..659b0c7 100644 --- a/gdb/testsuite/gdb.trace/save-trace.exp +++ b/gdb/testsuite/gdb.trace/save-trace.exp @@ -76,6 +76,8 @@ foreach x { 1 2 3 4 5 6 } { "end" "^$" } +gdb_test "ftrace fast_tracepoint_loc" "Fast tracepoint $decimal at $hex: file .*$srcfile, line $decimal.*" "Set a fast tracepoint" + gdb_test_no_output "set default-collect gdb_char_test, gdb_long_test - 100" \ "set default-collect" @@ -112,7 +114,7 @@ proc gdb_verify_tracepoints { testname } { exp_continue } -re "$gdb_prompt $" { - if { $ourstate >= 6 } { + if { $ourstate >= 7 } { set result "pass" } else { set result "fail"