|
|
|
@ -88,9 +88,9 @@ namespace mrw { |
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
mrw::StackTrace::StackTrace() throw(std::bad_exception) { |
|
|
|
|
// maximum trace level is limited here to 50, see below why
|
|
|
|
|
# if defined(__GNUG__) |
|
|
|
|
# if defined(__GNUG__) |
|
|
|
|
{ |
|
|
|
|
# define PUSH(i) \ |
|
|
|
|
# define PUSH(i) \ |
|
|
|
|
(__builtin_frame_address(i)!=0 ? \
|
|
|
|
|
(_trace.push_back(__builtin_return_address(i)), true) : false) |
|
|
|
|
PUSH(0) && PUSH(1) && PUSH(2) && PUSH(3) && PUSH(4) && PUSH(5) && |
|
|
|
@ -102,7 +102,7 @@ mrw::StackTrace::StackTrace() throw(std::bad_exception) { |
|
|
|
|
PUSH(34) && PUSH(35) && PUSH(36) && PUSH(37) && PUSH(38) && PUSH(39) |
|
|
|
|
&& PUSH(40) && PUSH(41) && PUSH(42) && PUSH(43) && PUSH(44) && |
|
|
|
|
PUSH(45) && PUSH(46) && PUSH(47) && PUSH(48) && PUSH(49); |
|
|
|
|
# undef PUSH |
|
|
|
|
# undef PUSH |
|
|
|
|
} |
|
|
|
|
# elif defined(__GLIBC__) |
|
|
|
|
{ |
|
|
|
@ -332,7 +332,9 @@ mrw::StackTrace::BinFiles mrw::StackTrace::filename() |
|
|
|
|
std::string range, perm, x1, x2, size, lib; |
|
|
|
|
while (getline(is, s)) try { |
|
|
|
|
range = perm = x1 = x2 = size = lib = "????"; |
|
|
|
|
s>>range>>perm>>x1>>x2>>size>>lib; |
|
|
|
|
s>>range>>perm>>x1>>x2>>size; |
|
|
|
|
if (mrw::to<int>(size)>0) { |
|
|
|
|
s>>lib; |
|
|
|
|
range.resize(range.find_first_not_of("0123456789abcdefABCDEF")); |
|
|
|
|
void* addr(0); |
|
|
|
|
range>>addr; |
|
|
|
@ -341,6 +343,7 @@ mrw::StackTrace::BinFiles mrw::StackTrace::filename() |
|
|
|
|
// question: should only files with ending '.so' be loaded?
|
|
|
|
|
if (lib.size() && lib[0]!='[' && lib[lib.size()-1]!=']' && addr>0) |
|
|
|
|
res<<BinFiles::value_type(lib, addr); |
|
|
|
|
} |
|
|
|
|
} catch (...) {} // ignore non matching lines
|
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|