|
|
|
@ -9,6 +9,9 @@ |
|
|
|
|
@license LGPL, see file <a href="license.html">COPYING</a> |
|
|
|
|
|
|
|
|
|
$Log$ |
|
|
|
|
Revision 1.9 2004/10/13 10:47:15 marc |
|
|
|
|
no more need for ldd in StackTrace, read from /proc/self/maps |
|
|
|
|
|
|
|
|
|
Revision 1.8 2004/10/11 16:49:32 marc |
|
|
|
|
Better comment for new shared library feature |
|
|
|
|
|
|
|
|
@ -90,7 +93,6 @@ namespace mrw { |
|
|
|
|
- either a GNU glibc bases system (LINUX), or the GNU gcc compiler |
|
|
|
|
- a system with ELF binaries (LINUX, Solaris, ...) |
|
|
|
|
- debug information, compile option @c -g |
|
|
|
|
- it must be linked with @c -libery and @c -lbfd |
|
|
|
|
*/ |
|
|
|
|
//@{
|
|
|
|
|
|
|
|
|
@ -108,10 +110,8 @@ namespace mrw { |
|
|
|
|
once, before evaluating the first stack trace.Best place is the |
|
|
|
|
first line of the @c main function. |
|
|
|
|
|
|
|
|
|
@note This class requires libbfd an libiberty. Debug information |
|
|
|
|
is required for compiling. You nee the compile option @c -g, or |
|
|
|
|
even better @c -ggdb3. To link, you need @c -lmrw, @c -lbfd and |
|
|
|
|
@c -liberty. |
|
|
|
|
@note Debug information is required for compiling. You nee the |
|
|
|
|
compile option @c -g, or even better @c -ggdb3. |
|
|
|
|
|
|
|
|
|
@note The stack trace is known to work perfectly on Linux and |
|
|
|
|
Solaris both with GNU gcc compiler. But it should work with the |
|
|
|
@ -145,17 +145,43 @@ namespace mrw { |
|
|
|
|
|
|
|
|
|
Unfortunately it is not possible to extract the source file name |
|
|
|
|
and line number information if the executable was not compiled |
|
|
|
|
with debug option @c -g. But what's worse, it is not possible to |
|
|
|
|
ger symbolic information from libraries linked to the |
|
|
|
|
executable. Perhaps it could be possible, if I'd add a |
|
|
|
|
possibility to read and evaluate these libraries, but that's for |
|
|
|
|
a future release. (Now, 10/08/2004, I am working on it) |
|
|
|
|
|
|
|
|
|
@todo Add support to read debugging information from libraries |
|
|
|
|
that are linked to the executable. (soon) |
|
|
|
|
with debug option @c -g. |
|
|
|
|
|
|
|
|
|
@todo Add support for alternative symbol evaluation using @c |
|
|
|
|
backtrace_symbols. |
|
|
|
|
|
|
|
|
|
@bug File and line is wrong where the exception is thrown. On |
|
|
|
|
Address [0x4007830b] file and line is wrong, the file should be |
|
|
|
|
/privat/home/marc/pro/mrw-c++/mrw/exception.cpp. File and line |
|
|
|
|
are always wrong at the line where the exception is |
|
|
|
|
instanciated. Why?!? (Could it be, because there is a string |
|
|
|
|
created inline? The trace always shows basic_string.h.)
|
|
|
|
|
@code |
|
|
|
|
UNEXPECTED EXCEPTION: ---------------------------- |
|
|
|
|
---------- Reason: |
|
|
|
|
mrw::Exec: command execution failed |
|
|
|
|
failed command was: "/bin/false" |
|
|
|
|
error was: "execution failed" |
|
|
|
|
---------- Stack: |
|
|
|
|
1[0x8049b71] ../sysdeps/i386/elf/start.S:105 _start |
|
|
|
|
[0x4022f92b] ????:0 __libc_start_main |
|
|
|
|
[0x8049c96] /usr/include/g++/bits/basic_string.h:249 main |
|
|
|
|
[0x40054668] ????:0 CppUnit::TextUi::TestRunner::run(std::string, bool, bool, bool) |
|
|
|
|
[0x40054747] ????:0 CppUnit::TextUi::TestRunner::runTestByName(std::string, bool) |
|
|
|
|
[0x400543ec] ????:0 CppUnit::TextUi::TestRunner::runTest(CppUnit::Test*, bool) |
|
|
|
|
[0x4005525b] ????:0 CppUnit::TestSuite::run(CppUnit::TestResult*) |
|
|
|
|
[0x4005525b] ????:0 CppUnit::TestSuite::run(CppUnit::TestResult*) |
|
|
|
|
[0x4005525b] ????:0 CppUnit::TestSuite::run(CppUnit::TestResult*) |
|
|
|
|
[0x4004aa06] ????:0 CppUnit::TestCase::run(CppUnit::TestResult*) |
|
|
|
|
[0x804b164] /usr/include/cppunit/TestCaller.h:166 CppUnit::TestCaller<ExecTest, std::bad_exception>::runTest() |
|
|
|
|
[0x804b299] /usr/include/g++/bits/stl_alloc.h:652 ExecTest::unexpectedExc() |
|
|
|
|
[0x40078bda] /privat/home/marc/pro/mrw-c++/mrw/exec.cpp:77 mrw::Cmd::execute(bool) const |
|
|
|
|
[0x4007830b] /usr/include/g++/bits/basic_string.h:249 mrw::Exec::execute(bool) |
|
|
|
|
[0x40077941] /privat/home/marc/pro/mrw-c++/mrw/exec.cpp:38 mrw::ExecutionFailedExc::ExecutionFailedExc(std::string const&, std::string const&) |
|
|
|
|
[0x400769d4] /privat/home/marc/pro/mrw-c++/mrw/exception.cpp:41 mrw::exception::exception() |
|
|
|
|
[0x4007cbc5] /privat/home/marc/pro/mrw-c++/mrw/stacktrace.cpp:118 mrw::StackTrace::StackTrace() |
|
|
|
|
------------------------------------------------- |
|
|
|
|
@endcode |
|
|
|
|
*/ |
|
|
|
|
class StackTrace { |
|
|
|
|
public: |
|
|
|
@ -193,11 +219,10 @@ namespace mrw { |
|
|
|
|
/** @brief read the symbol table from the executable file or a
|
|
|
|
|
shared library |
|
|
|
|
|
|
|
|
|
On Solaris and Linux, the name of the executable is |
|
|
|
|
automatically detected through the @c /dev/proc file |
|
|
|
|
system. Only on Linux the shared libraries are detected |
|
|
|
|
through a call to @c ldd. So you may leave the parameter |
|
|
|
|
empty on these systems. |
|
|
|
|
On Solaris and Linux, the executable is automatically |
|
|
|
|
detected through the @c /proc file system. Only on Linux the |
|
|
|
|
shared libraries are detected through @c /proc/self/maps. So |
|
|
|
|
you may leave the parameter empty on these systems. |
|
|
|
|
|
|
|
|
|
@param fname The file name of the executable or a shared |
|
|
|
|
library. On Linux and Solaris, this can be evaluated |
|
|
|
|