有什么可以让GDB拒绝打破? [英] What could make GDB refuse to break?

查看:113
本文介绍了有什么可以让GDB拒绝打破?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里的损失。我正在写在C(.584)编译器,并与GCC 4.6.1基于AMD64的Linux 2.6.32编译,使用GDB 7.3。标志-Wall -Wextra -O0 -g,除了通常的-I和诸如此类的东西。我的目的是要报告分析错误,定义如下功能:

I'm at a loss here. I'm writing a compiler in C (for hobby), and compiling with GCC 4.6.1 on amd64 Linux 2.6.32, using GDB 7.3. Flags are "-Wall -Wextra -O0 -g", in addition to the usual -I and whatnot. I have a function whose purpose is to report a parse error, defined as follows:

void cerror_at (struct lex *lex, struct token *tok, const char *fmt, ...)

除了是可变参数,没有什么奇怪的。问题是,广发行将不打破它。我已经想尽办法,我能想到的(在函数断点,里面的功能,这就是所谓的之前,你的名字),但只要我的计划是在函数中,我得到这样的警告信息:错误删除断点0和GDB只是让程序完成。有什么不妥的话(因为我已经固定我试图找到的bug,并且一切运行它应该),但我不能进入的功能。什么可能会导致此任何想法?

Other than being variadic, nothing weird. The problem is that GDB will NOT break at it. I've tried every way I can think of (breakpoint at the function, inside the function, before it's called, you name it), but as soon as my program is inside the function, I get messages like "warning: Error removing breakpoint 0" and GDB just lets the program finish. There's nothing wrong with it any more (I've since fixed the bug I was trying to find, and everything runs as it should), but I can't get into the function. Any ideas on what could cause this?

编辑:更多信息! GDB在0x403057设置断点。该功能开始于0x403025。看看拆卸的这一部分:

More information! GDB is setting the breakpoint at 0x403057. The function starts at 0x403025. Look at this part of the disassembly:

0x0000000000403053 <+46>:   test   %al,%al
0x0000000000403055 <+48>:   je     0x403077 <cerror_at+82>

此时,它跳过提前0x403077(过去的断点)。我已验证放置断点的地址前的济的作品,以及在一个地址在或0x403077之后,跳转的目标,而不是介于两者之间(其中GDB正试图把它)。为什么会GDB放置在函数的中间断点?即使GDB告诉我,该函数的地址,其实,0x403025。

At this point, it skips ahead to 0x403077 (past the breakpoint). I've verified that placing the breakpoint at an address before the "je" works, as well as at an address at or after 0x403077, the target of the jump, but not in between (where GDB is trying to place it). Why would GDB place the breakpoint in the middle of the function? Even GDB tells me that the function's address is, in fact, 0x403025.

推荐答案

也许我只是密集的,但我已经遇到了一个调试器的最常见原因拒绝打破是最简单的。

Maybe I'm just dense, but the most common reasons I've come across for a debugger to refuse to break are the most simple ones.


  1. ,我试图调试code不完全匹配在调试器中code。

  2. 我忘了编译库调试选项。

要确保你检查这两个随时随地你会得到一个错误调试像这样的,即使你认为这是没问题的。

Be sure you check both of these anytime you get a debugging error like this, even if you think it's not the problem.

这篇关于有什么可以让GDB拒绝打破?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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