[nemiver] Rename IDebugger::Breakpoint::number to IDebugger::Breakpoint::id
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] Rename IDebugger::Breakpoint::number to IDebugger::Breakpoint::id
- Date: Sun, 27 Oct 2013 15:55:58 +0000 (UTC)
commit 940ccc358bda9f07e271652ba0db53b96aaf5dcd
Author: Dodji Seketeli <dodji seketeli org>
Date: Fri Oct 25 12:06:10 2013 +0200
Rename IDebugger::Breakpoint::number to IDebugger::Breakpoint::id
* src/dbgengine/nmv-i-debugger.h (IDebugger::Breakpoint::id):
Rename IDebugger::Breakpoint::number into this. What we are
getting is a string id, not a an integer number (the id can be
"2.3", for instance).
(IDebugger::Breakpoint::number): New method that always return the
sub breakpoint number.
* src/dbgengine/nmv-gdb-engine.cc
(OnBreakpointHandler::do_handle)
(GDBEngine::append_breakpoint_to_cache, ): Update for the
Breakpoint::id rename.
* src/dbgengine/nmv-gdbmi-parser.cc
(GDBMIParser::parse_result_record): Likewise.
* src/persp/dbgperspective/nmv-breakpoints-view.cc
(BreakpointsView::Priv::{breakpoint_list_has_id,
find_breakpoint_in_model, update_breakpoint,
on_debugger_breakpoints_list_signal}): Likewise.
* src/persp/dbgperspective/nmv-dbg-perspective.cc
(DBGPerspective::{on_breakpoint_delete_action,
on_debugger_breakpoints_list_signal,
do_jump_and_break_to_location, re_initialize_set_breakpoints,
append_breakpoint_to_cache, delete_breakpoint, toggle_countpoint,
toggle_breakpoint_enabled}): Likewise.
* tests/test-gdbmi.cc (test_breakpoint_table, test_breakpoint):
Likewise.
src/dbgengine/nmv-gdb-engine.cc | 6 ++--
src/dbgengine/nmv-gdbmi-parser.cc | 4 +-
src/dbgengine/nmv-i-debugger.h | 24 ++++++++++++++++++-
src/persp/dbgperspective/nmv-breakpoints-view.cc | 8 +++---
src/persp/dbgperspective/nmv-dbg-perspective.cc | 26 +++++++++++-----------
tests/test-gdbmi.cc | 6 ++--
6 files changed, 47 insertions(+), 27 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 9dc6162..00ac112 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -1543,7 +1543,7 @@ struct OnBreakpointHandler: OutputHandler {
breakpoints ().size () == 1);
m_engine->enable_countpoint
(a_in.output ().result_record ().
- breakpoints ().begin ()->second.number (),
+ breakpoints ().begin ()->second.id (),
true);
}
has_breaks = true;
@@ -5011,7 +5011,7 @@ GDBEngine::append_breakpoint_to_cache (IDebugger::Breakpoint &a_break)
<< ": " << a_break.initial_ignore_count ());
// First, let's see if a_break is already in our cache.
- cur = bp_cache.find (a_break.number ());
+ cur = bp_cache.find (a_break.id ());
if (cur != nil) {
// So the breakpoint a_break is already in the
// cache. If we flagged it as a countpoint, let's remember
@@ -5053,7 +5053,7 @@ GDBEngine::append_breakpoint_to_cache (IDebugger::Breakpoint &a_break)
// 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));
+ bp_cache.insert (BpMap::value_type (a_break.id (), a_break));
if (preserve_count_point) {
where.first->second.type (IDebugger::Breakpoint::COUNTPOINT_TYPE);
diff --git a/src/dbgengine/nmv-gdbmi-parser.cc b/src/dbgengine/nmv-gdbmi-parser.cc
index eae5ca0..9f651e0 100644
--- a/src/dbgengine/nmv-gdbmi-parser.cc
+++ b/src/dbgengine/nmv-gdbmi-parser.cc
@@ -1854,7 +1854,7 @@ fetch_gdbmi_result:
PREFIX_BKPT)) {
IDebugger::Breakpoint breakpoint;
if (parse_breakpoint (cur, cur, breakpoint)) {
- result_record.breakpoints ()[breakpoint.number ()] =
+ result_record.breakpoints ()[breakpoint.id ()] =
breakpoint;
}
} else if (!m_priv->input.compare (cur,
@@ -2460,7 +2460,7 @@ GDBMIParser::parse_breakpoint_table (UString::size_type a_from,
LOG_PARSING_ERROR (cur);
return false;
}
- breakpoint_table[breakpoint.number ()] = breakpoint;
+ breakpoint_table[breakpoint.id ()] = breakpoint;
if (RAW_CHAR_AT (cur) == ',') {
++cur;
if (m_priv->index_passed_end (cur)) {
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index b8d98ad..36ba2ab 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -138,7 +138,14 @@ public:
/// \name accessors
/// @{
- string number () const
+
+ /// Getter of the ID of this breakpoint. If the breakpoint is
+ /// a sub breakpoint, its id has the form of the string "5.4"
+ /// where 5 is the number of the parent breakpoint and 4 is
+ /// the number of this sub breakpoint.
+ ///
+ /// @return the ID this breakpoint.
+ string id () const
{
if (is_sub_breakpoint ())
return (str_utils::int_to_string (parent_breakpoint_number ()) + "."
@@ -147,11 +154,24 @@ public:
return str_utils::int_to_string (sub_breakpoint_number ());
}
- void number (string& s) const
+ /// Getter of the ID of this breakpoint. If the breakpoint is
+ /// a sub breakpoint, its id has the form of the string "5.4"
+ /// where 5 is the number of the parent breakpoint and 4 is
+ /// the number of this sub breakpoint.
+ ///
+ /// @param s out parameter. Set to the ID of this breakpoint.
+ void id (string& s) const
{
s = number ();
}
+ /// Getter of the number of this breakpoint. Note that if
+ /// this is a sub breakpoint, what you might want is the
+ /// number of the parent breakpoint.
+ ///
+ /// @return the integer number of this breakpoint.
+ int number() const {return sub_breakpoint_number();}
+
void number (int a_in) {m_number = a_in;}
int sub_breakpoint_number () const {return m_number;}
diff --git a/src/persp/dbgperspective/nmv-breakpoints-view.cc
b/src/persp/dbgperspective/nmv-breakpoints-view.cc
index f2972da..32fa51c 100644
--- a/src/persp/dbgperspective/nmv-breakpoints-view.cc
+++ b/src/persp/dbgperspective/nmv-breakpoints-view.cc
@@ -313,7 +313,7 @@ public:
std::map<string, IDebugger::Breakpoint>::const_iterator breakmap_iter;
for (breakmap_iter = a_breakpoints.begin ();
breakmap_iter != a_breakpoints.end (); ++ breakmap_iter) {
- if (a_id == breakmap_iter->second.number ()) {
+ if (a_id == breakmap_iter->second.id ()) {
return true;
}
}
@@ -329,7 +329,7 @@ public:
for (iter = list_store->children ().begin ();
iter != list_store->children ().end ();
++iter) {
- if ((*iter)[get_bp_cols ().id] == a_breakpoint.number ()) {
+ if ((*iter)[get_bp_cols ().id] == a_breakpoint.id ()) {
return iter;
}
}
@@ -343,7 +343,7 @@ public:
{
(*a_iter)[get_bp_cols ().breakpoint] = a_breakpoint;
(*a_iter)[get_bp_cols ().enabled] = a_breakpoint.enabled ();
- (*a_iter)[get_bp_cols ().id] = a_breakpoint.number ();
+ (*a_iter)[get_bp_cols ().id] = a_breakpoint.id ();
(*a_iter)[get_bp_cols ().function] = a_breakpoint.function ();
(*a_iter)[get_bp_cols ().address] =
(a_breakpoint.address ().empty ())
@@ -577,7 +577,7 @@ public:
std::map<string, IDebugger::Breakpoint>::const_iterator i;
for (i = a.begin (); i != a.end (); ++i) {
LOG_DD ("Adding breakpoints "
- << i->second.number ());
+ << i->second.id ());
append_breakpoint (i->second);
}
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 6a09154..59da587 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -1748,7 +1748,7 @@ DBGPerspective::on_breakpoint_delete_action
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
NEMIVER_TRY
- delete_breakpoint (a_breakpoint.number ());
+ delete_breakpoint (a_breakpoint.id ());
NEMIVER_CATCH
}
@@ -2451,7 +2451,7 @@ DBGPerspective::on_debugger_breakpoints_list_signal
if ((break_iter->second.file_full_name () == file
|| break_iter->second.file_name () == file)
&& break_iter->second.line () == line) {
- debugger ()->disable_breakpoint (break_iter->second.number ());
+ debugger ()->disable_breakpoint (break_iter->second.id ());
}
}
}
@@ -6684,7 +6684,7 @@ DBGPerspective::do_jump_and_break_to_location (const Loc &a_location)
{
#define JUMP_TO_LOC_AFTER_ENABLE_BP(LOC) \
debugger ()->enable_breakpoint \
- (bp->number (), \
+ (bp->id (), \
sigc::bind \
(sigc::mem_fun \
(*this, \
@@ -6926,7 +6926,7 @@ DBGPerspective::re_initialize_set_breakpoints ()
i != bps.end ();
++i) {
debugger ()->set_breakpoint_ignore_count
- (i->second.number (),
+ (i->second.id (),
i->second.initial_ignore_count ());
}
}
@@ -6955,8 +6955,8 @@ DBGPerspective::append_breakpoint (const IDebugger::Breakpoint &a_breakpoint)
file_path = a_breakpoint.file_name ();
}
- m_priv->breakpoints[a_breakpoint.number ()] = a_breakpoint;
- m_priv->breakpoints[a_breakpoint.number ()].file_full_name (file_path);
+ m_priv->breakpoints[a_breakpoint.id ()] = a_breakpoint;
+ m_priv->breakpoints[a_breakpoint.id ()].file_full_name (file_path);
if (// We don't know how to graphically represent non-standard
// breakpoints (e.g watchpoints) at this moment, so let's not
@@ -7128,7 +7128,7 @@ DBGPerspective::delete_breakpoint ()
if ((bp = get_breakpoint (path, current_line)) == 0) {
return false;
}
- return delete_breakpoint (bp->number ());
+ return delete_breakpoint (bp->id ());
}
bool
@@ -7444,7 +7444,7 @@ DBGPerspective::delete_breakpoint (const UString &a_file_name,
if ((bp = get_breakpoint (a_file_name, a_line_num)) == 0)
return false;
- return delete_breakpoint (bp->number ());
+ return delete_breakpoint (bp->id ());
}
bool
@@ -7453,7 +7453,7 @@ DBGPerspective::delete_breakpoint (const Address &a_address)
const IDebugger::Breakpoint *bp;
if ((bp = get_breakpoint (a_address)) == 0)
return false;
- return delete_breakpoint (bp->number ());
+ return delete_breakpoint (bp->id ());
}
/// Return true if a breakpoint was set at a given location.
@@ -7611,7 +7611,7 @@ DBGPerspective::toggle_countpoint (const UString &a_file_path,
// countpoint. If yes, turn it into a normal
// breakpoint. Otherwise, turn it into a count point.
bool enable_cp = !debugger ()->is_countpoint (*bp);
- debugger ()->enable_countpoint (bp->number (), enable_cp);
+ debugger ()->enable_countpoint (bp->id (), enable_cp);
} else {
// No breakpoint is set on this line. Set a new countpoint.
set_breakpoint (a_file_path, a_linenum,
@@ -7635,7 +7635,7 @@ DBGPerspective::toggle_countpoint (const Address &a_address)
if (debugger ()->is_countpoint (*bp))
enable_cp = false;
- debugger ()->enable_countpoint (bp->number (), enable_cp);
+ debugger ()->enable_countpoint (bp->id (), enable_cp);
} else {
// No breakpoint is set on this line. Set a new countpoint.
set_breakpoint (a_address, /*is_count_point=*/true);
@@ -7993,7 +7993,7 @@ DBGPerspective::toggle_breakpoint_enabled (const UString &a_file_path,
const IDebugger::Breakpoint *bp;
if ((bp = get_breakpoint (a_file_path, a_line_num)) != 0)
- toggle_breakpoint_enabled (bp->number (), bp->enabled ());
+ toggle_breakpoint_enabled (bp->id (), bp->enabled ());
else {
LOG_DD ("breakpoint not set");
}
@@ -8006,7 +8006,7 @@ DBGPerspective::toggle_breakpoint_enabled (const Address &a)
const IDebugger::Breakpoint *bp;
if ((bp = get_breakpoint (a)) != 0)
- toggle_breakpoint_enabled (bp->number (), bp->enabled ());
+ toggle_breakpoint_enabled (bp->id (), bp->enabled ());
else
LOG_DD ("breakpoint not set");
}
diff --git a/tests/test-gdbmi.cc b/tests/test-gdbmi.cc
index 99db57e..2f48c44 100644
--- a/tests/test-gdbmi.cc
+++ b/tests/test-gdbmi.cc
@@ -864,7 +864,7 @@ test_breakpoint_table ()
std::map<string, IDebugger::Breakpoint>::const_iterator iter;
iter = breakpoints.find ("1");
BOOST_REQUIRE (iter != breakpoints.end ());
- BOOST_REQUIRE_EQUAL (iter->second.number (), "1");
+ BOOST_REQUIRE_EQUAL (iter->second.id (), "1");
BOOST_REQUIRE (iter->second.enabled ());
BOOST_REQUIRE_EQUAL (iter->second.address (), "0x08081566");
BOOST_REQUIRE_EQUAL (iter->second.function (), "main");
@@ -933,8 +933,8 @@ test_breakpoint ()
BOOST_REQUIRE (is_ok);
BOOST_REQUIRE (breakpoint.has_multiple_locations ());
BOOST_REQUIRE_EQUAL (breakpoint.sub_breakpoints ().size (), 2);
- BOOST_REQUIRE_EQUAL (breakpoint.sub_breakpoints ()[0].number (), "2.1");
- BOOST_REQUIRE_EQUAL (breakpoint.sub_breakpoints ()[1].number (), "2.2");
+ BOOST_REQUIRE_EQUAL (breakpoint.sub_breakpoints ()[0].id (), "2.1");
+ BOOST_REQUIRE_EQUAL (breakpoint.sub_breakpoints ()[1].id (), "2.2");
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]