On Thu, 19 Mar 2020 08:34:35 +0800 Phil Reid <pr...@electromag.com.au> wrote:
> On 19/03/2020 01:45, Stephen Hemminger wrote: > > Trying to use libunwind on Arm64 and discovered that it is not working > > as expected. Only one function is printed. > > > > On x86 Debian 10 (1.2.1-9) > > $ ./bt > > ^\Signal Quit recevied > > #0 0x5640deb47308 (sigquit+0x29) > > #1 0x7f4337b8587f (killpg+0x40) > > #2 0x7f4337c146f4 (nanosleep+0x14) > > #3 0x7f4337c1462a (sleep+0x3a) > > #4 0x5640deb4732c (main+0x1f) > > #5 0x7f4337b7209b (__libc_start_main+0xeb) > > #6 0x564 > > > > > > On Arm64 > > > > # /tmp/bt > > ^\Signal Quit recevied > > #0 0xab9f2f927bf0 (sigquit+0x34) > > Aborted (core dumped) > > > It is a problem with the libunwind version. Here is the glibc backtrace version on Arm64: $ /tmp/bt ^\Signal Quit recevied 8: [/tmp/bt(+0x884) [0xab7351d21884]] 7: [/lib/libc.so.6(__libc_start_main+0xe4) [0xff4f6b618ce4]] 6: [/tmp/bt(+0xa54) [0xab7351d21a54]] 5: [/lib/libc.so.6(sleep+0x34) [0xff4f6b697304]] 4: [/lib/libc.so.6(nanosleep+0x24) [0xff4f6b69741c]] 3: [linux-vdso.so.1(__kernel_rt_sigreturn+0) [0xff4f6b7905b8]] 2: [/tmp/bt(+0xa28) [0xab7351d21a28]] 1: [/tmp/bt(+0x974) [0xab7351d21974]] Aborted (core dumped) Source: /* Simple example of glibc-backtrace */ #include <stdio.h> #include <signal.h> #include <stdlib.h> #include <string.h> #include <execinfo.h> #include <unistd.h> #define BACKTRACE_SIZE 256 static void print_backtrace(void) { void *func[BACKTRACE_SIZE]; char **symb = NULL; int size; size = backtrace(func, BACKTRACE_SIZE); symb = backtrace_symbols(func, size); if (symb == NULL) return; while (size > 0) { fprintf(stderr, "%d: [%s]\n", size, symb[size - 1]); size--; } free(symb); } static void sigquit(int signo) { fprintf(stderr, "Signal %s recevied\n", strsignal(signo)); print_backtrace(); abort(); } int main(int ac, char **av) { signal(SIGQUIT, sigquit); for(;;) sleep(30); }