我正在使用 Solaris 10,我的 C 程序崩溃并创建了一个核心文件。在调试时,似乎核心是在 libc.so.1 中创建的。如果有人有任何线索,请告诉我。 以下是 dbx 报告。
dbx prock.new core
For information about new features see `help changes'
To remove this message, put `dbxenv suppress_startup_message 7.6' in your .dbxrc
Reading prock.new
core file header read successfully
Reading ld.so.1
Reading libsocket.so.1
Reading libnsl.so.1
Reading libl.so.1
Reading libpthread.so.1
Reading librt.so.1
Reading libthread.so.1
Reading libc.so.1
Reading libaio.so.1
Reading libmd.so.1
Reading libc_psr.so.1
WARNING!!
A loadobject was found with an unexpected checksum value.
See `help core mismatch' for details, and run `proc -map'
to see what checksum values were expected and found.
dbx: warning: Some symbolic information might be incorrect.
t@null (l@1) terminated by signal SEGV (no mapping at the fault address)
0xffffffff7ea3bc14: strcasecmp+0x0134: orn %i0, %i3, %i0
(dbx) where
=>[1] strcasecmp(0x10014b68e, 0x57, 0x7ffffc00, 0x1001332d7, 0x27, 0x24), at 0xffffffff7ea3bc14
[2] 0x10000af48(0x27, 0x10014b68e, 0x57, 0x10014b68e, 0x57, 0x0), at 0x10000af48
[3] 0x100009c08(0x27, 0x5e, 0x0, 0x9, 0x1001332c3, 0x2b), at 0x100009c08
(dbx) whereis strcasecmp
function: `libc.so.1`strcasecmp
(dbx)
我的solaris版本是
Solaris 10 8/07 s10s_u4wos_12b SPARC
Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 16 August 2007
最佳答案
不,问题不在于 C 标准库。您将无效参数(NULL 字符串指针等)传递给 strcasecmp()
。如果没有实际代码(您尚未发布),则无法推断出错误到底是什么。
(此外,您最好使用调试符号编译您的程序 - 关闭优化!如果您在 Solaris 上,您很可能使用 GCC:
gcc -O0 -g etc...
)
关于libc.so.1 中的核心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11760688/