This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix internal error when saving fast tracepoint definitions


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c93e8391bf595de7adde64d1b3f1d564da6f3aee

commit c93e8391bf595de7adde64d1b3f1d564da6f3aee
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Mon Nov 23 18:47:09 2015 -0500

    Fix internal error when saving fast tracepoint definitions
    
    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.

Diff:
---
 gdb/ChangeLog                          | 5 +++++
 gdb/breakpoint.c                       | 2 +-
 gdb/testsuite/ChangeLog                | 8 ++++++++
 gdb/testsuite/gdb.trace/actions.c      | 4 ++++
 gdb/testsuite/gdb.trace/save-trace.exp | 6 +++++-
 5 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8cc9aa0..bc1a29e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-23  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* breakpoint.c (tracepoint_print_recreate): Fix logic error
+	if -> else if.
+
 2015-11-23  Kevin Buettner  <kevinb@redhat.com>
 
 	* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Scan backwards
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1425d2d..bc6b2ef 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -13506,7 +13506,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/ChangeLog b/gdb/testsuite/ChangeLog
index ffc7dd5..a00920f 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
 2015-11-23  Simon Marchi  <simon.marchi@ericsson.com>
 
+	* 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.
+
+2015-11-23  Simon Marchi  <simon.marchi@ericsson.com>
+
 	* save-trace.exp: Factor out code to these...
 	(gdb_save_tracepoints): New.
 	(gdb_load_tracepoints): New.
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 <string.h>
 
+#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 aade1ed..e423968 100644
--- a/gdb/testsuite/gdb.trace/save-trace.exp
+++ b/gdb/testsuite/gdb.trace/save-trace.exp
@@ -76,6 +76,10 @@ 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"
 
@@ -116,7 +120,7 @@ proc gdb_verify_tracepoints { testname } {
 	    exp_continue
 	}
 	-re "$gdb_prompt $" {
-	    if { $ourstate >= 6 } {
+	    if { $ourstate >= 7 } {
 		set result "pass"
 	    } else {
 		set result "fail"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]