[nemiver/jump-to: 3/3] 560235 Initial support of "jump to"
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/jump-to: 3/3] 560235 Initial support of "jump to"
- Date: Fri, 22 Apr 2011 21:46:21 +0000 (UTC)
commit 651fdfd105b7489926a564100ce40b6ab4b3ec52
Author: Dodji Seketeli <dodji seketeli org>
Date: Thu Apr 21 22:22:36 2011 +0200
560235 Initial support of "jump to"
* src/dbgengine/nmv-i-debugger.h (IDebugger::jump_to_position):
New entry point.
(IDebugger::set_breakpoint, IDebugger::enable_breakpoint): New
overloads taking callback slots.
* src/dbgengine/nmv-gdb-engine.h (GDBEngine::jump_to_position)
(GDBEngine::enable_breakpoint): Declare these functions.
* src/dbgengine/nmv-gdb-engine.cc
(OnBreakpointHandler::do_handle): Support callback slots for
'-break-enable' and 'jump-to-position'.
(GDBEngine::jump_to_position): Define new function.
(GDBEngine::enable_breakpoint): Likewise. Rewrite the other
overload in terms of this one.
* src/persp/dbgperspective/nmv-dbg-perspective.cc
(DBGPerspective::on_jump_to_current_location_action)
(DBGPerspective::on_jump_and_break_to_current_location_action)
(DBGPerspective::on_break_before_jump)
(DBGPerspective::do_jump_to_current_location)
(DBGPerspective::do_jump_and_break_to_current_location)
(DBGPerspective::jump_to_location): New functions.
(DBGPerspective::on_debugger_breakpoints_set_signal): Minor style
cleanup.
(DBGPerspective::init_actions): Add
JumpToCurrentLocationMenuItemAction and
JumpAndBreakToCurrentLocationMenuItemAction actions.
(DBGPerspective::get_contextual_menu): Add two new menu items for
actions JumpToCurrentLocationMenuItemAction and
JumpAndBreakToCurrentLocationMenuItemAction.
src/dbgengine/nmv-gdb-engine.cc | 80 ++++++-
src/dbgengine/nmv-gdb-engine.h | 7 +
src/dbgengine/nmv-i-debugger.h | 13 +
src/persp/dbgperspective/nmv-dbg-perspective.cc | 180 +++++++++++++-
src/persp/dbgperspective/nmv-set-jump-to-dialog.cc | 257 ++++++++++++++++++
src/persp/dbgperspective/nmv-set-jump-to-dialog.h | 57 ++++
src/persp/dbgperspective/ui/setjumptodialog.ui | 278 ++++++++++++++++++++
7 files changed, 863 insertions(+), 9 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 8cdc886..f123574 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -1726,6 +1726,13 @@ struct OnCommandDoneHandler : OutputHandler {
}
}
+ if (a_in.command ().name () == "-break-enable"
+ && a_in.command ().has_slot ()) {
+ IDebugger::BreakpointsSlot slot =
+ a_in.command ().get_slot<IDebugger::BreakpointsSlot> ();
+ slot (m_engine->get_cached_breakpoints ());
+ }
+
// So, if we are still attached to the target and we receive
// a "DONE" response from GDB, it means we are READY.
// But if we are not attached -- which can mean that the
@@ -1764,7 +1771,13 @@ struct OnRunningHandler : OutputHandler {
void do_handle (CommandAndOutput &a_in)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
- if (a_in.has_command ()) {}
+
+ Command &c = a_in.command ();
+ if (c.name () == "jump-to-position"
+ && c.has_slot ()) {
+ IDebugger::DefaultSlot s = c.get_slot<IDebugger::DefaultSlot> ();
+ s ();
+ }
m_engine->running_signal ().emit ();
}
};//struct OnRunningHandler
@@ -3898,6 +3911,30 @@ GDBEngine::continue_to_position (const UString &a_path,
a_cookie));
}
+/// Jump to a location in the inferior.
+///
+/// Execution is then resumed from the new location.
+///
+/// \param a_loc the location to jump to
+///
+/// \param a_slot a callback function that is invoked once the jump is
+/// done.
+void
+GDBEngine::jump_to_position (const Loc &a_loc,
+ const DefaultSlot &a_slot)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ UString location;
+
+ location_to_string (a_loc, location);
+
+ Command command ("jump-to-position",
+ "-exec-jump " + location);
+ command.set_slot (a_slot);
+ queue_command (command);
+}
+
/// Set a breakpoint at a location in the inferior.
///
/// \param a_loc the location of the breakpoint.
@@ -4012,18 +4049,51 @@ GDBEngine::set_breakpoint (const Address &a_address,
queue_command (Command (cmd_name, break_cmd, a_cookie));
}
+/// Enable a given breakpoint
+///
+/// \param a_break_num the ID of the breakpoint to enable.
+///
+/// \param a_slot a callback slot invoked upon completion of the
+/// command by GDB.
+///
+/// \param a_cookie a string passed as an argument to
+/// IDebugger::breakpoints_set_signal upon completion of the command
+/// by GDB. Note that both a_slot and
+/// IDebugger::breakpoints_set_signal are invoked upon completion of
+/// the command by GDB for now. Eventually only a_slot will be kept;
+/// IDebugger::breakpoints_set_signal will be dropped. We in a
+/// transitional period at the moment.
void
GDBEngine::enable_breakpoint (gint a_break_num,
+ const BreakpointsSlot &a_slot,
const UString &a_cookie)
{
LOG_FUNCTION_SCOPE_NORMAL_DD;
- queue_command (Command ("enable-breakpoint",
- "-break-enable "
- + UString::from_int (a_break_num),
- a_cookie));
+
+ Command command ("enable-breakpoint",
+ "-break-enable "
+ + UString::from_int (a_break_num));
+ command.set_slot (a_slot);
+ queue_command (command);
list_breakpoints (a_cookie);
}
+/// Enable a given breakpoint
+///
+/// \param a_break_num the ID of the breakpoint to enable.
+///
+/// \param a_cookie a string passed as an argument to
+/// IDebugger::breakpoints_set_signal upon completion of the command
+/// by GDB. Eventually this function should be dropped and we should
+/// keep the one above.
+void
+GDBEngine::enable_breakpoint (gint a_break_num,
+ const UString &a_cookie)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+ enable_breakpoint (a_break_num, &null_breakpoints_slot, a_cookie);
+}
+
void
GDBEngine::disable_breakpoint (gint a_break_num,
const UString &a_cookie)
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index f907081..980b61a 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -333,6 +333,9 @@ public:
gint a_line_num,
const UString &a_cookie) ;
+ void jump_to_position (const Loc &a_loc,
+ const DefaultSlot &a_slot);
+
void set_breakpoint (const Loc &a_loc,
const UString &a_condition,
gint a_ignore_count,
@@ -356,6 +359,10 @@ public:
const UString &a_cookie);
void enable_breakpoint (gint a_break_num,
+ const BreakpointsSlot &a_slot,
+ const UString &a_cookie = "");
+
+ void enable_breakpoint (gint a_break_num,
const UString &a_cookie="");
void disable_breakpoint (gint a_break_num,
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index a2dbac9..b375798 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -822,9 +822,15 @@ public:
}
typedef sigc::slot<void> DefaultSlot;
+
typedef sigc::slot<void,
const std::pair<int, const IDebugger::Breakpoint&>&>
BreakpointSlot;
+
+ typedef sigc::slot<void,
+ const std::map<int, IDebugger::Breakpoint>&>
+ BreakpointsSlot;
+
typedef sigc::slot<void, Loc&> LocSlot;
virtual ~IDebugger () {}
@@ -1128,6 +1134,9 @@ public:
gint a_line_num,
const UString &a_cookie="") = 0;
+ virtual void jump_to_position (const Loc &a_loc,
+ const DefaultSlot &a_slot) = 0;
+
virtual void set_breakpoint (const common::Loc &a_loc,
const UString &a_condition,
gint a_ignore_count,
@@ -1151,6 +1160,10 @@ public:
const UString &a_cookie = "") = 0;
virtual void enable_breakpoint (gint a_break_num,
+ const BreakpointsSlot &a_slot,
+ const UString &a_cookie="") = 0;
+
+ virtual void enable_breakpoint (gint a_break_num,
const UString &a_cookie="") = 0;
virtual void disable_breakpoint (gint a_break_num,
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 0b27e98..8458e29 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -64,6 +64,7 @@
#include "common/nmv-date-utils.h"
#include "common/nmv-str-utils.h"
#include "common/nmv-address.h"
+#include "common/nmv-loc.h"
#include "nmv-sess-mgr.h"
#include "nmv-dbg-perspective.h"
#include "nmv-source-editor.h"
@@ -102,6 +103,7 @@
using namespace std;
using namespace nemiver::common;
+using namespace nemiver::debugger_utils;
using namespace nemiver::ui_utils;
using namespace gtksourceview;
@@ -236,6 +238,11 @@ private:
void on_step_over_asm_action ();
void on_continue_action ();
void on_continue_until_action ();
+ void on_jump_to_current_location_action ();
+ void on_jump_and_break_to_current_location_action ();
+ void on_break_before_jump (const std::pair<int,
+ const IDebugger::Breakpoint&>&,
+ const Loc &a_loc);
void on_set_breakpoint_action ();
void on_set_breakpoint_using_dialog_action ();
void on_set_watchpoint_using_dialog_action ();
@@ -600,6 +607,9 @@ public:
void step_over_asm ();
void do_continue ();
void do_continue_until ();
+ void do_jump_to_current_location ();
+ void do_jump_and_break_to_current_location ();
+ void jump_to_location (const map<int, IDebugger::Breakpoint>&, const SourceLoc &);
void set_breakpoint_at_current_line_using_dialog ();
void set_breakpoint ();
void set_breakpoint (const UString &a_file,
@@ -1010,7 +1020,6 @@ struct DBGPerspective::Priv {
list<UString> call_expr_history;
list<UString> var_inspector_dialog_history;
-
Priv () :
initialized (false),
reused_session (false),
@@ -1546,6 +1555,58 @@ DBGPerspective::on_continue_until_action ()
NEMIVER_CATCH
}
+/// Callback function invoked when the menu item action "jump to
+/// current location" is activated.
+///
+/// It jumps to the location selected by the user in the source
+/// editor.
+void
+DBGPerspective::on_jump_to_current_location_action ()
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+ do_jump_to_current_location ();
+ NEMIVER_CATCH
+}
+
+/// Callback function invoked when the menu item action "setting a
+/// breakpoint to current lcoation and jump here" is activated.
+///
+/// It sets a breakpoint to the current location and jumps here. So
+/// is transfered to the location selected by the user in the source
+/// editor and is stopped there.
+void
+DBGPerspective::on_jump_and_break_to_current_location_action ()
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY
+ do_jump_and_break_to_current_location ();
+ NEMIVER_CATCH
+}
+
+/// This callback is invoked right after a breakpoint is set as part
+/// of a "set a breakpoint and jump there" process.
+///
+/// So this function jumps to the position given in parameter.
+///
+/// \param a_loc the location to jump to. This is also the location
+/// of the breakpoint that was set previously and which triggered this
+/// callback.
+void
+DBGPerspective::on_break_before_jump
+(const std::pair<int,
+ const IDebugger::Breakpoint&> &,
+ const Loc &a_loc)
+{
+ LOG_FUNCTION_SCOPE_NORMAL_DD;
+
+ NEMIVER_TRY;
+ debugger ()->jump_to_position (a_loc, &null_default_slot);
+ NEMIVER_CATCH;
+}
+
void
DBGPerspective::on_toggle_breakpoint_action ()
{
@@ -2520,6 +2581,13 @@ DBGPerspective::on_debugger_command_done_signal (const UString &a_command,
NEMIVER_CATCH
}
+/// Callback function invoked once a breakpoint was set.
+///
+/// \param a_breaks the list of all breakpoints currently set in the inferior.
+///
+/// \param a_cookie a string passed to the IDebugger::set_breakpoint
+/// call that triggered this callback.
+///
void
DBGPerspective::on_debugger_breakpoint_set_signal
(const std::pair<int, const IDebugger::Breakpoint&> &a,
@@ -2542,9 +2610,9 @@ DBGPerspective::on_debugger_breakpoints_list_signal
// When the breakpoint is set, it
// will send a 'cookie' along of the form
// "initiallly-disabled#filename.cc#123"
- if (a_cookie.find("initially-disabled") != UString::npos) {
- UString::size_type start_of_file = a_cookie.find('#') + 1;
- UString::size_type start_of_line = a_cookie.rfind('#') + 1;
+ if (a_cookie.find ("initially-disabled") != UString::npos) {
+ UString::size_type start_of_file = a_cookie.find ('#') + 1;
+ UString::size_type start_of_line = a_cookie.rfind ('#') + 1;
UString file = a_cookie.substr (start_of_file,
(start_of_line - 1) - start_of_file);
int line = atoi
@@ -3401,6 +3469,27 @@ DBGPerspective::init_actions ()
false
},
{
+ "JumpToCurrentLocationMenuItemAction",
+ nil_stock_id,
+ _("Jump to cursor"),
+ _("Jump to the currently selected line"),
+ sigc::mem_fun (*this, &DBGPerspective::on_jump_to_current_location_action),
+ ActionEntry::DEFAULT,
+ "",
+ false
+ },
+ {
+ "JumpAndBreakToCurrentLocationMenuItemAction",
+ nil_stock_id,
+ _("Jump and stop to cursor"),
+ _("Sets a breakpoint to the current currently selected line and jump there"),
+ sigc::mem_fun (*this,
+ &DBGPerspective::on_jump_and_break_to_current_location_action),
+ ActionEntry::DEFAULT,
+ "",
+ false
+ },
+ {
"ToggleBreakpointMenuItemAction",
nil_stock_id,
// Depending on the context we will want this string to be
@@ -4776,6 +4865,22 @@ DBGPerspective::get_contextual_menu ()
workbench ().get_ui_manager ()->add_ui
(m_priv->contextual_menu_merge_id,
"/ContextualMenu",
+ "JumpToCurrentLocationMenuItem",
+ "JumpToCurrentLocationMenuItemAction",
+ Gtk::UI_MANAGER_AUTO,
+ false);
+
+ workbench ().get_ui_manager ()->add_ui
+ (m_priv->contextual_menu_merge_id,
+ "/ContextualMenu",
+ "JumpAndBreakToCurrentLocationMenuItem",
+ "JumpAndBreakToCurrentLocationMenuItemAction",
+ Gtk::UI_MANAGER_AUTO,
+ false);
+
+ workbench ().get_ui_manager ()->add_ui
+ (m_priv->contextual_menu_merge_id,
+ "/ContextualMenu",
"StopMenuItem",
"StopMenuItemAction",
Gtk::UI_MANAGER_AUTO,
@@ -6711,6 +6816,73 @@ DBGPerspective::do_continue_until ()
debugger ()->continue_to_position (file_path, current_line);
}
+/// Jump (transfer execution of the inferior) to the location selected
+/// by the user in the source editor.
+void
+DBGPerspective::do_jump_to_current_location ()
+{
+ SourceEditor *editor = get_current_source_editor ();
+ THROW_IF_FAIL (editor);
+
+ int current_line = editor->current_line ();
+ UString file_path;
+ editor->get_file_name (file_path);
+ SourceLoc loc (file_path, current_line);
+ debugger ()->jump_to_position (loc, &null_default_slot);
+}
+
+/// Set a breakpoint to the location selected by the user in the
+/// source editor and jump (transfer execution of the inferior) there.
+void
+DBGPerspective::do_jump_and_break_to_current_location ()
+{
+ THROW_IF_FAIL (m_priv);
+ SourceEditor *editor = get_current_source_editor ();
+ THROW_IF_FAIL (editor);
+
+ int current_line = editor->current_line ();
+ UString file_path;
+ editor->get_file_name (file_path);
+
+ SourceLoc loc (file_path, current_line);
+ bool bp_enabled = false;
+ if (is_breakpoint_set_at_line (file_path,
+ current_line,
+ bp_enabled)) {
+ if (bp_enabled) {
+ debugger ()->jump_to_position (loc, &null_default_slot);
+ } else {
+ const IDebugger::Breakpoint *bp =
+ get_breakpoint (file_path, current_line);
+ debugger ()->enable_breakpoint
+ (bp->number (),
+ sigc::bind
+ (sigc::mem_fun
+ (*this,
+ &DBGPerspective::jump_to_location),
+ loc));
+ }
+ } else {
+ debugger ()->set_breakpoint (loc,
+ /*a_condition=*/"",/*a_ignore_count=*/0,
+ sigc::bind
+ (sigc::mem_fun
+ (*this,
+ &DBGPerspective::on_break_before_jump),
+ loc));
+ }
+}
+
+/// Jump (transfert execution of the inferior) to a given source
+/// location. This is a callback for the
+/// IDebugger::breakpoint_set_signal signal.
+void
+DBGPerspective::jump_to_location (const map<int, IDebugger::Breakpoint>&,
+ const SourceLoc &a_loc)
+{
+ debugger ()->jump_to_position (a_loc, &null_default_slot);
+}
+
void
DBGPerspective::set_breakpoint ()
{
diff --git a/src/persp/dbgperspective/nmv-set-jump-to-dialog.cc b/src/persp/dbgperspective/nmv-set-jump-to-dialog.cc
new file mode 100644
index 0000000..e613766
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-set-jump-to-dialog.cc
@@ -0,0 +1,257 @@
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+#include <glib/gi18n.h>
+#include <sstream>
+#include "common/nmv-loc.h"
+#include "nmv-set-jump-to-dialog.h"
+#include "nmv-ui-utils.h"
+
+
+using namespace nemiver::common;
+using namespace nemiver::ui_utils;
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+class SetJumpToDialog::Priv
+{
+public:
+ Gtk::Entry *entry_function;
+ Gtk::Entry *entry_filename;
+ Gtk::Entry *entry_line;
+ Gtk::Entry *entry_address;
+ Gtk::RadioButton *radio_function_name;
+ Gtk::RadioButton *radio_source_location;
+ Gtk::RadioButton *radio_binary_location;
+ Gtk::CheckButton *check_break_at_destination;
+
+ enum Mode
+ {
+ MODE_UNDEFINED = 0,
+ MODE_FUNCTION_NAME_LOCATION,
+ MODE_SOURCE_LOCATION,
+ MODE_BINARY_LOCATION
+ };
+
+ Priv (Gtk::Dialog &a_dialog,
+ const Glib::RefPtr<Gtk::Builder> &a_builder)
+ : entry_function (0),
+ entry_filename (0),
+ entry_line (0),
+ entry_address (0),
+ radio_function_name (0),
+ radio_source_location (0),
+ radio_binary_location (0),
+ check_break_at_destination (0)
+ {
+ a_dialog.set_default_response (Gtk::RESPONSE_OK);
+
+ entry_function =
+ get_widget_from_gtkbuilder<Gtk::Entry> (a_builder,
+ "functionentry");
+ THROW_IF_FAIL (entry_function);
+
+ entry_filename =
+ get_widget_from_gtkbuilder<Gtk::Entry> (a_builder,
+ "filenameentry");
+ THROW_IF_FAIL (entry_filename);
+
+ entry_line =
+ get_widget_from_gtkbuilder<Gtk::Entry> (a_builder,
+ "lineentry");
+ THROW_IF_FAIL (entry_line);
+
+ entry_address =
+ get_widget_from_gtkbuilder<Gtk::Entry> (a_builder,
+ "addressentry");
+ THROW_IF_FAIL (entry_address);
+
+ radio_function_name =
+ get_widget_from_gtkbuilder<Gtk::RadioButton>
+ (a_builder, "functionnameradio");
+ THROW_IF_FAIL (radio_function_name);
+
+ radio_source_location =
+ get_widget_from_gtkbuilder<Gtk::RadioButton>
+ (a_builder, "sourcelocationradio");
+ THROW_IF_FAIL (radio_source_location);
+
+ radio_binary_location =
+ get_widget_from_gtkbuilder<Gtk::RadioButton>
+ (a_builder, "binarylocationradio");
+ THROW_IF_FAIL (radio_binary_location);
+
+ check_break_at_destination =
+ get_widget_from_gtkbuilder<Gtk::CheckButton>
+ (a_builder, "breakatdestinationcheck");
+ THROW_IF_FAIL (check_break_at_destination);
+ }
+
+ Mode
+ mode () const
+ {
+ if (radio_function_name->get_active ())
+ return MODE_FUNCTION_NAME_LOCATION;
+ else if (radio_source_location->get_active ())
+ return MODE_SOURCE_LOCATION;
+ else if (radio_binary_location->get_active ())
+ return MODE_BINARY_LOCATION;
+ else
+ return MODE_UNDEFINED;
+ }
+
+ void
+ mode (Mode a_mode)
+ {
+ switch (a_mode) {
+ case MODE_UNDEFINED:
+ THROW ("Unreachable code reached");
+ break;
+ case MODE_FUNCTION_NAME_LOCATION:
+ radio_function_name->set_active ();
+ break;
+ case MODE_SOURCE_LOCATION:
+ radio_source_location->set_active ();
+ break;
+ case MODE_BINARY_LOCATION:
+ radio_source_location->set_active ();
+ break;
+ }
+ }
+
+ Loc*
+ get_location () const
+ {
+ const Mode m = mode ();
+ switch (m) {
+ case MODE_UNDEFINED:
+ THROW ("Unreachable code reached");
+ break;
+ case MODE_FUNCTION_NAME_LOCATION: {
+ FunctionLoc *loc =
+ new FunctionLoc (entry_function->get_text ());
+ return loc;
+ }
+ case MODE_SOURCE_LOCATION: {
+ SourceLoc *loc =
+ new SourceLoc (entry_filename->get_text (),
+ atoi (entry_line->get_text ().c_str ()));
+ return loc;
+ }
+ case MODE_BINARY_LOCATION: {
+ Address a (entry_function->get_text ());
+ AddressLoc *loc = new AddressLoc (a);
+ return loc;
+ }
+ } // end case
+
+ // Should not be reached.
+ return 0;
+ }
+
+ void
+ set_location (const Loc &a_loc)
+ {
+ switch (a_loc.kind ()) {
+ case Loc::UNDEFINED_LOC_KIND:
+ break;
+ case Loc::SOURCE_LOC_KIND: {
+ const SourceLoc &loc = static_cast<const SourceLoc&> (a_loc);
+ mode (MODE_SOURCE_LOCATION);
+ entry_filename->set_text (loc.file_path ());
+ std::ostringstream o;
+ o << loc.line_number ();
+ entry_line->set_text (o.str ());
+ }
+ break;
+ case Loc::FUNCTION_LOC_KIND: {
+ const FunctionLoc &loc = static_cast<const FunctionLoc&> (a_loc);
+ mode (MODE_FUNCTION_NAME_LOCATION);
+ entry_function->set_text (loc.function_name ());
+ }
+ break;
+ case Loc::ADDRESS_LOC_KIND: {
+ const AddressLoc &loc = static_cast<const AddressLoc&> (a_loc);
+ mode (MODE_BINARY_LOCATION);
+ std::ostringstream o;
+ o << loc.address ();
+ entry_address->set_text (o.str ());
+ }
+ break;
+ }
+ }
+
+ void
+ set_break_at_location (bool a)
+ {
+ check_break_at_destination->set_active (a);
+ }
+
+ bool
+ get_break_at_location () const
+ {
+ return check_break_at_destination->get_active ();
+ }
+
+};// end class SetJumpToDialog::Priv
+
+SetJumpToDialog::SetJumpToDialog (const UString &a_root_path)
+ : Dialog (a_root_path, "setjumptodialog.ui", "setjumptodialog")
+{
+ m_priv.reset (new Priv (widget (), gtkbuilder ()));
+}
+
+SetJumpToDialog::~SetJumpToDialog ()
+{
+}
+
+const Loc*
+SetJumpToDialog::get_location () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->get_location ();
+}
+
+void
+SetJumpToDialog::set_location (const Loc &a_loc)
+{
+ THROW_IF_FAIL (m_priv);
+
+ m_priv->set_location (a_loc);
+}
+
+void
+SetJumpToDialog::set_break_at_location (bool a)
+{
+ THROW_IF_FAIL (m_priv);
+ m_priv->set_break_at_location (a);
+}
+
+bool
+SetJumpToDialog::get_break_at_location () const
+{
+ THROW_IF_FAIL (m_priv);
+ return m_priv->get_break_at_location ();
+}
+
+NEMIVER_END_NAMESPACE (nemiver)
diff --git a/src/persp/dbgperspective/nmv-set-jump-to-dialog.h b/src/persp/dbgperspective/nmv-set-jump-to-dialog.h
new file mode 100644
index 0000000..a5b627f
--- /dev/null
+++ b/src/persp/dbgperspective/nmv-set-jump-to-dialog.h
@@ -0,0 +1,57 @@
+//Author: Dodji Seketeli
+/*
+ *This file is part of the Nemiver project
+ *
+ *Nemiver is free software; you can redistribute
+ *it and/or modify it under the terms of
+ *the GNU General Public License as published by the
+ *Free Software Foundation; either version 2,
+ *or (at your option) any later version.
+ *
+ *Nemiver is distributed in the hope that it will
+ *be useful, but WITHOUT ANY WARRANTY;
+ *without even the implied warranty of
+ *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *See the GNU General Public License for more details.
+ *
+ *You should have received a copy of the
+ *GNU General Public License along with Nemiver;
+ *see the file COPYING.
+ *If not, write to the Free Software Foundation,
+ *Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *See COPYRIGHT file copyright information.
+ */
+
+#ifndef __NEMIVER_SET_JUMP_TO_DIALOG_H__
+#define __NEMIVER_SET_JUMP_TO_DIALOG_H__
+
+#include "common/nmv-safe-ptr-utils.h"
+#include "nmv-dialog.h"
+
+NEMIVER_BEGIN_NAMESPACE (nemiver)
+
+namespace common {
+ class UString;
+ class Loc;
+}
+
+class SetJumpToDialog : public Dialog
+{
+ class Priv;
+ SafePtr<Priv> m_priv;
+
+ public:
+
+ SetJumpToDialog (const UString &a_resource_root_path);
+ virtual ~SetJumpToDialog ();
+
+ const common::Loc* get_location () const;
+ void set_location (const common::Loc&);
+ void set_break_at_location (bool);
+ bool get_break_at_location () const;
+};
+
+NEMIVER_END_NAMESPACE (nemiver)
+
+#endif // __NEMIVER_JUMP_TO_DIALOG_H__
diff --git a/src/persp/dbgperspective/ui/setjumptodialog.ui b/src/persp/dbgperspective/ui/setjumptodialog.ui
new file mode 100644
index 0000000..6e5b03b
--- /dev/null
+++ b/src/persp/dbgperspective/ui/setjumptodialog.ui
@@ -0,0 +1,278 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkDialog" id="setjumptodialog">
+ <property name="border_width">5</property>
+ <property name="default_width">299</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes"><b>Jump to location:</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">8</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkRadioButton" id="functionnameradio">
+ <property name="label" translatable="yes">F_unction Name:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="sourcelocationradio">
+ <property name="label" translatable="yes">_Source Location:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">functionnameradio</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="binarylocationradio">
+ <property name="label" translatable="yes">_Binary Location:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">functionnameradio</property>
+ </object>
+ <packing>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Function:</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">File name:</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Line:</property>
+ </object>
+ <packing>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Address:</property>
+ </object>
+ <packing>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="functionentry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="filenameentry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="lineentry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="addressentry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="breakatdestinationcheck">
+ <property name="label" translatable="yes">Break at destination</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancelbutton">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="okbutton">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">cancelbutton</action-widget>
+ <action-widget response="-5">okbutton</action-widget>
+ </action-widgets>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]