libunwind-devel
[Top][All Lists]
Advanced

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

[Libunwind-devel] AARCH64 ILP32 support


From: Krishnanjanappa, Jagadeesh
Subject: [Libunwind-devel] AARCH64 ILP32 support
Date: Wed, 25 Sep 2013 06:15:57 +0000

Hello,

Recently, I tried to print unwind info of a testcase on AARCH64 ILP32 (big endian) using libunwind.
By default, the support for AARCH64 ILP32 is not present in libunwind, the attached patch adds support
to print unwind info for AARCH64 ILP32 and enables to load .debug_frame for both AARCH64 and AARCH64 ILP32 inorder to display unwind info of __start procedure.

testcase: unwind.c

#define UNW_LOCAL_ONLY
#include<libunwind.h>
#include<stdio.h>
void show_backtrace (void) {
  unw_cursor_t cursor; unw_context_t uc;
  unw_word_t ip, sp, offt;
  char name [20];

  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);
    unw_get_proc_name(&cursor, name, 20, &offt);
    printf ("ip = %lx, sp = %lx", (long) ip, (long) sp);
    printf (", procedure = %s\n", name);
  }
}

void call_backtrace(void) {
  show_backtrace();
}

int main()
{
call_backtrace();
}

compile and excute commands on AARCH64:
gcc -mbig-endian -g -funwind-tables -I /usr/include/ -L /usr/lib64/ -lunwind -lunwind-aarch64 unwind.c -o unwind
./unwind

output:
ip = 400a5c, sp = 7fe06eea30, procedure = call_backtrace
ip = 400a70, sp = 7fe06eea40, procedure = main
ip = 7faa5d1788, sp = 7fe06eea50, procedure = __libc_start_main
ip = 40082c, sp = 7fe06eeb90, procedure = _start

Please let me know if any changes required.

Regards,
Jagadeesh

Attachment: libunwind_aarch64_ILP32_support.patch
Description: libunwind_aarch64_ILP32_support.patch


reply via email to

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