libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] Help : Lowest address of stack frame causing segfault


From: Pallav Singh
Subject: [Libunwind-devel] Help : Lowest address of stack frame causing segfault
Date: Wed, 19 Mar 2014 22:57:27 +0530

Hi All ,

i have following query regarding lib-unwind stack unwinding, when frame pointer are omitted using -O3 optimization using gcc.

How can we get lowest address of stack frame causing segfault using libunwind

Note : Here we consider stack grows from Higher address to Lower Address.

#define UNW_LOCAL_ONLY
#include <libunwind.h>

void show_backtrace (void) {
  unw_cursor_t cursor; unw_context_t uc;
  unw_word_t ip, sp;

  unw_getcontext(&uc);
  unw_init_local(&cursor, &uc);
  while (unw_step(&cursor) > 0) {
    unw_get_reg(&cursor, UNW_REG_IP, &ip);
    unw_get_reg(&cursor, UNW_REG_SP, &sp);
    printf ("ip = %lx, sp = %lx\n", (long) ip, (long) sp);
  }
}

Thanks
Pallav Singh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]