* gdb-interface component patch
@ 2001-07-30 9:11 Frank Ch. Eigler
0 siblings, 0 replies; only message in thread
From: Frank Ch. Eigler @ 2001-07-30 9:11 UTC (permalink / raw)
To: sid
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 ();
--
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7ZYdJVZbdDOm/ZT0RAixjAJ90GhpAHkIuAxR2+m9txPWzY21+awCeOG3n
pjV+wxIRyoTIIV/IGIuSOrw=
=F1xQ
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-07-30 9:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-30 9:11 gdb-interface component patch Frank Ch. Eigler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).