3

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 Answers 2

0

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

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, I have compiled the library with debug-information. I'm able to debug using gdb in a shell. I get the same error when using DDD (UI for GDB). So I guess it's not an emacs scpecific problem.
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.