[nemiver/breakpoint-signal-revamp: 2/2] Emit one IDebugger::breakpoint_set_signal per BP
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/breakpoint-signal-revamp: 2/2] Emit one IDebugger::breakpoint_set_signal per BP
- Date: Thu, 21 Apr 2011 17:27:11 +0000 (UTC)
commit 328b551dcb314e3403ee866e4f9cdb9b905ca8c4
Author: Dodji Seketeli <dodji gnome org>
Date: Thu Apr 21 19:17:52 2011 +0200
Emit one IDebugger::breakpoint_set_signal per BP
* src/dbgengine/nmv-i-debugger.h
(IDebugger::breakpoints_list_signal): Renamed
IDebugger::breakpoints_set_signal into this.
(IDebugger::breakpoint_set_signal): New interface.
* src/dbgengine/nmv-gdb-engine.h
(GDBEngine::breakpoints_list_signal): Renamed
GDBEngine::breakpoint_set_signal into this.
(GDBEngine::breakpoint_set_signal): New interface.
* src/dbgengine/nmv-gdb-engine.cc
(GDBEngine::breakpoints_list_signal): Renamed
GDBEngine::breakpoints_set_signal into this.
(GDBEngine::breakpoint_set_signal): New definition.
(OnBreakpointHandler::do_handle): Emit
IDebugger::breakpoint_set_signal whenever a breakpoint is set.
Avoid emitting IDebugger::breakpoints_list_signal when a
breakpoint is set.
* src/persp/dbgperspective/nmv-breakpoints-view.cc
(BreakpointView::Priv::Priv): Update for rename to
IDebugger::breakpoints_list_signal. Connect to the new
IDebugger::breakpoint_set_signal.
(BreakpointView::Priv::on_debugger_breakpoint_set_signal): New
definition.
* src/persp/dbgperspective/nmv-dbg-perspective.cc
(DBGPerspective::on_debugger_breakpoint_set_signal): New
definition.
(DBGPerspective::on_debugger_breakpoints_list_signal): Renamed
DBGPerspective::on_debugger_breakpoints_set_signal into this.
(DBGPerspective::append_breakpoint): Remove useless first
parameter from this.
(DBGPerspective::init_debugger_signals): Connect to the new
IDebugger::breakpoint_set_signal. Update for renaming into
IDebugger::breakpoints_list_signal.
* tests/test-breakpoint.cc (test_main): Update for renaming into
IDebugger::breakpoints_list_signal.
* tests/test-var-path-expr.cc (test_main): Likewise.
* tests/test-watchpoint.cc (test_main): Likewise.
src/dbgengine/nmv-gdb-engine.cc | 40 ++++++++++++++++++---
src/dbgengine/nmv-gdb-engine.h | 7 +++-
src/dbgengine/nmv-i-debugger.h | 7 +++-
src/persp/dbgperspective/nmv-breakpoints-view.cc | 26 +++++++++++---
src/persp/dbgperspective/nmv-dbg-perspective.cc | 34 ++++++++++++------
tests/test-breakpoint.cc | 2 +-
tests/test-var-path-expr.cc | 2 +-
tests/test-watchpoint.cc | 4 +-
8 files changed, 94 insertions(+), 28 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 5df2cfd..e7f24a8 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -158,7 +158,11 @@ public:
mutable sigc::signal<void,
const map<int, IDebugger::Breakpoint>&,
- const UString&> breakpoints_set_signal;
+ const UString&> breakpoints_list_signal;
+
+ mutable sigc::signal<void,
+ const std::pair<int, const IDebugger::Breakpoint&>&,
+ const UString& /*cookie*/> breakpoint_set_signal;
mutable sigc::signal<void,
const vector<OverloadsChoiceEntry>&,
@@ -1299,7 +1303,23 @@ struct OnBreakpointHandler: OutputHandler {
has_breaks = true;
}
- if (a_in.output ().has_result_record ()
+ if (has_breaks
+ && (a_in.command ().name () == "set-breakpoint"
+ || a_in.command ().name () == "set-countpoint")) {
+ // If we are getting this reply b/c we did set a
+ // breakpoint, then only one breakpoint should be reported
+ // back to us from GDB.
+ const map<int, IDebugger::Breakpoint> &bps =
+ a_in.output ().result_record ().breakpoints ();
+ THROW_IF_FAIL (bps.size () == 1);
+
+ std::pair<int,
+ const IDebugger::Breakpoint&> p (bps.begin ()->first,
+ bps.begin ()->second);
+ m_engine->breakpoint_set_signal ().emit (p,
+ a_in.command ().cookie ());
+ m_engine->set_state (IDebugger::READY);
+ } else if (a_in.output ().has_result_record ()
&& a_in.output ().result_record ().kind ()
== Output::ResultRecord::DONE
&& a_in.command ().value ().find ("-break-delete")
@@ -1330,7 +1350,7 @@ struct OnBreakpointHandler: OutputHandler {
}
} else if (has_breaks) {
LOG_DD ("firing IDebugger::breakpoint_set_signal()");
- m_engine->breakpoints_set_signal ().emit
+ m_engine->breakpoints_list_signal ().emit
(m_engine->get_cached_breakpoints (),
a_in.command ().cookie ());
m_engine->set_state (IDebugger::READY);
@@ -1591,7 +1611,7 @@ struct OnCommandDoneHandler : OutputHandler {
flag_breakpoint_as_countpoint (a_in.command ().tag2 (), false);
}
- m_engine->breakpoints_set_signal ().emit
+ m_engine->breakpoints_list_signal ().emit
(m_engine->get_cached_breakpoints (),
a_in.command ().cookie ());
}
@@ -3162,9 +3182,17 @@ GDBEngine::breakpoint_deleted_signal () const
}
sigc::signal<void, const map<int, IDebugger::Breakpoint>&, const UString&>&
-GDBEngine::breakpoints_set_signal () const
+GDBEngine::breakpoints_list_signal () const
+{
+ return m_priv->breakpoints_list_signal;
+}
+
+sigc::signal<void,
+ const std::pair<int, const IDebugger::Breakpoint&>&,
+ const UString& /*cookie*/>&
+GDBEngine::breakpoint_set_signal () const
{
- return m_priv->breakpoints_set_signal;
+ return m_priv->breakpoint_set_signal;
}
sigc::signal<void, const vector<IDebugger::OverloadsChoiceEntry>&, const UString&>&
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index 964a641..844c0d8 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -70,7 +70,12 @@ public:
sigc::signal<void>& detached_from_target_signal () const;
sigc::signal<void, const map<int, IDebugger::Breakpoint>&, const UString&>&
- breakpoints_set_signal () const;
+ breakpoints_list_signal () const;
+
+ sigc::signal<void,
+ const std::pair<int, const IDebugger::Breakpoint&>&,
+ const UString& /*cookie*/>&
+ breakpoint_set_signal () const;
sigc::signal<void, const vector<OverloadsChoiceEntry>&, const UString&>&
got_overloads_choice_signal () const;
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 55823a8..a6c0bb7 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -860,7 +860,12 @@ public:
virtual sigc::signal<void,
const map<int, IDebugger::Breakpoint>&,
const UString& /*cookie*/>&
- breakpoints_set_signal () const=0;
+ breakpoints_list_signal () const=0;
+
+ virtual sigc::signal<void,
+ const std::pair<int, const IDebugger::Breakpoint&>&,
+ const UString& /*cookie*/>&
+ breakpoint_set_signal () const = 0;
virtual sigc::signal<void,
const vector<OverloadsChoiceEntry>&,
diff --git a/src/persp/dbgperspective/nmv-breakpoints-view.cc b/src/persp/dbgperspective/nmv-breakpoints-view.cc
index 144dfdf..ec025ed 100644
--- a/src/persp/dbgperspective/nmv-breakpoints-view.cc
+++ b/src/persp/dbgperspective/nmv-breakpoints-view.cc
@@ -117,15 +117,15 @@ public:
{
init_actions ();
build_tree_view ();
- void set_breakpoints
- (const std::map<int, IDebugger::Breakpoint> &a_breakpoints);
// update breakpoint list when debugger indicates that the list of
// breakpoints has changed.
debugger->breakpoint_deleted_signal ().connect (sigc::mem_fun
(*this, &Priv::on_debugger_breakpoint_deleted_signal));
- debugger->breakpoints_set_signal ().connect (sigc::mem_fun
- (*this, &Priv::on_debugger_breakpoints_set_signal));
+ debugger->breakpoint_set_signal ().connect
+ (sigc::mem_fun (*this, &Priv::on_debugger_breakpoint_set_signal));
+ debugger->breakpoints_list_signal ().connect (sigc::mem_fun
+ (*this, &Priv::on_debugger_breakpoints_list_signal));
debugger->stopped_signal ().connect (sigc::mem_fun
(*this, &Priv::on_debugger_stopped_signal));
breakpoints_menu = load_menu ("breakpointspopup.xml",
@@ -534,7 +534,23 @@ public:
NEMIVER_CATCH
}
- bool on_breakpoints_view_button_press_signal (GdkEventButton *a_event)
+ void
+ on_debugger_breakpoint_set_signal
+ (const std::pair<int, const IDebugger::Breakpoint&> &a,
+ const UString &)
+ {
+ NEMIVER_TRY;
+
+ LOG_DD ("Adding breakpoint "
+ << a.second.number ());
+
+ append_breakpoint (a.second);
+
+ NEMIVER_CATCH;
+ }
+
+ bool
+ on_breakpoints_view_button_press_signal (GdkEventButton *a_event)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
bool handled = false;
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 288d86d..c11d62b 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -326,7 +326,10 @@ private:
void on_debugger_command_done_signal (const UString &a_command_name,
const UString &a_cookie);
- void on_debugger_breakpoints_set_signal
+ void on_debugger_breakpoint_set_signal
+ (const std::pair<int, const IDebugger::Breakpoint&>&, const UString&);
+
+ void on_debugger_breakpoints_list_signal
(const map<int, IDebugger::Breakpoint> &,
const UString &a_cookie);
@@ -609,8 +612,7 @@ public:
void set_breakpoint (const Address &a_address,
bool a_is_count_point);
void set_breakpoint (const IDebugger::Breakpoint &a_breakpoint);
- void append_breakpoint (int a_bp_num,
- const IDebugger::Breakpoint &a_breakpoint);
+ void append_breakpoint (const IDebugger::Breakpoint &a_breakpoint);
void append_breakpoints
(const map<int, IDebugger::Breakpoint> &a_breaks);
@@ -2521,7 +2523,15 @@ DBGPerspective::on_debugger_command_done_signal (const UString &a_command,
}
void
-DBGPerspective::on_debugger_breakpoints_set_signal
+DBGPerspective::on_debugger_breakpoint_set_signal
+(const std::pair<int, const IDebugger::Breakpoint&> &a,
+ const UString&)
+{
+ append_breakpoint (a.second);
+}
+
+void
+DBGPerspective::on_debugger_breakpoints_list_signal
(const map<int, IDebugger::Breakpoint> &a_breaks,
const UString &a_cookie)
{
@@ -4084,8 +4094,11 @@ DBGPerspective::init_debugger_signals ()
debugger ()->command_done_signal ().connect (sigc::mem_fun
(*this, &DBGPerspective::on_debugger_command_done_signal));
- debugger ()->breakpoints_set_signal ().connect (sigc::mem_fun
- (*this, &DBGPerspective::on_debugger_breakpoints_set_signal));
+ debugger ()->breakpoint_set_signal ().connect (sigc::mem_fun
+ (*this, &DBGPerspective::on_debugger_breakpoint_set_signal));
+
+ debugger ()->breakpoints_list_signal ().connect (sigc::mem_fun
+ (*this, &DBGPerspective::on_debugger_breakpoints_list_signal));
debugger ()->breakpoint_deleted_signal ().connect (sigc::mem_fun
(*this, &DBGPerspective::on_debugger_breakpoint_deleted_signal));
@@ -6799,8 +6812,7 @@ DBGPerspective::set_breakpoint (const IDebugger::Breakpoint &a_breakpoint)
}
void
-DBGPerspective::append_breakpoint (int a_bp_num,
- const IDebugger::Breakpoint &a_breakpoint)
+DBGPerspective::append_breakpoint (const IDebugger::Breakpoint &a_breakpoint)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
@@ -6815,8 +6827,8 @@ DBGPerspective::append_breakpoint (int a_bp_num,
file_path = a_breakpoint.file_name ();
}
- m_priv->breakpoints[a_bp_num] = a_breakpoint;
- m_priv->breakpoints[a_bp_num].file_full_name (file_path);
+ m_priv->breakpoints[a_breakpoint.number ()] = a_breakpoint;
+ m_priv->breakpoints[a_breakpoint.number ()].file_full_name (file_path);
// We don't know how to graphically represent non-standard
// breakpoints (e.g watchpoints) at this moment.
@@ -6879,7 +6891,7 @@ DBGPerspective::append_breakpoints
map<int, IDebugger::Breakpoint>::const_iterator iter;
for (iter = a_breaks.begin (); iter != a_breaks.end (); ++iter)
- append_breakpoint (iter->first, iter->second);
+ append_breakpoint (iter->second);
}
const IDebugger::Breakpoint*
diff --git a/tests/test-breakpoint.cc b/tests/test-breakpoint.cc
index 43d6b1e..ae96214 100644
--- a/tests/test-breakpoint.cc
+++ b/tests/test-breakpoint.cc
@@ -216,7 +216,7 @@ test_main (int argc, char *argv[])
debugger->command_done_signal ().connect (&on_command_done_signal);
- debugger->breakpoints_set_signal ().connect
+ debugger->breakpoints_list_signal ().connect
(&on_breakpoints_set_signal);
debugger->running_signal ().connect (&on_running_signal);
diff --git a/tests/test-var-path-expr.cc b/tests/test-var-path-expr.cc
index df84727..0d871be 100644
--- a/tests/test-var-path-expr.cc
+++ b/tests/test-var-path-expr.cc
@@ -132,7 +132,7 @@ test_main (int argc, char *argv[])
debugger->program_finished_signal ().connect
(&on_program_finished_signal);
- debugger->breakpoints_set_signal ().connect
+ debugger->breakpoints_list_signal ().connect
(&on_breakpoints_set_signal);
debugger->stopped_signal ().connect (sigc::bind (&on_stopped_signal,
diff --git a/tests/test-watchpoint.cc b/tests/test-watchpoint.cc
index 845c620..755650e 100644
--- a/tests/test-watchpoint.cc
+++ b/tests/test-watchpoint.cc
@@ -94,8 +94,8 @@ test_main (int, char **)
debugger->program_finished_signal ().connect
(&on_program_finished_signal);
- debugger->breakpoints_set_signal ().connect
- (&on_breakpoints_set_signal);
+ debugger->breakpoints_list_signal ().connect
+ (&on_breakpoints_set_signal);
debugger->stopped_signal ().connect
(sigc::bind (&on_stopped_signal, debugger));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]