gdb:
authorYao Qi <yao@codesourcery.com>
Tue, 24 Apr 2012 14:33:12 +0000 (14:33 +0000)
committerYao Qi <yao@codesourcery.com>
Tue, 24 Apr 2012 14:33:12 +0000 (14:33 +0000)
Revert this patch to allow breakpoint always-inserted
in record target.
2011-12-05  Pedro Alves  <pedro@codesourcery.com>
        * breakpoint.c: Include record.h.
        (breakpoints_always_inserted_mode): Return false when the record
        target is in use.

* breakpoint.c (iterate_over_bp_locations): New.
* breakpoint.h: Declare.
New typedef walk_bp_location_callback.
* record.c (record_open): Call record_init_record_breakpoints.
(record_sync_record_breakpoints): New.
(record_init_record_breakpoints): New.
* NEWS: Mention supporting breakpoint always-inserted mode in
record target.

gdb/ChangeLog
gdb/NEWS
gdb/breakpoint.c
gdb/breakpoint.h
gdb/record.c

index a3a72fbe2e522da690d1f494e3619ccb8e0d069d..5b2b105ea49d8096ebbd8f0b6928353b52d62b4d 100644 (file)
@@ -1,3 +1,21 @@
+2012-04-24  Yao Qi  <yao@codesourcery.com>
+
+       Revert this patch to allow breakpoint always-inserted
+       in record target.
+       2011-12-05  Pedro Alves  <pedro@codesourcery.com>
+        * breakpoint.c: Include record.h.
+        (breakpoints_always_inserted_mode): Return false when the record
+        target is in use.
+
+       * breakpoint.c (iterate_over_bp_locations): New.
+       * breakpoint.h: Declare.
+       New typedef walk_bp_location_callback.
+       * record.c (record_open): Call record_init_record_breakpoints.
+       (record_sync_record_breakpoints): New.
+       (record_init_record_breakpoints): New.
+       * NEWS: Mention supporting breakpoint always-inserted mode in
+       record target.
+
 2012-04-24  Marc Khouzam  <marc.khouzam@ericsson.com>
 
        * mi/mi-main.c (mi_cmd_execute): Choose a live thread not just
index 72b4d9022d3695428712bd043704b6d03d5ed35d..72ce6b8954ab7322c658a14caaa55a779f358093 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -82,6 +82,9 @@
 
 * Ada support for GDB/MI Variable Objects has been added.
 
+* GDB can now support 'breakpoint always-inserted mode' in 'record'
+  target.
+
 * New commands
 
   ** "catch load" and "catch unload" can be used to stop when a shared
index ceca22114a0a9fb025e9ed27b6ba86cef12084dc..4204e360ce4fc41537d53c26fd6ae6da9106ee40 100644 (file)
@@ -64,7 +64,6 @@
 #include "continuations.h"
 #include "stack.h"
 #include "skip.h"
-#include "record.h"
 #include "gdb_regex.h"
 #include "ax-gdb.h"
 
@@ -404,9 +403,8 @@ show_always_inserted_mode (struct ui_file *file, int from_tty,
 int
 breakpoints_always_inserted_mode (void)
 {
-  return ((always_inserted_mode == always_inserted_on
-          || (always_inserted_mode == always_inserted_auto && non_stop))
-         && !RECORD_IS_USED);
+  return (always_inserted_mode == always_inserted_on
+         || (always_inserted_mode == always_inserted_auto && non_stop));
 }
 
 static const char condition_evaluation_both[] = "host or target";
@@ -2425,6 +2423,19 @@ insert_breakpoints (void)
     insert_breakpoint_locations ();
 }
 
+/* Invoke CALLBACK for each of bp_location.  */
+
+void
+iterate_over_bp_locations (walk_bp_location_callback callback)
+{
+  struct bp_location *loc, **loc_tmp;
+
+  ALL_BP_LOCATIONS (loc, loc_tmp)
+    {
+      callback (loc, NULL);
+    }
+}
+
 /* This is used when we need to synch breakpoint conditions between GDB and the
    target.  It is the case with deleting and disabling of breakpoints when using
    always-inserted mode.  */
index e676659a935a789ddf9edf4f0473775d199b42a4..75b62d2daf7e8f08f7bced1320463b4d274310af 100644 (file)
@@ -1131,6 +1131,10 @@ extern void delete_breakpoint (struct breakpoint *);
 
 extern void breakpoint_auto_delete (bpstat);
 
+typedef void (*walk_bp_location_callback) (struct bp_location *, void *);
+
+extern void iterate_over_bp_locations (walk_bp_location_callback);
+
 /* Return the chain of command lines to execute when this breakpoint
    is hit.  */
 extern struct command_line *breakpoint_commands (struct breakpoint *b);
index 9b7ee2f7f5c0f014f415b4e0b44ae8664cc6f838..7db15277eddaaa668746f80298abcb5b84deb05f 100644 (file)
@@ -896,6 +896,8 @@ record_open_1 (char *name, int from_tty)
   push_target (&record_ops);
 }
 
+static void record_init_record_breakpoints (void);
+
 /* "to_open" target method.  Open the process record target.  */
 
 static void
@@ -993,6 +995,8 @@ record_open (char *name, int from_tty)
   record_async_inferior_event_token
     = create_async_event_handler (record_async_inferior_event_handler,
                                  NULL);
+
+  record_init_record_breakpoints ();
 }
 
 /* "to_close" target method.  Close the process record target.  */
@@ -1744,6 +1748,35 @@ DEF_VEC_P(record_breakpoint_p);
    active.  */
 VEC(record_breakpoint_p) *record_breakpoints = NULL;
 
+static void
+record_sync_record_breakpoints (struct bp_location *loc, void *data)
+{
+  if (loc->loc_type != bp_loc_software_breakpoint)
+      return;
+
+  if (loc->inserted)
+    {
+      struct record_breakpoint *bp = XNEW (struct record_breakpoint);
+
+      bp->addr = loc->target_info.placed_address;
+      bp->address_space = loc->target_info.placed_address_space;
+
+      bp->in_target_beneath = 1;
+
+      VEC_safe_push (record_breakpoint_p, record_breakpoints, bp);
+    }
+}
+
+/* Sync existing breakpoints to record_breakpoints.  */
+
+static void
+record_init_record_breakpoints (void)
+{
+  VEC_free (record_breakpoint_p, record_breakpoints);
+
+  iterate_over_bp_locations (record_sync_record_breakpoints);
+}
+
 /* Behavior is conditional on RECORD_IS_REPLAY.  We will not actually
    insert or remove breakpoints in the real target when replaying, nor
    when recording.  */