Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344408 - [disassembly] Cannot show mixed-mode disassembly when doing project-less debug
Summary: [disassembly] Cannot show mixed-mode disassembly when doing project-less debug
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-01 21:30 EDT by Marc Khouzam CLA
Modified: 2011-05-02 11:23 EDT (History)
3 users (show)

See Also:
marc.khouzam: review? (aleherb+eclipse)


Attachments
Fix (1.35 KB, patch)
2011-05-02 11:02 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2011-05-01 21:30:08 EDT
When choosing a binary somewhere on the file system, instead of part of a project, showing the source code in the disassembly fails because it cannot find the source file.

I see the following:

!ENTRY org.eclipse.cdt.dsf.ui 2 0 2011-05-01 21:27:20.523
!MESSAGE Unable to locate file: ../src/Consumer.cpp

So, it seems that GDB returns a relative path with respect to the location of the binary in question.  However, this does not seem to work for us.  Surely something about the path that is being used by the disassembly code.
Comment 1 Anton Leherbauer CLA 2011-05-02 05:30:49 EDT
Reason seems to be an Exception caused by ProgramRelativePathSourceContainer trying to get a project for an empty string:

Error
Mon May 02 11:22:40 CEST 2011
Problems occurred when invoking code from plug-in: "org.eclipse.debug.core".

java.lang.IllegalArgumentException: Path for project must have only one segment.
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.resources.WorkspaceRoot.getProject(WorkspaceRoot.java:184)
	at org.eclipse.cdt.internal.core.model.CModel.getCProject(CModel.java:63)
	at org.eclipse.cdt.debug.core.sourcelookup.ProgramRelativePathSourceContainer.getProgramLocation(ProgramRelativePathSourceContainer.java:148)
	at org.eclipse.cdt.debug.core.sourcelookup.ProgramRelativePathSourceContainer.findSourceElements(ProgramRelativePathSourceContainer.java:96)
	at org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer.findSourceElements(CompositeSourceContainer.java:79)
	at org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer.findSourceElements(CompositeSourceContainer.java:46)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant.findSourceElements(AbstractSourceLookupParticipant.java:67)
	at org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupParticipant.findSourceElements(CSourceLookupParticipant.java:117)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$SourceLookupQuery.run(AbstractSourceLookupDirector.java:141)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.findSourceElements(AbstractSourceLookupDirector.java:742)
	at org.eclipse.cdt.dsf.mi.service.CSourceLookup$3.run(CSourceLookup.java:196)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

BTW, project-less debugging does not work natively on Windows, because the binary is not recognized as an executable by the default binary parser (which is always the ElfParser).
Comment 2 Marc Khouzam CLA 2011-05-02 11:00:18 EDT
(In reply to comment #1)
> Reason seems to be an Exception caused by ProgramRelativePathSourceContainer
> trying to get a project for an empty string:

It seems we missed the case of a project being an empty string in the fix to Bug 304433.

> BTW, project-less debugging does not work natively on Windows, because the
> binary is not recognized as an executable by the default binary parser (which
> is always the ElfParser).

I've opened Bug 344470 about this.
Comment 3 Marc Khouzam CLA 2011-05-02 11:02:31 EDT
Created attachment 194500 [details]
Fix

Fix which checks if a project is an empty string.

Committed to HEAD.
Comment 4 Marc Khouzam CLA 2011-05-02 11:03:48 EDT
Thanks for the help Toni.  Can you review the one line fix?
Comment 5 Marc Khouzam CLA 2011-05-02 11:12:01 EDT
A similar problem happens for multi-process and I've opened Bug 344471 about it.  I am looking into it.
Comment 6 CDT Genie CLA 2011-05-02 11:23:02 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 344408: Cannot show mixed-mode disassembly when doing project-less debug

[*] ProgramRelativePathSourceContainer.java 1.5 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/all/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/sourcelookup/ProgramRelativePathSourceContainer.java?root=Tools_Project&r1=1.4&r2=1.5