Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Debugger found the wrong source file - how to fix?
Debugger found the wrong source file - how to fix? [message #235454] Fri, 03 July 2009 04:02 Go to next message
Eclipse UserFriend
I've been clever enough to use the same (base) file name for two different
source code files on two different sub directories under my project.

When I started a debug session just now in order to analyse a core file,
the debugger picked up the wrong one. Is there any way to tell it to use
the other (correct) one instead? Also, this seems to indicate that the
debug setup searches for files on basename. Shouldn't it try the absolute
path given in the debug tables first?

Note that gdb from the command line did not have this problem for the same
executable and core file.
Re: Debugger found the wrong source file - how to fix? [message #235502 is a reply to message #235454] Sun, 05 July 2009 12:25 Go to previous messageGo to next message
Eclipse UserFriend
Toralf Lund wrote:

> I've been clever enough to use the same (base) file name for two different
> source code files on two different sub directories under my project.

> When I started a debug session just now in order to analyse a core file,
> the debugger picked up the wrong one. Is there any way to tell it to use
> the other (correct) one instead? Also, this seems to indicate that the
> debug setup searches for files on basename. Shouldn't it try the absolute
> path given in the debug tables first?
Setup a debug configuration within Eclipse. In the "Debugger" tab there is
an option "Use full file path to set breakpoint". Try this.

Axel
Re: Debugger found the wrong source file - how to fix? [message #235528 is a reply to message #235502] Mon, 06 July 2009 03:41 Go to previous messageGo to next message
Eclipse UserFriend
Axel Mueller wrote:

> Toralf Lund wrote:

>> I've been clever enough to use the same (base) file name for two different
>> source code files on two different sub directories under my project.

>> When I started a debug session just now in order to analyse a core file,
>> the debugger picked up the wrong one. Is there any way to tell it to use
>> the other (correct) one instead? Also, this seems to indicate that the
>> debug setup searches for files on basename. Shouldn't it try the absolute
>> path given in the debug tables first?
> Setup a debug configuration within Eclipse. In the "Debugger" tab there is
> an option "Use full file path to set breakpoint". Try this.
Didn't help, I'm afraid... However, when I looked into the problem again
right now, I think I found a solution. I did:
1. Open the debug configuration in question...
2. Select the "Source" tab.
3. Select "Default" from the path list, then press "Remove".
4. Click "Add...", then select "Absolute File Path".

And everything seems OK. Which doesn't really make sense, since "Absolute
File Path" was also included as the topmost entry under "Default"...

- Toralf
Re: Debugger found the wrong source file - how to fix? [message #235554 is a reply to message #235528] Tue, 07 July 2009 02:13 Go to previous messageGo to next message
Eclipse UserFriend
Toralf Lund wrote:

> Axel Mueller wrote:

>> Toralf Lund wrote:

>>> I've been clever enough to use the same (base) file name for two different
>>> source code files on two different sub directories under my project.

>>> When I started a debug session just now in order to analyse a core file,
>>> the debugger picked up the wrong one. Is there any way to tell it to use
>>> the other (correct) one instead? Also, this seems to indicate that the
>>> debug setup searches for files on basename. Shouldn't it try the absolute
>>> path given in the debug tables first?
>> Setup a debug configuration within Eclipse. In the "Debugger" tab there is
>> an option "Use full file path to set breakpoint". Try this.
> Didn't help, I'm afraid... However, when I looked into the problem again
> right now, I think I found a solution. I did:
> 1. Open the debug configuration in question...
> 2. Select the "Source" tab.
> 3. Select "Default" from the path list, then press "Remove".
> 4. Click "Add...", then select "Absolute File Path".

> And everything seems OK. Which doesn't really make sense, since "Absolute
> File Path" was also included as the topmost entry under "Default"...
But you removed the relative paths in step 3. That did the magic.

Axel
Re: Debugger found the wrong source file - how to fix? [message #235913 is a reply to message #235554] Wed, 15 July 2009 16:11 Go to previous messageGo to next message
Eclipse UserFriend
Axel Mueller wrote:

> Toralf Lund wrote:

>> Axel Mueller wrote:

>>> Toralf Lund wrote:

>>>> I've been clever enough to use the same (base) file name for two
different
>>>> source code files on two different sub directories under my project. [
... ]

>>>>
>> right now, I think I found a solution. I did:
>> 1. Open the debug configuration in question...
>> 2. Select the "Source" tab.
>> 3. Select "Default" from the path list, then press "Remove".
>> 4. Click "Add...", then select "Absolute File Path".

>> And everything seems OK. Which doesn't really make sense, since "Absolute
>> File Path" was also included as the topmost entry under "Default"...
> But you removed the relative paths in step 3. That did the magic.
True, but like I said, the "Absolute File Paths" is listed above any
relative path in the defaults. Shouldn't that mean it takes precedence?

- Toralf
Re: Debugger found the wrong source file - how to fix? [message #521547 is a reply to message #235913] Wed, 17 March 2010 20:37 Go to previous message
Eclipse UserFriend
My team is having the same problem with multiple main.cpp files in the project. It seems the only way to fix it is if the ONLY entry in the Source Lookup Path in the Launch Configuration is Absolute File Path. When I add the project root to the Source Lookup Path, either before or after Absolute File Path, the problem returns.

This is counter-intuitive, and I am very leery of accepting anything using an absolute file path bc my team shares eclipse project files and launch configuration files.

Can anyone explain why this behavior is so? What does this Absolute File Path entry mean and why does source file resolution only work when it is the only item in the list?

Can I share launcher config files if I have Absolute File Path in the Source Lookup Path?

Thanks!
Tim
Previous Topic:Evaluating Expressions while debugging
Next Topic:Duplicating Eclipse project settings
Goto Forum:
  


Current Time: Thu May 01 02:25:30 EDT 2025

Powered by FUDForum. Page generated in 0.31090 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top