Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

鸟哥,求助,写了个扩展,在执行完函数正确输出后segment fault了 #39

Closed
JihanZhuang opened this issue Aug 13, 2016 · 2 comments

Comments

@JihanZhuang
Copy link

(gdb) bt
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00000000007be335 in format_converter (odp=0x7fff6e1d0f90, fmt=0xd5a491 "s(%d) : Freeing 0x%.8lX (%zu bytes), script=%s\n", ap=0x7fff6e1d0ff0)

at /home/jihanzhuang/Downloads/php-7.0.8/main/snprintf.c:993

#2 0x00000000007bedcf in strx_printv (ccp=0x7fff6e1d0fec,

buf=0x7fff6e1d1360 "[Sat Aug 13 21:02:14 2016]  Script:  '/home/jihanzhuang/code/Pinyin/tests/pinyin.php'\n", len=512, 
format=0xd5a490 "%s(%d) :  Freeing 0x%.8lX (%zu bytes), script=%s\n", ap=0x7fff6e1d0ff0) at /home/jihanzhuang/Downloads/php-7.0.8/main/snprintf.c:1248

#3 0x00000000007bf07a in ap_php_snprintf (buf=0x7fff6e1d1360 "[Sat Aug 13 21:02:14 2016] Script: '/home/jihanzhuang/code/Pinyin/tests/pinyin.php'\n", len=512,

format=0xd5a490 "%s(%d) :  Freeing 0x%.8lX (%zu bytes), script=%s\n") at /home/jihanzhuang/Downloads/php-7.0.8/main/snprintf.c:1293

#4 0x00000000007b9768 in php_message_handler_for_zend (message=4, data=0x7fff6e1d2410) at /home/jihanzhuang/Downloads/php-7.0.8/main/main.c:1444
#5 0x0000000000851cad in zend_message_dispatcher (message=4, data=0x7fff6e1d2410) at /home/jihanzhuang/Downloads/php-7.0.8/Zend/zend.c:998
#6 0x000000000081cf06 in zend_mm_check_leaks (heap=0x7f2a6c000040) at /home/jihanzhuang/Downloads/php-7.0.8/Zend/zend_alloc.c:2129
#7 0x000000000081d268 in zend_mm_shutdown (heap=0x7f2a6c000040, full=0, silent=0) at /home/jihanzhuang/Downloads/php-7.0.8/Zend/zend_alloc.c:2201
#8 0x000000000081e113 in shutdown_memory_manager (silent=0, full_shutdown=0) at /home/jihanzhuang/Downloads/php-7.0.8/Zend/zend_alloc.c:2637
#9 0x00000000007ba6e0 in php_request_shutdown (dummy=0x0) at /home/jihanzhuang/Downloads/php-7.0.8/main/main.c:1856
#10 0x000000000091b7ec in do_cli (argc=2, argv=0x1b55310) at /home/jihanzhuang/Downloads/php-7.0.8/sapi/cli/php_cli.c:1141
#11 0x000000000091c068 in main (argc=2, argv=0x1b55310) at /home/jihanzhuang/Downloads/php-7.0.8/sapi/cli/php_cli.c:1344

## core文件的信息,是在format_converter函数中,s是不能访问的地址,程序直接strlen导致的错误。
(gdb) list
case 's':
case 'v':
s = va_arg(ap, char *);
if (s != NULL) {
s_len = strlen(s);
if (adjust_precision && precision < s_len) {
s_len = precision;
}
}
请问有什么办法可以更好地排查问题。

@JihanZhuang
Copy link
Author

一个一个方法进行测试,排查到问题了。sorry,我还以为是php7的bug。新手请原谅

@laruence
Copy link
Owner

;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants