Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
libc.so.1中的核心_C_Unix_Solaris_Core_Libc - Fatal编程技术网

libc.so.1中的核心

libc.so.1中的核心,c,unix,solaris,core,libc,C,Unix,Solaris,Core,Libc,我正在使用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 pro

我正在使用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标准库。您正在将无效参数(空字符串指针等)传递给
strcasecmp()
。如果没有实际的代码(您还没有发布),就不可能推断出错误的确切原因

(另外,您最好使用调试符号编译程序-关闭优化!如果您使用的是Solaris,则最有可能使用GCC:

gcc -O0 -g etc...

)

不,问题不在于C标准库。您正在将无效参数(空字符串指针等)传递给
strcasecmp()
。如果没有实际的代码(您还没有发布),就不可能推断出错误的确切原因

(另外,您最好使用调试符号编译程序-关闭优化!如果您使用的是Solaris,则最有可能使用GCC:

gcc -O0 -g etc...
)

1)编译程序以包含调试信息(将“-g”添加到编译器的选项列表中),以便实际获得信息,而不是以下信息:

 [2] 0x10000af48(0x27, 0x10014b68e, 0x57, 0x10014b68e, 0x57, 0x0), at 0x10000af48
 [3] 0x100009c08(0x27, 0x5e, 0x0, 0x9, 0x1001332c3, 0x2b), at 0x100009c08
2) DBX现在将告诉您哪些函数调用了strcasecmp。逐步检查源代码(或让它生成日志输出),检查致命函数调用的参数是否有异常(如无效指针)

与对libc函数的调用出错的几率相比,您在libc函数中发现bug的几率是微乎其微的。

1)编译程序以包含调试信息(将“-g”添加到编译器的选项列表中),以便您实际获得信息而不是以下信息:

 [2] 0x10000af48(0x27, 0x10014b68e, 0x57, 0x10014b68e, 0x57, 0x0), at 0x10000af48
 [3] 0x100009c08(0x27, 0x5e, 0x0, 0x9, 0x1001332c3, 0x2b), at 0x100009c08
2) DBX现在将告诉您哪些函数调用了strcasecmp。逐步检查源代码(或让它生成日志输出),检查致命函数调用的参数是否有异常(如无效指针)

与对libc函数的调用出错的几率相比,您发现该函数中存在错误的几率是微乎其微的。

1)运行bt(backtrace)以查看谁在调用strcasecmp[这将列出类似#0,#1]的帧]

2) 现在跳到特定帧以获取值[frame 0]

3) 然后显示/打印传递给strcasecmp的参数值(使用打印或显示)

我觉得调用strcasecmp时参数为空,这就是为什么会出现segfault。

1)运行bt(backtrace)以查看调用strcasecmp的人[这将列出类似#0,#1]的帧]

2) 现在跳到特定帧以获取值[frame 0]

3) 然后显示/打印传递给strcasecmp的参数值(使用打印或显示)


我觉得调用strcasecmp时参数为NULL,这就是为什么会出现segfault。

看起来您传递给strcasecmp的参数不正确(损坏或字符串未以NULL结尾等)。看起来您传递给strcasecmp的参数不正确(损坏或字符串未以NULL结尾等)是的,这也是我的观点。C库应该没有问题。是的,这也是我的观点。C库应该没有问题。谢谢DevSolar,我将添加更多调试选项,然后回来。谢谢DevSolar,我将添加更多调试选项,然后回来。