diff --git a/mrw/stacktrace.cpp b/mrw/stacktrace.cpp
index 456530d..047b29a 100644
--- a/mrw/stacktrace.cpp
+++ b/mrw/stacktrace.cpp
@@ -9,6 +9,10 @@
@license LGPL, see file COPYING
$Log$
+ Revision 1.5 2004/10/07 16:59:12 marc
+ new method createSymtable that takes a list of arguments
+ -> untested!
+
Revision 1.4 2004/10/07 09:32:45 marc
correction in parameter (const&)
@@ -180,7 +184,8 @@ namespace mrw {
}
//----------------------------------------------------------------------------
- bool StackTrace::createSymtable(const std::string& fname) throw(std::bad_exception) {
+ bool StackTrace::createSymtable(const std::string& fname)
+ throw(std::bad_exception) {
if (_dic.get()) return true;
AutoBfd abfd(bfd_openr((fname!="" ? fname : filename()).c_str(), 0));
long memsz(-1);
@@ -204,6 +209,35 @@ namespace mrw {
return true;
}
+ //----------------------------------------------------------------------------
+ bool StackTrace::createSymtable(const std::list& fnames)
+ throw(std::bad_exception) {
+ if (_dic.get()) return true;
+ for (std::list::const_iterator it(fnames.begin());
+ it!=fnames.end(); ++it) {
+ AutoBfd abfd(bfd_openr(it->c_str(), 0));
+ long memsz(-1);
+ Auto::Free m(0);
+ if (!abfd || bfd_check_format(abfd, bfd_archive) ||
+ !bfd_check_format_matches(abfd, bfd_object, &(m.getClean())) ||
+ !(bfd_get_file_flags(const_cast(static_cast(abfd)))
+ &HAS_SYMS) ||
+ (memsz=bfd_get_symtab_upper_bound
+ (const_cast(static_cast(abfd))))<0)
+ return false;
+ std::auto_ptr syms(new asymbol*[memsz]);
+ if (bfd_canonicalize_symtab(const_cast(static_cast(abfd)),
+ syms.get())<0)
+ return false;
+ _bfd = abfd;
+ _syms = syms;
+ if (!_dic.get()) _dic = std::auto_ptr(new Translator());
+ bfd_map_over_sections(_bfd, buildSectionMap, 0);
+ }
+ std::sort(_addrs.begin(), _addrs.end());
+ return true;
+ }
+
//----------------------------------------------------------------------------
std::string StackTrace::filename() throw(std::bad_exception) {
std::stringstream s;
diff --git a/mrw/stacktrace.hpp b/mrw/stacktrace.hpp
index b7896c7..116c967 100644
--- a/mrw/stacktrace.hpp
+++ b/mrw/stacktrace.hpp
@@ -9,6 +9,10 @@
@license LGPL, see file COPYING
$Log$
+ Revision 1.6 2004/10/07 16:59:12 marc
+ new method createSymtable that takes a list of arguments
+ -> untested!
+
Revision 1.5 2004/10/07 09:32:45 marc
correction in parameter (const&)
@@ -30,6 +34,7 @@
#define __MRW_STACKTRACE_HPP__
#include
#include
+#include
#include