nemiver r945 - in trunk: . src/common src/dbgengine tests
- From: jjongsma svn gnome org
- To: svn-commits-list gnome org
- Subject: nemiver r945 - in trunk: . src/common src/dbgengine tests
- Date: Tue, 18 Nov 2008 14:45:58 +0000 (UTC)
Author: jjongsma
Date: Tue Nov 18 14:45:57 2008
New Revision: 945
URL: http://svn.gnome.org/viewvc/nemiver?rev=945&view=rev
Log:
Handle libtool wrappers properly and when loading core files
* src/common/nmv-proc-utils.cc:
* src/common/nmv-proc-utils.h: don't attempt to parse and return the real
path of the executable, just examine the file and see if it looks like a
libtool wrapper script
* src/dbgengine/nmv-gdb-engine.cc: handle libtool wrapper scripts properly
by executing gdb under `libtool --mode=execute` which will set the library
path, etc for us as well instead of just executing gdb on the translated
binary filename. Also handle libtool wrappers when loading core files (bug
#554405)
* tests/test-libtool-wrapper-detection.cc: update test to match changed API
Modified:
trunk/ChangeLog
trunk/src/common/nmv-proc-utils.cc
trunk/src/common/nmv-proc-utils.h
trunk/src/dbgengine/nmv-gdb-engine.cc
trunk/tests/test-libtool-wrapper-detection.cc
Modified: trunk/src/common/nmv-proc-utils.cc
==============================================================================
--- trunk/src/common/nmv-proc-utils.cc (original)
+++ trunk/src/common/nmv-proc-utils.cc Tue Nov 18 14:45:57 2008
@@ -226,8 +226,7 @@
/// is set if and only the function returns true.
/// \return true if a_path is a libtool wrapper script, false otherwise.
bool
-is_libtool_executable_wrapper (const UString &a_path,
- UString &a_path_to_real_exec)
+is_libtool_executable_wrapper (const UString &a_path)
{
if (a_path.empty ()) {
return false;
@@ -267,18 +266,6 @@
LOG_ERROR ("got wrong magic string: " << str);
return false;
}
- str.clear ();
- //now go get the path that comes next.
- //that path is terminated normally by an '\n'
- while (true) {
- c = file.get ();
- if (file.eof () || c == '\n')
- break;
- else if (!file.good ())
- return false;
- str += c;
- }
- a_path_to_real_exec = Glib::filename_to_utf8 (str);
return true;
}
Modified: trunk/src/common/nmv-proc-utils.h
==============================================================================
--- trunk/src/common/nmv-proc-utils.h (original)
+++ trunk/src/common/nmv-proc-utils.h Tue Nov 18 14:45:57 2008
@@ -44,8 +44,7 @@
const Glib::RefPtr<Glib::IOChannel> &a_chan,
const Glib::RefPtr<Glib::MainContext>&a_ctxt) ;
-bool NEMIVER_API is_libtool_executable_wrapper (const UString &a_path,
- UString &a_path_to_real_exec);
+bool NEMIVER_API is_libtool_executable_wrapper (const UString &a_path);
}//end namspace common
}//end namespace nemiver
#endif //__NMV_PROC_UTILS_H__
Modified: trunk/src/dbgengine/nmv-gdb-engine.cc
==============================================================================
--- trunk/src/dbgengine/nmv-gdb-engine.cc (original)
+++ trunk/src/dbgengine/nmv-gdb-engine.cc Tue Nov 18 14:45:57 2008
@@ -545,6 +545,25 @@
kill_gdb ();
}
argv.clear ();
+
+ UString prog_path;
+ if (a_prog != "") {
+ prog_path = a_prog;
+ if (!Glib::file_test (Glib::locale_from_utf8 (prog_path),
+ Glib::FILE_TEST_IS_REGULAR)) {
+ if (!find_prog_in_path (prog_path, prog_path)) {
+ LOG_ERROR ("Could not find program '" << prog_path << "'");
+ return false;
+ }
+ }
+ }
+ // if the executable program to be debugged is a libtool wrapper script,
+ // run the debugging session under libtool
+ if (is_libtool_executable_wrapper (prog_path)) {
+ argv.push_back ("libtool");
+ argv.push_back ("--mode=execute");
+ }
+
THROW_IF_FAIL (get_debugger_full_path () != "");
argv.push_back (get_debugger_full_path ());
if (working_dir != "") {
@@ -558,17 +577,7 @@
argv.push_back (*it);
}
}
- if (a_prog != "") {
- UString prog_path = a_prog;
- if (!Glib::file_test (Glib::locale_from_utf8 (prog_path),
- Glib::FILE_TEST_IS_REGULAR)) {
- if (!find_prog_in_path (prog_path, prog_path)) {
- LOG_ERROR ("Could not find program '" << prog_path << "'");
- return false;
- }
- }
- argv.push_back (prog_path);
- }
+ argv.push_back (prog_path);
source_search_dirs = a_source_search_dirs;
return launch_gdb_real (argv);
@@ -609,6 +618,14 @@
const UString &a_core_path)
{
vector<UString> argv;
+
+ // if the executable program to be debugged is a libtool wrapper script,
+ // run the debugging session under libtool
+ if (is_libtool_executable_wrapper (a_prog_path)) {
+ argv.push_back ("libtool");
+ argv.push_back ("--mode=execute");
+ }
+
argv.push_back (env::get_gdb_program ());
argv.push_back ("--interpreter=mi2");
argv.push_back (a_prog_path);
@@ -2030,20 +2047,6 @@
THROW_IF_FAIL (!a_argv.empty ());
vector<UString> argv (a_argv);
- //first, check if the the inferior is a libtool wrapper or not.
- //if yes, bet the real path of the actual binary and use that instead
- UString real_path;
- if (is_libtool_executable_wrapper (argv[0], real_path)
- && !real_path.empty ()) {
- LOG_DD ("handling libtool wrapper script ...");
- string tmp_str = Glib::filename_from_utf8 (real_path);
- string dir_name = Glib::path_get_dirname
- (Glib::filename_to_utf8 (argv[0]));
- string path = Glib::build_filename (dir_name, tmp_str);
- argv[0] = Glib::filename_to_utf8 (path);
- LOG_DD ("got path to real binary from libtool wrapper: " << path);
- }
-
if (!m_priv->is_gdb_running ()) {
vector<UString> gdb_opts;
THROW_IF_FAIL (m_priv->launch_gdb_and_set_args
@@ -2096,8 +2099,6 @@
if (m_priv->is_gdb_running ()) {
m_priv->kill_gdb ();
}
-
- vector<UString> src_dirs, gdb_opts;
THROW_IF_FAIL (m_priv->launch_gdb_on_core_file (a_prog_path,
a_core_path));
}
Modified: trunk/tests/test-libtool-wrapper-detection.cc
==============================================================================
--- trunk/tests/test-libtool-wrapper-detection.cc (original)
+++ trunk/tests/test-libtool-wrapper-detection.cc Tue Nov 18 14:45:57 2008
@@ -12,8 +12,7 @@
test0 ()
{
UString real_path;
- BOOST_REQUIRE (is_libtool_executable_wrapper ("./fooprog", real_path));
- BOOST_REQUIRE (real_path == ".libs/fooprog");
+ BOOST_REQUIRE (is_libtool_executable_wrapper ("./fooprog"));
}
test_suite*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]