[nemiver] Don't die when the loaded program isn't found
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] Don't die when the loaded program isn't found
- Date: Wed, 13 Oct 2010 19:10:38 +0000 (UTC)
commit 61a4f3bbe51d82d5dc37cd0648c930510516bca1
Author: Dodji Seketeli <dodji seketeli org>
Date: Sun Oct 3 19:48:33 2010 +0200
Don't die when the loaded program isn't found
* src/dbgengine/nmv-i-debugger.h (IDebugger::load_program): Return
a boolean now.
* src/dbgengine/nmv-gdb-engine.h (GDBEngine::load_program):
Likewise.
* src/dbgengine/nmv-gdb-engine.cc (GDBEngine::load_program):
Return true upon successful completion, false otherwise. This is
now better than just throwing an exception at this point.
* src/persp/dbgperspective/nmv-dbg-perspective.cc
(DBGPerspective::execute_program): Display an error message when
we fail to load the program, instead of just passing up an
exception.
(DBGPerspective::connect_to_remote_target): Likewise.
src/dbgengine/nmv-gdb-engine.cc | 16 +++++++----
src/dbgengine/nmv-gdb-engine.h | 4 +-
src/dbgengine/nmv-i-debugger.h | 4 +-
src/persp/dbgperspective/nmv-dbg-perspective.cc | 31 +++++++++++++++++++---
4 files changed, 40 insertions(+), 15 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 0d5ad1a..9c30159 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -2643,7 +2643,7 @@ GDBEngine::~GDBEngine ()
LOG_D ("delete", "destructor-domain");
}
-void
+bool
GDBEngine::load_program (const UString &a_prog,
const vector<UString> &a_args,
const UString &a_working_dir)
@@ -2652,10 +2652,11 @@ GDBEngine::load_program (const UString &a_prog,
vector<UString> search_paths;
UString tty_path;
- load_program (a_prog, a_args, a_working_dir, search_paths, tty_path);
+ return load_program (a_prog, a_args, a_working_dir,
+ search_paths, tty_path);
}
-void
+bool
GDBEngine::load_program (const UString &a_prog,
const vector<UString> &a_argv,
const UString &working_dir,
@@ -2669,9 +2670,11 @@ GDBEngine::load_program (const UString &a_prog,
if (!m_priv->is_gdb_running ()) {
vector<UString> gdb_opts;
- THROW_IF_FAIL (m_priv->launch_gdb_and_set_args
- (working_dir, a_source_search_dirs,
- a_prog, a_argv, gdb_opts));
+ if (m_priv->launch_gdb_and_set_args (working_dir,
+ a_source_search_dirs,
+ a_prog, a_argv,
+ gdb_opts) == false)
+ return false;
Command command;
@@ -2711,6 +2714,7 @@ GDBEngine::load_program (const UString &a_prog,
}
}
set_tty_path (a_tty_path);
+ return true;
}
void
diff --git a/src/dbgengine/nmv-gdb-engine.h b/src/dbgengine/nmv-gdb-engine.h
index 6dadbd4..5a5c253 100644
--- a/src/dbgengine/nmv-gdb-engine.h
+++ b/src/dbgengine/nmv-gdb-engine.h
@@ -244,11 +244,11 @@ public:
const UString &a_value);
void set_solib_prefix_path (const UString &a_name);
- void load_program (const UString &a_prog,
+ bool load_program (const UString &a_prog,
const vector<UString> &a_args,
const UString &a_working_dir);
- void load_program (const UString &a_prog,
+ bool load_program (const UString &a_prog,
const vector<UString> &a_argv,
const UString &working_dir,
const vector<UString> &a_source_search_dirs,
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 7aaf073..5d11e6b 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -1017,11 +1017,11 @@ public:
virtual void set_solib_prefix_path (const UString &a_name) = 0;
- virtual void load_program (const UString &a_prog,
+ virtual bool load_program (const UString &a_prog,
const vector<UString> &a_args,
const UString &a_working_dir) = 0;
- virtual void load_program
+ virtual bool load_program
(const UString &a_prog,
const vector<UString> &a_argv,
const UString &working_dir,
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 1cc5144..76b7cef 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -6192,9 +6192,18 @@ DBGPerspective::execute_program
LOG_DD ("load program");
- // now really load the inferior program (i.e: the one to be debugged)
- dbg_engine->load_program (prog, a_args, a_cwd, source_search_dirs,
- get_terminal_name ());
+ // now really load the inferior program (i.e: the one to be
+ // debugged)
+
+ if (dbg_engine->load_program (prog, a_args, a_cwd,
+ source_search_dirs,
+ get_terminal_name ()) == false) {
+ UString message;
+ message.printf (_("Could not load program: %s"),
+ prog.c_str ());
+ display_error (message);
+ return;
+ }
m_priv->debugger_engine_alive = true;
@@ -6319,7 +6328,13 @@ DBGPerspective::connect_to_remote_target (const UString &a_server_address,
save_current_session ();
LOG_DD ("executable path: '" << a_prog_path << "'");
vector<UString> args;
- debugger ()->load_program (a_prog_path , args, ".");
+ if (debugger ()->load_program (a_prog_path , args, ".") == false) {
+ UString message;
+ message.printf (_("Could not load program: %s"),
+ a_prog_path.c_str ());
+ display_error (message);
+ return;
+ }
LOG_DD ("solib prefix path: '" << a_solib_prefix << "'");
debugger ()->set_solib_prefix_path (a_solib_prefix);
debugger ()->attach_to_remote_target (a_server_address,
@@ -6337,7 +6352,13 @@ DBGPerspective::connect_to_remote_target (const UString &a_serial_line,
save_current_session ();
LOG_DD ("executable path: '" << a_prog_path << "'");
vector<UString> args;
- debugger ()->load_program (a_prog_path , args, ".");
+ if (debugger ()->load_program (a_prog_path , args, ".") == false) {
+ UString message;
+ message.printf (_("Could not load program: %s"),
+ a_prog_path.c_str ());
+ display_error (message);
+ return;
+ }
LOG_DD ("solib prefix path: '" << a_solib_prefix << "'");
debugger ()->set_solib_prefix_path (a_solib_prefix);
debugger ()->attach_to_remote_target (a_serial_line);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]