From 777bc268d801816063ace771933fb88ac4baaa4b Mon Sep 17 00:00:00 2001 From: fche Date: Mon, 30 Jul 2001 16:12:19 +0000 Subject: [PATCH] * gdb-interface extension 2001-07-30 Frank Ch. Eigler * 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 | 6 +++++ sid/component/gdb/gdb.cxx | 53 +++++++++++++++++++++++++++++++++++---------- sid/component/gdb/gdb.h | 1 + 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/sid/component/gdb/ChangeLog b/sid/component/gdb/ChangeLog index bca3cb6253..9a0b8986f0 100644 --- a/sid/component/gdb/ChangeLog +++ b/sid/component/gdb/ChangeLog @@ -1,3 +1,9 @@ +2001-07-30 Frank Ch. Eigler + + * 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 * gdb.cxx (process_set_reg): Make optional trace more informative. diff --git a/sid/component/gdb/gdb.cxx b/sid/component/gdb/gdb.cxx index 45553c0987..a14ef767ba 100644 --- a/sid/component/gdb/gdb.cxx +++ b/sid/component/gdb/gdb.cxx @@ -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"); } diff --git a/sid/component/gdb/gdb.h b/sid/component/gdb/gdb.h index cac0162be5..49af26a2a6 100644 --- a/sid/component/gdb/gdb.h +++ b/sid/component/gdb/gdb.h @@ -121,6 +121,7 @@ private: // hw breakpoint tracking typedef map 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 (); -- 2.11.0