0
votes

I did the following:

  1. imported a Makefile project into Eclipse CDT.
  2. compiled the program from the command line using the -ggdb option of g++.
  3. run the programm from the command line
  4. set some breakpoints in Eclipse CDT
  5. attached the Eclipse CDT debugger (gdb) to a child process that my program spawned (the child process runs a program from the same project).

At this point I get the error message in the console

No source file named /home/oswald/Eclipse/CDT/Workspace/Project/path/to/header.h.

When I resume the programm, all my breakpoints are skipped. How can I get my breakpoints working?

Some additional notes:

  • There are no shared libraries involved.
  • Eclipse Indigo, gdb 7.4, Ubuntu 12.04
  • Using the command line to attach gdb to the process, I can set a breakpoint to header.h:257 (header.h is in folder /home/oswald/Eclipse/CDT/Workspace/Project/path/to/). gdb then honours this breakpoint.
  • Using the command line to attach gdb to the process, I cannot set a breakpoint to /home/oswald/Eclipse/CDT/Workspace/Project/path/to/header.h:257, I get the same message from gdb as when using Eclipse CDT.
  • Eclipse CDT uses the GDB (DSF) Attach to Process Launcher. Switching to the Standard Attach to Process Launcher yields an error message that the system cannot list running processes.
  • The Source Lookup Path in the debug configuration is set to default (Absolute File Path, Program Realtive File Path, Project). I experimented with various other settings, but none worked.
1

1 Answers

1
votes

As a workaround, I have written a shell script that generates a .gdbinit file that contains the appropriate directory entries:

#!/bin/sh

PROJECT=/home/oswald/Eclipse/CDT/Workspace/Project

find $PROJECT -name "*.h*" -o -name "*.c*" \
  | sed 's:/[^/]*$::' \
  | sort \
  | uniq \
  | sed 's/^/directory /' > $PROJECT/.gdbinit

and configured the Eclipse CDT to use that .gdbinit file.