[PATCH] Fix PR13898: Set breakpoint_ops in mi_cmd_break_insert.

Yao Qi yao@codesourcery.com
Tue Sep 25 23:55:00 GMT 2012


When do something else, I find that GDB doesn't work when setting
tracepoint and breakpoint on the same address through MI.  This
problem was reported by PR 13898.

This patch is to fix this problem by correcting the 'breakpoint_ops'
when creating tracepoint in MI.  Regression tested on x86_64-linux
native and gdbserver.  OK?

My follow-up patch has a test case to cover this issue, so I don't
include a test case in this patch.

gdb:

2012-09-26  Yao Qi  <yao@codesourcery.com>

	PR breakpoints/13898
	* breakpoint.h (tracepoint_breakpoint_ops): Forward declaration.
	* mi/mi-cmd-break.c (mi_cmd_break_insert): Set breakpoint_ops
	per breakpoint type.
---
 gdb/breakpoint.h      |    1 +
 gdb/mi/mi-cmd-break.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 4c6171f..8b1bcb7 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1184,6 +1184,7 @@ extern void rwatch_command_wrapper (char *, int, int);
 extern void tbreak_command (char *, int);
 
 extern struct breakpoint_ops bkpt_breakpoint_ops;
+extern struct breakpoint_ops tracepoint_breakpoint_ops;
 
 extern void initialize_breakpoint_ops (void);
 
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 5a64bf1..e079772 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -76,6 +76,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
   int tracepoint = 0;
   struct cleanup *back_to;
   enum bptype type_wanted;
+  struct breakpoint_ops *ops;
 
   enum opt
     {
@@ -162,6 +163,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
   type_wanted = (tracepoint
 		 ? (hardware ? bp_fast_tracepoint : bp_tracepoint)
 		 : (hardware ? bp_hardware_breakpoint : bp_breakpoint));
+  ops = (tracepoint ? &tracepoint_breakpoint_ops : &bkpt_breakpoint_ops);
 
   create_breakpoint (get_current_arch (), address, condition, thread,
 		     NULL,
@@ -169,7 +171,7 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
 		     temp_p, type_wanted,
 		     ignore_count,
 		     pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
-		     &bkpt_breakpoint_ops, 0, enabled, 0, 0);
+		     ops, 0, enabled, 0, 0);
   do_cleanups (back_to);
 
 }
-- 
1.7.7.6



More information about the Gdb-patches mailing list