mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-02-02 04:52:53 +01:00
(STACK_SIZE): SIGSTKSZ is also ridiculously small on x86-64 (at least
for SuSE LES 9) so use 128KB instead. (do_backtrace): Also print backtrace obtained via backtrace(). (foo): Remove backtrace() call---now done in do_backtrace(). (Logical change 1.290)
This commit is contained in:
parent
04fde4a63b
commit
1ee6b0ac74
1 changed files with 17 additions and 14 deletions
|
@ -38,8 +38,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <libunwind.h>
|
#include <libunwind.h>
|
||||||
|
|
||||||
#if UNW_TARGET_X86
|
#if UNW_TARGET_X86 || UNW_TARGET_X86_64
|
||||||
# define STACK_SIZE (128*1024) /* On x86, SIGSTKSZ is too small */
|
# define STACK_SIZE (128*1024) /* On x86/-64, SIGSTKSZ is too small */
|
||||||
#else
|
#else
|
||||||
# define STACK_SIZE SIGSTKSZ
|
# define STACK_SIZE SIGSTKSZ
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,6 +64,9 @@ do_backtrace (void)
|
||||||
unw_context_t uc;
|
unw_context_t uc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
printf ("\texplicit backtrace:\n");
|
||||||
|
|
||||||
unw_getcontext (&uc);
|
unw_getcontext (&uc);
|
||||||
if (unw_init_local (&cursor, &uc) < 0)
|
if (unw_init_local (&cursor, &uc) < 0)
|
||||||
panic ("unw_init_local failed!\n");
|
panic ("unw_init_local failed!\n");
|
||||||
|
@ -110,24 +113,24 @@ do_backtrace (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (ret > 0);
|
while (ret > 0);
|
||||||
|
|
||||||
|
{
|
||||||
|
void *buffer[20];
|
||||||
|
int i, n;
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
printf ("\n\tvia backtrace():\n");
|
||||||
|
n = backtrace (buffer, 20);
|
||||||
|
if (verbose)
|
||||||
|
for (i = 0; i < n; ++i)
|
||||||
|
printf ("[%d] ip=%p\n", i, buffer[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
foo (long val)
|
foo (long val)
|
||||||
{
|
{
|
||||||
void *buffer[20];
|
|
||||||
int i, n;
|
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
printf ("\texplicit backtrace:\n");
|
|
||||||
do_backtrace ();
|
do_backtrace ();
|
||||||
|
|
||||||
if (verbose)
|
|
||||||
printf ("\n\tvia backtrace():\n");
|
|
||||||
n = backtrace (buffer, 20);
|
|
||||||
if (verbose)
|
|
||||||
for (i = 0; i < n; ++i)
|
|
||||||
printf ("[%d] ip=%p\n", i, buffer[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue