Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] source lookup question

On Mon, Dec 28, 2015 at 3:44 PM, Jonah Graham <jonah@xxxxxxxxxxxxxxxx> wrote:
Hi Alena,

I agree with you, it is part of my plan for CDT 9 to improve this area off the back of the knowledge I have gained. It is quite a bit of work, but the end goal is a much more simplified UI in this respect. For example, post GDB 7.6 there are only two sensible source lookup types, Absolute and Mapping. Everything else is being left around for pre 7.6 behaviour or other non-GDB backends. One of the problems I have is I don't have access to any of these.

This also gets down to one of the challenges going forward. What is CDT's purpose? Is CDT building blocks for companies to customize and create IDEs? Or is it supposed to /just work/ out of the box? And on the latter, which cases should it just work for? For example, http://eclip.se/444816 is really interesting as a thought experiment, but how much effort should we undergo to make  http://gittup.org/tup/ work out of the box with CDT? I am not expecting answers to these questions, but if there are any out there....

I can answer that one. It's for both vendors and users. I don't think we'd have much of a community if we just focused on one of them. The more people we have with a vested interest in making CDT great, the more likely they'll fix and implement the things they need, that we all need.

Doug
 

Thanks,
Jonah

~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com

On 28 December 2015 at 19:46, Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx> wrote:
Thanks for the detailed explanation, I wish we have this in the docs or in the tooltips/detailed text somewhere in UI when user has to make selection, because I am afraid nobody but you has this knowledge.


On Mon, Dec 28, 2015 at 2:31 PM, Jonah Graham <jonah@xxxxxxxxxxxxxxxx> wrote:
Hi Alena,

There is at least one other big difference between (platform's) DirectorySourceContainer and  (CDT's) CompilationDirectorySourceContainer. The latter implements (CDT's) IMappingSourceContainer. This means that when breakpoints are inserted (and similar operations that need to translate from local machine path to compilation path, such as run to line) when using CompilationDirectorySourceContainer you will get the full compilation path added to breakpoint insertions.

This is the set-up for the below example:
$ pwd
/scratch/eclipse/src/cdt/runtime-CDT/HelloWorld/compilationdirectory
$ gcc -g -o program.exe src/main.c
Then I reorganized things a bit:
$ cd ..
$ mv compilationdirectory relocatedcompilationdirectory

then you have two choices:
1) Remove "Program Relative File Path" from your lookup
2) move the program itself somewhere else so that "Program Relative File Path" does not work.

Once you do that, debug the program and CDT will not be able to locate the source because GDB has only provided the relative directory (src/main.c) in the MI output:

761,836 *stopped,reason="end-stepping-range",frame={addr="0x00000000004004f6",func="main",args=[],fi\
le="src/main.c",line="3"},thread-id="1",stopped-threads="all",core="2"

Using either DirectorySourceContainer or CompilationDirectorySourceContainer with a folder set as 
/scratch/eclipse/src/cdt/runtime-CDT/HelloWorld/relocatedcompilationdirectory will locate the file correctly.

However, only CompilationDirectorySourceContainer will allow you to insert breakpoints because only it does the reverse translation.

This is the MI when inserting a breakpoint using a DirectorySourceContainer:
435,345 38-break-insert -f /scratch/eclipse/src/cdt/runtime-CDT/HelloWorld/relocatedcompilationdirec\
tory/src/main.c:3
435,346 &"No source file named /scratch/eclipse/src/cdt/runtime-CDT/HelloWorld/relocatedcompilationd\
irectory/src/main.c.\n"
435,348 38^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending=\
"/scratch/eclipse/src/cdt/runtime-CDT/HelloWorld/relocatedcompilationdirectory/src/main.c:3",times="\
0",original-location="/scratch/eclipse/src/cdt/runtime-CDT/HelloWorld/relocatedcompilationdirectory/\
src/main.c:3"}

And this for the CompilationDirectorySourceContainer:

435,349 34-break-insert -f src/main.c:3
435,350 34^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x00000000004004f6"\
,func="main",file="src/main.c",line="3",times="0",original-location="src/main.c:3"}


Unfortunately the story does not end there. Because the above all applies to GDB <= 7.5. In GDB >= 7.6 neither DirectorySourceContainer nor CompilationDirectorySourceContainer work at all. Starting with GDB 7.6 if GDB can't locate a file it returns a full path to where it thinks the file should be in the fullname field, i.e. the absolute compilation directory. Here is what the MI looks like (compare to the above *stopped):
666,021 *stopped,reason="breakpoint-hit",disp="del",bkptno="2",frame={addr="0x00000000004004f1",func\
="main",args=[],file="src/main.c",fullname="/scratch/eclipse/src/cdt/runtime-CDT/HelloWorld/compilat\
iondirectory/src/main.c",line="2"},thread-id="1",stopped-threads="all",core="1"


I recently added a test case that demonstrates some of the above as part of the work for http://eclip.se/472765. The test that shows directory source not working with >= 7.6 is http://eclip.se/478805

Please let me know if I can be of more assistance. I would also appreciate any reviews you can make to my changes for http://eclip.se/472765.

Thanks,
Jonah

~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com

On 10 December 2015 at 00:37, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
I suspect that there was something in implementation of DirectorySourceContainer that made it unsuitable to be used to solve the scalability problem described in https://bugs.eclipse.org/bugs/show_bug.cgi?id=225805 but I don't remember what it was. https://bugs.eclipse.org/bugs/show_bug.cgi?id=225805#c18 and the following comments may shed some light on it.

-sergey

On Wed, Dec 9, 2015 at 3:50 PM, Alena Laskavaia <elaskavaia.cdt@xxxxxxxxx> wrote:
Call me dumb but I still don't know what is the difference. Both are directory on filesystem. Both will only work
when path is relative, because if it is absolute I assume you need path mapping instead. First one can return IFile and second don't?



On Wed, Dec 9, 2015 at 2:56 PM, Sergey Prigogin <eclipse.sprigogin@xxxxxxxxx> wrote:
The Javadoc of CompilationDirectorySourceContainer reads:
/**
 * A directory in the local file system that is used for running the C/C++ compiler. This container
 * is intended to be used when debugging information produced by the C/C++ compiler contains paths
 * to the source and header files relative to the directory where the compiler is run from.
 * The assumption is that all files under a compilation directory are compiled relative to
 * that directory, unless they belong to another compilation directory container that is higher on
 * the source container list.
 * 
 * Source elements returned from <code>findSourceElements(...)</code> are instances of
 * <code>IFile</code> or <code>LocalFileStorage</code>.
 * <p>
 * Clients may instantiate this class. 
 * </p>
 * @noextend This class is not intended to be subclassed by clients.
 */

The Javadoc of DirectorySourceContainer for comparison:
**
 * A directory in the local file system. Source elements returned
 * from <code>findSourceElements(...)</code> are instances
 * of <code>LocalFileStorage</code>.
 * <p>
 * Clients may instantiate this class.
 * </p>
 * @since 3.0
 * @noextend This class is not intended to be subclassed by clients.
 */

-sergey

On Wed, Dec 9, 2015 at 11:05 AM, Mikhail Khodjaiants <mikhailkhod@xxxxxxxxxxxxxx> wrote:
Oh, I wasn't aware of it. Wasn't sure whether you were asking about the "Compilation directory" field in the path mapping dialog of the source lookup.
Regarding the "Compilation Directory" source container type, its' a question for Sergey. He contributed it.


On 09/12/2015 1:28 PM, Alena Laskavaia wrote:
In Source tab of debug configuration, I am not sure how its called, its for source lookup

On Tue, Dec 8, 2015 at 4:48 PM, Mikhail Khodjaiants <mikhailkhod@xxxxxxxxxxxxxx> wrote:
On 08/12/2015 3:35 PM, Alena Laskavaia wrote:
Is there practical difference between Compilation Directory and File System Directory
as source lookup containers? They both seems to accept only absolute path

Are you asking about path mapping?




_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev




_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev




_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top