Skip to content
Snippets Groups Projects
Commit 34314d8e authored by Jason Hiser's avatar Jason Hiser :tractor:
Browse files

libunwind test

parent d744d1a8
No related branches found
No related tags found
No related merge requests found
#/bin/bash
function main()
{
set -e
set -x
g++ unc.c -o unc.exe
$PSZ unc.exe unc-zipr.exe --tempdir unc-temp
./unc.exe
./unc-zipr.exe
rm -rf unc.exe unc-zipr.exe unc-temp
}
main "$@"
#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);
}
}
int main()
{
show_backtrace();
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment