On Sat, 26 Aug 2017 21:40:34 +0300 Konstantin Belousov <kostik...@gmail.com> 
wrote:
> On Sat, Aug 26, 2017 at 08:28:13PM +0200, Tijl Coosemans wrote:
>> On Sat, 26 Aug 2017 02:44:42 +0300 Konstantin Belousov <kostik...@gmail.com> 
>> wrote:  
>>> How does llvm unwinder detects that the return address is a garbage ?  
>> 
>> It just stops unwinding when it can't find frame information (stored in
>> .eh_frame sections).  GCC unwinder doesn't give up yet and checks if the
>> return address points to the signal trampoline (which means the current
>> frame is that of a signal handler).  It has built-in knowledge of how to
>> unwind to the signal trampoline frame.  
> So llvm just gives up on signal frames ?

Looks like it.  This program doesn't print anything when using base
libgcc_s.  With gcc libgcc_s it prints:

0x400904 <handler+0x24> at /usr/home/tijl/testsig
0x7ffffffff173 <_fini+0x7fffffbfe7bb> at ???

cc -o test test.c -lexecinfo -lgcc_s -rpath /usr/local/lib/gcc5

----------------------------
#include <execinfo.h>
#include <signal.h>

void *buf[ 20 ];
size_t s;

void
handler( int sig ) {
        s = backtrace( buf, 20 );
}

int
main( void ) {
        signal( SIGINT, handler );
        raise( SIGINT );
        backtrace_symbols_fd( buf, s, 1 );
        return( 0 );
}
----------------------------
_______________________________________________
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to