26 static const unsigned int bsize(1024U);
31 out <<
"Error in backtrace" << std::endl;
34 for (
int n = 0;
n < depth; ++
n) {
35 unsigned long addr = (
unsigned long) ltrace[
n];
38 if (dladdr (ltrace[
n], &info) && info.dli_fname && info.dli_fname[0]) {
39 const char *libname = info.dli_fname;
40 unsigned long symaddr = (
unsigned long) info.dli_saddr;
41 if (info.dli_sname && info.dli_sname[0]) {
43 bool gte = (addr >= symaddr);
44 unsigned long diff = (gte ? addr - symaddr : symaddr - addr);
45 sprintf (buffer,
" 0x%08lx %.100s %s 0x%lx [%.100s]\n",
46 addr, ln(), gte ?
"+" :
"-", diff, libname);
48 sprintf (buffer,
" 0x%08lx <unknown function> [%.100s]\n", addr, libname);
50 sprintf (buffer,
" 0x%08lx <unknown function>\n", addr);
52 if (::strlen (buffer) > bsize) {
53 out <<
"Error in backtrace" << std::endl;
56 out.write (buffer, ::strlen (buffer));
59 #ifndef CMS_CHAR_STREAM
perl if(1 lt scalar(@::datatypes))