perf top: Show backtrace when handling a SIGSEGV on --stdio mode

It was just freezing instead of informing about the SEGV, fix it and
also print a backtrace, just like in the TUI mode and in 'perf trace'.

Tested by provoking a NULL deref when pressing 'z':

     0.31%     [.] malloc_consolidate
     0.31%       [.] _dl_relocate_object
     0.28%  cc1              [.] ht_lookup
     0.28%  cc1              [.] ira_init_register_move_cost
  perf: Segmentation fault
  Obtained 7 stack frames.
  perf(dump_stack+0x32) [0x4d69f2]
  perf(sighandler_dump_stack+0x29) [0x4d6a89]
  /lib64/ [0x7f5064333960]
  perf() [0x438790]
  /lib64/ [0x7f50663dd52a]
  /lib64/ [0x7f50643ff22d]

Reported-by: Linus Torvalds <>
Cc: Adrian Hunter <>
Cc: Borislav Petkov <>
Cc: David Ahern <>
Cc: Frederic Weisbecker <>
Cc: Jiri Olsa <>
Cc: Namhyung Kim <>
Cc: Stephane Eranian <>
Signed-off-by: Arnaldo Carvalho de Melo <>
1 file changed