核心文件的gdb backtrace打印错误“没有这样的文件或目录". [英] gdb backtrace of a core file prints error "no such file or directory"

查看:140
本文介绍了核心文件的gdb backtrace打印错误“没有这样的文件或目录".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在测试程序时,我遇到了分段错误,该错误转储了所需的内核.

While testing a program I hit a segmentation fault which dumped the required core.

我正在使用gdb调试核心文件,如下所示: gdb/path/to/exec路径/to/core

I'm using gdb to debug a core file as: gdb /path/to/exec path/to/core

查看核心文件(和源代码)后,我意识到问题实际上是在使用"strcmp"功能时发生的NULL指针取消引用.

I realized after looking at the core file (and the source code) that the issue is actually a NULL pointer dereference that happened while using the "strcmp" function.

但是,核心文件回溯显示以下错误消息:

However, the core-file backtrace gives the below error message:

程序以信号SIGSEGV终止,出现分段错误.

Program terminated with signal SIGSEGV, Segmentation fault.

#0 __strcmp_sse2_unaligned(),位于../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:32

#0 __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:32

32 ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:没有此类文件或目录.

32 ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: No such file or directory.

(gdb)bt

#0 __strcmp_sse2_unaligned(),位于../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:32

#0 __strcmp_sse2_unaligned () at ../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:32

main.c:1144处的#1 0x00000000004041f1在main(argc = 1,argv = 0x7ffced1f8ae8)

#1 0x00000000004041f1 in main (argc=1, argv=0x7ffced1f8ae8) at main.c:1144

现在这是一条奇怪的消息,我无法理解.我不确定gdb为什么要打印此消息../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S:没有这样的文件或目录" .

Now this is a weird message that I can't make any sense of. I'm not sure why gdb is printing this message "../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S: No such file or directory".

我应该得到一些与NULL指针取消引用有关的消息,但是却得到了这一点.这意味着什么?

I should be getting some message related to NULL pointer de-reference but instead got this. What does that mean?

推荐答案

此错误看起来令人迷惑,但它是正确的.它表明 strcmp 正在进行NULL指针取消引用,这是从代码的1144行调用的.

This error looks mystifying but it is correct. It shows that a NULL pointer de-reference was being made by strcmp, which was called from line 1144 of your code.

分段错误是指尝试访问无效的内存页:其段被映射为对于MMU中的读取或写入无效.在这种情况下, strcmp 试图访问页面0,因为您将其传递给NULL ptr.空Ptr是地址零,第0页是无效页.

A segmentation fault refers to trying to access a page of memory that is invalid: its segment is mapped as Invalid for read or write in the MMU. In this case, strcmp is trying to access page 0 because you passed it a NULL ptr. Null Ptr is address zero, and page 0 is an invalid page.

对文件的引用:

../sysdeps/x86_64/multiarch/strcmp-sse2-unaligned.S

是指在64位体系结构上实现针对x86的strcmp的汇编文件(.S).由于您的系统上没有该实现文件,因此gdb抱怨它无法访问它.

is referring the the assembler file (.S) that implements strcmp for x86 on 64-bit architectures. Since you do not have that implementation file on your system, gdb is complaining that it can not access it.

这篇关于核心文件的gdb backtrace打印错误“没有这样的文件或目录".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆