[nemiver/count-point: 8/14] Cleanup GDBEngine::GDBEngine::append_breakpoints_to_cache
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/count-point: 8/14] Cleanup GDBEngine::GDBEngine::append_breakpoints_to_cache
- Date: Sun, 10 Oct 2010 16:36:49 +0000 (UTC)
commit 9215b37f2be84d80d5ae8fca35cf4e0560034234
Author: Dodji Seketeli <dodji seketeli org>
Date: Sat Oct 9 14:31:08 2010 +0200
Cleanup GDBEngine::GDBEngine::append_breakpoints_to_cache
* src/dbgengine/nmv-gdb-engine.h (append_breakpoint_to_cache): New
API.
* src/dbgengine/nmv-gdb-engine.cc
(GDBEngine::append_breakpoint_to_cache): Extract this from ...
(GDBEngine::append_breakpoints_to_cache): ... here.
src/dbgengine/nmv-gdb-engine.cc | 112 ++++++++++++++++++++++-----------------
src/dbgengine/nmv-gdb-engine.h | 2 +
2 files changed, 66 insertions(+), 48 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index ad36cb2..f5b0d66 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -3915,8 +3915,7 @@ GDBEngine::get_breakpoint_from_cache (int a_num,
}
void
-GDBEngine::append_breakpoints_to_cache
- (const map<int, IDebugger::Breakpoint> &a_breaks)
+GDBEngine::append_breakpoint_to_cache (const IDebugger::Breakpoint &a_break)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
@@ -3925,59 +3924,76 @@ GDBEngine::append_breakpoints_to_cache
typedef BpMap::const_iterator ConstBpIt;
BpMap &bp_cache = m_priv->cached_breakpoints;
- ConstBpIt iter;
BpIt cur, nil = bp_cache.end ();
- bool preserve_count_point;
-
- for (iter = a_breaks.begin (); iter != a_breaks.end (); ++iter) {
- preserve_count_point = false;
- if (iter->second.type () == IDebugger::Breakpoint::COUNTPOINT_TYPE) {
- LOG_DD ("breakpoint number "
- << iter->first
- << " is a count point");
- } else {
- LOG_DD ("breakpoint number "
- << iter->first
- << " is not a count point");
- }
+ bool preserve_count_point = false;
+
+ if (a_break.type () == IDebugger::Breakpoint::COUNTPOINT_TYPE) {
+ LOG_DD ("breakpoint number "
+ << a_break.number ()
+ << " is a count point");
+ } else {
+ LOG_DD ("breakpoint number "
+ << a_break.number ()
+ << " is not a count point");
+ }
- // First, let's see if the breakpoint pointed to by iter is
- // already in our cache.
- cur = bp_cache.find (iter->first);
- if (cur != nil) {
- // So the breakpoint iter->second is already in the
- // cache. If we flagged it as a countpoint, let's remember
- // that so that we don't loose the countpointness of the
- // breakpoint in the cache when we update its state with
- // the content of iter->second.
- if (cur->second.type () == IDebugger::Breakpoint::COUNTPOINT_TYPE)
- preserve_count_point = true;
+ // First, let's see if a_break is already in our cache.
+ cur = bp_cache.find (a_break.number ());
+ if (cur != nil) {
+ // So the breakpoint a_break is already in the
+ // cache. If we flagged it as a countpoint, let's remember
+ // that so that we don't loose the countpointness of the
+ // breakpoint in the cache when we update its state with
+ // the content of a_break.
+ if (cur->second.type () == IDebugger::Breakpoint::COUNTPOINT_TYPE)
+ preserve_count_point = true;
+ }
+
+ // So now is the cache updating time.
+
+ // If the breakpoint a_break was already in the cache and
+ // was flagged as a countpoint, let's preserve that
+ // countpointness attribute.
+ if (cur != nil) {
+ cur->second = a_break;
+ if (preserve_count_point) {
+ cur->second.type (IDebugger::Breakpoint::COUNTPOINT_TYPE);
+ LOG_DD ("propagated countpoinness to bp number " << cur->first);
}
+ } else {
+ // Its the first time we are adding this breakpoint to the
+ // cache. So its countpointness is going to be kept
+ // anyway.
+
+ std::pair<BpIt,bool> where =
+ bp_cache.insert (BpMap::value_type (a_break.number (), a_break));
- // So now is the cache updating time.
-
- // If the breakpoint iter->second was already in the cache and
- // was flagged as a countpoint, let's preserve that
- // countpointness attribute.
- if (cur != nil) {
- cur->second = iter->second;
- if (preserve_count_point) {
- cur->second.type (IDebugger::Breakpoint::COUNTPOINT_TYPE);
- LOG_DD ("propagated countpoinness to bp number " << cur->first);
- }
- } else {
- // Its the first time we are adding this breakpoint to the
- // cache. So its countpointness is going to be kept
- // anyway.
- std::pair<BpIt,bool> where = bp_cache.insert (*iter);
- if (preserve_count_point) {
- where.first->second.type (IDebugger::Breakpoint::COUNTPOINT_TYPE);
- LOG_DD ("propagated countpoinness to bp number " << cur->first);
- }
+ if (preserve_count_point) {
+ where.first->second.type (IDebugger::Breakpoint::COUNTPOINT_TYPE);
+ LOG_DD ("propagated countpoinness to bp number " << cur->first);
}
}
}
+/// Append a set of breakpoints to our breakpoint cache.
+/// This function supports the countpoint feature. That is, as a
+/// countpoint is a concept not known to GDB, we have to mark an
+/// otherwise normal breakpoint [from GDB's standpoint] as a
+/// countpoint, in our cache. So whenever we see a breakpoint that we
+/// have previously marked as a countpoint in our cache, we make sure
+/// to not loose the countpointness.
+/// \param a_breaks the set of breakpoints to append to the cache.
+void
+GDBEngine::append_breakpoints_to_cache
+ (const map<int, IDebugger::Breakpoint> &a_breaks)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ map<int, IDebugger::Breakpoint>::const_iterator iter;
+ for (iter = a_breaks.begin (); iter != a_breaks.end (); ++iter)
+ append_breakpoint_to_cache (iter->second);
+}
+
void
GDBEngine::set_catch (const UString &a_event,
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index 71e10ab..cae9ca0 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -280,6 +280,8 @@ public:
void init_output_handlers ();
+ void append_breakpoint_to_cache (const IDebugger::Breakpoint &a_break);
+
void append_breakpoints_to_cache (const map<int, IDebugger::Breakpoint>&);
void do_continue (const UString &a_cookie);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]