Fix internal error when saving fast tracepoint definitions
authorSimon Marchi <simon.marchi@ericsson.com>
Mon, 23 Nov 2015 23:47:09 +0000 (18:47 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Mon, 23 Nov 2015 23:47:09 +0000 (18:47 -0500)
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/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/actions.c
gdb/testsuite/gdb.trace/save-trace.exp

index 8cc9aa06b51a1daab897658ef5a37cc3dc531538..bc1a29ef01d1674c1468e13d242da16a33248fc8 100644 (file)
@@ -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
index 1425d2d87e16c149487bf97eb908cf0b699a1dbc..bc6b2ef6735aabdac2cdbabdddbc6c43be56f950 100644 (file)
@@ -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");
index ffc7dd5bb1130662f997daa9fd7a5071e975a342..a00920ff372676574940cc5478f9cfcf20d26235 100644 (file)
@@ -1,3 +1,11 @@
+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...
index 4b7b88701c4f92927bfbea414408b049166e42f7..e728635a0c197307f0f6f9abf15cf6321a2f8c5f 100644 (file)
@@ -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;
index aade1ed4078c6076c99f668e8d0498a928b24bd2..e423968664ebbab5035ee0243734ec9438978d92 100644 (file)
@@ -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"
This page took 0.042547 seconds and 4 git commands to generate.