This is the mail archive of the
sid@sources.redhat.com
mailing list for the SID project.
gdb-interface component patch
- To: sid at sources dot redhat dot com
- Subject: gdb-interface component patch
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- Date: Mon, 30 Jul 2001 12:11:53 -0400
Hi -
I'm about to commit the following patch to sid/component/gdb. It adds
a new attribute "Z-packet-pc-mask", which allows Z packets coming from
gdb to be executable-level addresses as opposed to PC register values.
There is often a difference for Harvard architectures, where insn/data
address spaces are encoded into bits of the executable-level symbol
addresses. This new mask parameter is there to allow these bits to
be excluded from PC-watchpoint calculations.
- FChE
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.
Index: gdb.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/gdb/gdb.cxx,v
retrieving revision 1.4
diff -u -r1.4 gdb.cxx
--- gdb.cxx 2001/07/20 11:41:42 1.4
+++ gdb.cxx 2001/07/30 16:09:03
@@ -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 @@
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 @@
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 @@
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 @@
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: gdb.h
===================================================================
RCS file: /cvs/src/src/sid/component/gdb/gdb.h,v
retrieving revision 1.2
diff -u -r1.2 gdb.h
--- gdb.h 2001/01/04 01:00:11 1.2
+++ gdb.h 2001/07/30 16:09:03
@@ -121,6 +121,7 @@
// 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 ();
PGP signature