问题描述:

I'm using Eclipse with CDT. I have a project that has many executables. It's makefile driven, so all executables are built correctly.

Anyway, when I launch a debug session, GDB is pointed to the wrong main.cpp and debugging is practically worthless in the scope of that file. All other subsequent files are alright.

This is the incorrect path that it chooses:

(gdb)

72-break-insert -t main

72^done,bkpt={number="5",type="breakpoint",disp="del",enabled="y",addr="0x080931fa",func="main(int, char**)",file="src/main.cpp",fullname="D:\\app\\src\\main.cpp",line="10",times="0",original-location="main"}

But, it should use this file (but errors):

(gdb)

89-break-insert D:/unittests/src/main.cpp:12

89^error,msg="No source file named D:/unittests/src/main.cpp."

Because both files contain a main(), the IDE grabs the first one that it finds, because the symbols match the function signature. Is there any way around this without having to split the project into multiple projects?

相关阅读:
Top