1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2025-01-22 08:10:30 +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:
mostang.com!davidm 2005-05-03 09:13:17 +00:00
parent 04fde4a63b
commit 1ee6b0ac74

View file

@ -38,8 +38,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <unistd.h>
#include <libunwind.h>
#if UNW_TARGET_X86
# define STACK_SIZE (128*1024) /* On x86, SIGSTKSZ is too small */
#if UNW_TARGET_X86 || UNW_TARGET_X86_64
# define STACK_SIZE (128*1024) /* On x86/-64, SIGSTKSZ is too small */
#else
# define STACK_SIZE SIGSTKSZ
#endif
@ -64,6 +64,9 @@ do_backtrace (void)
unw_context_t uc;
int ret;
if (verbose)
printf ("\texplicit backtrace:\n");
unw_getcontext (&uc);
if (unw_init_local (&cursor, &uc) < 0)
panic ("unw_init_local failed!\n");
@ -110,24 +113,24 @@ do_backtrace (void)
}
}
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
foo (long val)
{
void *buffer[20];
int i, n;
if (verbose)
printf ("\texplicit backtrace:\n");
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