有两个程序A和B, 启动A后, A会fork()
新线程然后使用execl()
调用B程序
运行过程中B会出错产生core文件,使用gdb查看core文件时提示
warning: core file may not match specified executable file.
但是B文件明明是最新的.
请教这是为什么
补充完整的输出:
[service]$ sudo gdb ../xx/B core
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
http://bugs.launchpad.net/gdb-linaro/...
Reading symbols from /home/tizen/code/nsdlna/apps/player/ns-player...done.
[New LWP 1372]
[New LWP 1447]
[New LWP 1450]
[New LWP 1449]
[New LWP 1371]
[New LWP 1367]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
Core was generated by `B'.
Program terminated with signal 11, Segmentation fault.
#0 malloc_consolidate (av=0xb5a00010) at malloc.c:4278
4278 malloc.c: No such file or directory.
warning: core file may not match specified executable file.
(gdb) bt
#0 malloc_consolidate (av=0xb5a00010) at malloc.c:4278
#1 malloc_consolidate (av=0xb5a00010) at malloc.c:4224
#2 0xb709a22f in _int_malloc (av=0xb5a00010, bytes=814) at malloc.c:3564
#3 0xb709cdec in __GI___libc_malloc (bytes=814) at malloc.c:2924
#4 0xb7297627 in operator new(unsigned int) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#5 0xb729774b in operator new[](unsigned int) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
#6 0x080686a5 in ?? ()
#7 0x08067934 in ?? ()
#8 0x08067818 in ?? ()
#9 0x0806e7f7 in ?? ()
#10 0xb7424d4c in start_thread (arg=0xb657bb40) at pthread_create.c:308
#11 0xb7112bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
(gdb)
You may have misunderstood the usage of core files.
The command for gdb debugging core files is as follows:
gdb execfilename corefiname
The second parameter is the full path name of the core file generated when the executable file runs, not a core keyword.