[nemiver] 697992 - fail to restart a program wrapped in libtool shell script
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] 697992 - fail to restart a program wrapped in libtool shell script
- Date: Sun, 14 Apr 2013 13:05:42 +0000 (UTC)
commit 7d438d0d9ba14ad725572e2a520ed402028192b9
Author: Dodji Seketeli <dodji seketeli org>
Date: Sun Apr 14 14:35:51 2013 +0200
697992 - fail to restart a program wrapped in libtool shell script
* src/dbgengine/nmv-gdb-engine.cc (GDBEngine::load_program): When
asked about a forced re-load, always launch a new GDB. This
allows to re-ask libtool to launch the gdb for us, on libtool
wrapper scripts. Add logs for this case.
* src/persp/dbgperspective/nmv-dbg-perspective.cc
(DBGPerspective::Priv::last_prog_path_requested): New data member.
(DBGPerspective::restart_local_inferior): Re-launch a debugger
engine upon re-starts of a libtool wrapper. Make sure to ask the
restart on the libtool wrapper, not on the its underlying binary
that might have been wiped out by a re-build.
(DBGPerspective::execute_program): Likewise, make sure to ask the
restart on the libtool wrapper, not on the its underlying binary
that might have been wiped out by a re-build. Also, set the new
DBGPerspective::Priv::last_prog_path_requested data member to the
path to of the program which the user wants to debug.
src/dbgengine/nmv-gdb-engine.cc | 5 +++-
src/persp/dbgperspective/nmv-dbg-perspective.cc | 32 +++++++++++++++++++++----
2 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/src/dbgengine/nmv-gdb-engine.cc b/src/dbgengine/nmv-gdb-engine.cc
index 3286a12..7a05690 100644
--- a/src/dbgengine/nmv-gdb-engine.cc
+++ b/src/dbgengine/nmv-gdb-engine.cc
@@ -3195,7 +3195,10 @@ GDBEngine::load_program (const UString &a_prog,
THROW_IF_FAIL (!a_prog.empty ());
vector<UString> argv (a_argv);
- if (!m_priv->is_gdb_running ()) {
+ bool is_gdb_running = m_priv->is_gdb_running();
+ LOG_DD ("force: " << a_force << ", is_gdb_running: " << is_gdb_running);
+ if (a_force || !is_gdb_running) {
+ LOG_DD("Launching a fresh GDB");
vector<UString> gdb_opts;
// Read the tty attributes before we launch the target so that
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index bb9861d..d9760a9 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -53,6 +53,7 @@
#include "common/nmv-str-utils.h"
#include "common/nmv-address.h"
#include "common/nmv-loc.h"
+#include "common/nmv-proc-utils.h"
#include "nmv-sess-mgr.h"
#include "nmv-dbg-perspective.h"
#include "nmv-source-editor.h"
@@ -857,6 +858,15 @@ struct DBGPerspective::Priv {
// A Flag to know if the debugging
// engine died or not.
bool debugger_engine_alive;
+ // The path to the program the user requested a debugging session
+ // for.
+ UString last_prog_path_requested;
+ // The path to the binary that is actually being debugged. This
+ // can be different from last_prog_path_requested above, e.g, when
+ // the user asked to debug a libtool wrapper shell script. In
+ // that case, this data member eventually contains the path to the
+ // real underlying binary referred to by the libtool wrapper shell
+ // script.
UString prog_path;
vector<UString> prog_args;
UString prog_cwd;
@@ -5900,8 +5910,21 @@ DBGPerspective::restart_local_inferior ()
LOG_FUNCTION_SCOPE_NORMAL_DD;
THROW_IF_FAIL (!is_connected_to_remote_target ());
-
- if (debugger ()->is_attached_to_target ()
+
+ if (// If the program the user asked is a libtool wrapper shell
+ // script, then the real program we are debugging is at a
+ // different path from the (libtool shell script) path
+ // requested by the user. So we cannot just ask the debugger
+ // to re-run the binary it's current running, as libtool can
+ // have changed changed the path to the underlying real
+ // binary. This can happen, e.g, when the user re-compiled
+ // the program she is debugging and then asks for a re-start
+ // of the inferior in Nemiver. In that case, libtool might
+ // have changed the real binary path name.
+ !is_libtool_executable_wrapper(m_priv->last_prog_path_requested)
+ // If we are not attached to the target, there is not debugger
+ // engine to ask a re-run to ...
+ && debugger ()->is_attached_to_target ()
// Make sure we are restarting the program we were running
// right before. We need to make sure because the user can
// have changed the path to the inferior and ask for a
@@ -5914,7 +5937,7 @@ DBGPerspective::restart_local_inferior ()
(*this, &DBGPerspective::on_debugger_inferior_re_run_signal));
} else {
vector<IDebugger::Breakpoint> bps;
- execute_program (m_priv->prog_path, m_priv->prog_args,
+ execute_program (m_priv->last_prog_path_requested, m_priv->prog_args,
m_priv->env_variables, m_priv->prog_cwd,
bps,
true /* be aware we are restarting the same inferior*/,
@@ -6029,7 +6052,7 @@ DBGPerspective::execute_program
// In that case, we might want to keep things like breakpoints etc,
// around.
bool is_new_program = a_restarting
- ? (prog != m_priv->prog_path)
+ ? (prog != m_priv->last_prog_path_requested)
: true;
LOG_DD ("is new prog: " << is_new_program);
@@ -6097,6 +6120,7 @@ DBGPerspective::execute_program
if (a_break_in_main_run)
run_real (a_restarting);
+ m_priv->last_prog_path_requested = prog;
m_priv->prog_path = prog;
m_priv->prog_args = a_args;
m_priv->prog_cwd = a_cwd;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]