I'm trying to use gdb with emacs. The library that I'm trying to debug is loaded by a process and can't be run directly. Hence I attach to the process by using the attach command inside gdb. Attaching to a process and setting breakpoints works fine when I use gdb from a shell, but when I use gdb in emacs (by pressing M-x gdb or M-x gud-gdb), it can't set breakpoints. It shows me an error which says "Can't access memory at 0x7efb04". I'm using emacs 23.1.1.

Here is a breakdown of the process I follow:

  1. Press M-x gdb or M-x gud-gdb to launch gdb inside emacs.
  2. Enter the name of the executable built with debugging symbols.
  3. Type "attach [PID]" to attach gdb to a running process.
  4. Set a breakpoint by typing: filename:line number.

The last step gives me an error which says "Can't access memory at 0x7efb04".

Any ideas why this is happening?

EDIT : I get the same error when using DDD (UI for GDB). So I guess it's not an emacs specific issue.

有帮助吗?

解决方案 2

I figured it out. The problem is with step 2. Entering the name of the executable built with debugging symbol causes the problem. Instead, just launching GDB and attaching to process works fine. I'm not sure if this is the expected behavior.

In DDD, the executable with debugging symbols has to be opened first before we can attach to process. I don't know how to get around that in DDD.

其他提示

Have you compiled with debug-information? Do you have some code which shows the problem? Does this happen in other IDEs also?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top