OSDN Git Service

* gdb-interface extension
authorfche <fche>
Mon, 30 Jul 2001 16:12:19 +0000 (16:12 +0000)
committerfche <fche>
Mon, 30 Jul 2001 16:12:19 +0000 (16:12 +0000)
2001-07-30  Frank Ch. Eigler  <fche@redhat.com>

* gdb.h (gdb::hw_breakpoint_pc_mask): New member variable.
* gdb.cxx (gdb ctor): Expose it as `Z-packet-pc-mask' attribute.
(remove_hw_breakpoint, add_hw_breakpoint): Respect it.

sid/component/gdb/ChangeLog
sid/component/gdb/gdb.cxx
sid/component/gdb/gdb.h

index bca3cb6..9a0b898 100644 (file)
@@ -1,3 +1,9 @@
+2001-07-30  Frank Ch. Eigler  <fche@redhat.com>
+
+       * gdb.h (gdb::hw_breakpoint_pc_mask): New member variable.
+       * gdb.cxx (gdb ctor): Expose it as `Z-packet-pc-mask' attribute.
+       (remove_hw_breakpoint, add_hw_breakpoint): Respect it.
+
 2001-07-20  Frank Ch. Eigler  <fche@redhat.com>
 
        * gdb.cxx (process_set_reg): Make optional trace more informative.
index 45553c0..a14ef76 100644 (file)
@@ -1,6 +1,6 @@
 // gdb.cxx - GDB stub implementation.  -*- C++ -*-
 
-// Copyright (C) 1999, 2000, 2001 Red Hat.
+// Copyright (C) 1999-2001 Red Hat.
 // This file is part of SID and is licensed under the GPL.
 // See the file COPYING.SID for conditions for redistribution.
 
@@ -885,11 +885,25 @@ gdb::remove_hw_breakpoint (host_int_8 address)
       return false;
     }
 
-  string watcher_name = 
-    string("watch:") + 
-    map_watchable_name ("gdb-register-pc") +
-    string(":value:") + 
-    make_numeric_attribute (address);
+  string watcher_name;
+  if (this->hw_breakpoint_pc_mask)
+    {
+      watcher_name =
+       string ("watch:") + 
+       map_watchable_name ("gdb-register-pc") + string (":") +
+       string ("mask/value:") + 
+       make_numeric_attribute (this->hw_breakpoint_pc_mask) + string (":") +
+       make_numeric_attribute (address);
+    }
+  else
+    {
+      watcher_name =
+       string ("watch:") + 
+       map_watchable_name ("gdb-register-pc") + string (":") +
+       string ("value:") + 
+       make_numeric_attribute (address);
+    }
+  // see also ::add_hw_breakpoint()
   
   this->hw_breakpoints[address] --;
   if (this->hw_breakpoints[address] == 0)
@@ -922,11 +936,26 @@ gdb::set_breakpoint (unsigned long type, struct gdbserv_reg *addr, struct gdbser
 bool
 gdb::add_hw_breakpoint (host_int_8 address)
 {  
-  string watcher_name = 
-    string("watch:") + 
-    map_watchable_name ("gdb-register-pc") +
-    string(":value:") + 
-    make_numeric_attribute (address);
+  string watcher_name;
+  if (this->hw_breakpoint_pc_mask)
+    {
+      watcher_name =
+       string ("watch:") + 
+       map_watchable_name ("gdb-register-pc") + string (":") +
+       string ("mask/value:") + 
+       make_numeric_attribute (this->hw_breakpoint_pc_mask) + string (":") +
+       make_numeric_attribute (address);
+    }
+  else
+    {
+      watcher_name =
+       string ("watch:") + 
+       map_watchable_name ("gdb-register-pc") + string (":") +
+       string ("value:") + 
+       make_numeric_attribute (address);
+    }
+  // see also ::remove_hw_breakpoint()
+
   
   this->hw_breakpoints[address] ++;
   if (this->hw_breakpoints[address] == 1)
@@ -1158,6 +1187,7 @@ gdb::gdb ():
   exit_on_detach = false;
   enable_Z_packet = true;
   operating_mode_p = true;
+  hw_breakpoint_pc_mask = 0;
 
   add_attribute_notify ("trace-gdbserv?", & trace_gdbserv, 
                        this, & gdb::update_trace_flags, "setting");
@@ -1166,6 +1196,7 @@ gdb::gdb ():
   add_attribute ("exit-on-detach?", & exit_on_detach, "setting");
   add_attribute ("enable-Z-packet?", & enable_Z_packet, "setting");
   add_attribute ("operating-mode?", & operating_mode_p, "setting");
+  add_attribute ("Z-packet-pc-mask", & hw_breakpoint_pc_mask, "setting");
 }
 
 
index cac0162..49af26a 100644 (file)
@@ -121,6 +121,7 @@ private:
   // hw breakpoint tracking
   typedef map<host_int_8,int> hw_breakpoints_t;
   hw_breakpoints_t hw_breakpoints; // address -> insertion-count
+  host_int_8 hw_breakpoint_pc_mask; // 0=disabled
   bool add_hw_breakpoint (host_int_8);
   bool remove_hw_breakpoint (host_int_8);
   bool remove_all_hw_breakpoints ();