Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
482 views
in Technique[技术] by (71.8m points)

c - SSL_library_init cause SIGILL when running under gdb

Trying to debug a program using gdb, it fails reporting SIGILL in OPENSSL_cpuid_setup.
With this simple code I have the same behaviour with :

#include <openssl/ssl.h>
int main()
{
    SSL_library_init(); 
}

It compile and run well but starting with gdb report following backtrace

Program received signal SIGILL, Illegal instruction.
0xb6b2eb40 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
(gdb) where
#0  0xb6b2eb40 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
#1  0xb6b2b404 in OPENSSL_cpuid_setup () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0
#2  0xb6fdf058 in call_init (l=<optimized out>, argc=1, argv=0xbefff7d4, env=0xbefff7dc) at dl-init.c:78
#3  0xb6fdf134 in _dl_init (main_map=0xb6fff958, argc=1, argv=0xbefff7d4, env=0xbefff7dc) at dl-init.c:126
#4  0xb6fcfda4 in _dl_start_user () from /lib/ld-linux-armhf.so.3
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

How can I run such a program under gdb ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

SSL_library_init cause SIGILL when running under gdb...

It actually does it all the time, and not just under GDB. It is normal behavior in startup code as the library tests for processor features. You can safely ignore it by issuing handle SIGILL nostop.

See item 17 in the OpenSSL FAQ for more details: When debugging I observe SIGILL during OpenSSL initialization: why?.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...