Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Where are debug launcher "source container" types documented?(I cannot find any documentation on what algorithms the built in built source containers use to locate files.)
Where are debug launcher "source container" types documented? [message #1754483] Sat, 18 February 2017 15:49 Go to next message
Roger James is currently offline Roger JamesFriend
Messages: 8
Registered: November 2016
Junior Member
Is there any doumentation on what the different source container types that you can add to the source lookup path in a debug launchc onfiguration actually do.

If not can, someone point me at where amongst the many source repositories and files I can find the code that implements this stuff. A URL would be nice.

On my installation I am offered the following container types.

1. Absolute file path - The does not ask for any additional parameters. So I have no idea what it does.

2. Compilation directory - This brings up a parameter dialog that has some explanation in it, I am guessing that this wants an absolute file system path that will be used as a root to be fed into the gdb path resolver.

3. File system directory. How is this different from number 2.

4. Path mapping. This is the only one I understand.

5. Program relative file path. Like number 1, so no idea.

6. Project - This asks for another project. But no information on how this affects the paths.

7. Project - Path relative to source folders. No explanation of what this means in this context.

8. Workspace - Asks for a workspace. . No explanation of what this means in this context.

9. Workspace folder - Asks for a folder in a workspace. No explanation of what this means in this context.


Thanks,

Roger


Re: Where are debug launcher "source container" types documented? [message #1754488 is a reply to message #1754483] Sat, 18 February 2017 17:00 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
There are a number of formats used to convey debug information contained within an executable.
Sort of documented here: https://sourceware.org/gdb/wiki/Internals%20Debugging-File-Formats
https://en.wikipedia.org/wiki/Debugging_data_format
There are others. Use google if you are interested in what a particular debugger might use.

As for where the source is located:
1. Absolute file path - An absolute path specified within the debug information block
2. Compilation directory - relative to the directory where the compile occurred
3. File system directory - any directory within the file system
4. Path mapping. - You say you understand this one.
5. Program relative file path - path relative to the location of the executable
6. Project - all directories within a given project are searched
7. Project - Path relative to source folders within a project (e.g., proj/src)
8. Workspace - All directories within the workspace
9. Workspace folder - Asks for a folder in a workspace - self explanatory

The source path types are listed here:
http://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_dbg_src.htm
What they mean specifically is not documented.

The default source search paths:
index.php/fa/28509/0/

[Updated on: Sat, 18 February 2017 19:45]

Report message to a moderator

Re: Where are debug launcher "source container" types documented? [message #1754521 is a reply to message #1754488] Sun, 19 February 2017 13:07 Go to previous messageGo to next message
Roger James is currently offline Roger JamesFriend
Messages: 8
Registered: November 2016
Junior Member
David,

Thank you for your quick response.
I am probably looking at this from too much of a gdb perspective, as that is the area with which I am familiar. I am afraid I have a few further clarification questions.

1. Absolute file path - An absolute path specified within the debug information block.
Looking at the gdb mi traces I see that this appears to modify the file paths sent to GDB. When it is present the the full absolute file path is sent to GDB, when it is not the path components are stripped off just leaving the file name itself. It does not alter the GDB source lookup path or the substitute-path rule set. Is this correct? I assume this means that only files for modules (programs or shared object libraries) that have an absolute path name in the debug info will be found. For files in modules with relative debug info another container must be used, or direct interaction with gdb to modify the source lookup path or the substitute-path rule set (i.e using .gdbinit or the command line).

2. Compilation directory - relative to the directory where the compile occurred
If this is specified files which have the head of their path matching the compile directory parameter have all the path striped off including components below the match leaving just the file name. Files not matching are left as absolute file name irrespective of whether a absolute path container is present or not. Once again the source lookup path and the substitute-path rule set are unmodified. This works for me even though you do get a warning that the source file cannot be found when the debugger tries to set it at startup before shared object modules are loaded.

Now I have found one that works I will leave it at that! But is there any written documentation about this complex topic anywhere?

Roger
Re: Where are debug launcher "source container" types documented? [message #1754533 is a reply to message #1754521] Sun, 19 February 2017 16:52 Go to previous messageGo to next message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
They seem to be for use only by Eclipse.

When I changed the source location to Program Relative, Eclipse tried to find the source at /home/dvavra/proj/Hello/Debug/src/Hello.cpp (which is <exec path>/<subdir 'src'>/Hello.cpp) for the first breakpoint. GDB had no trouble listing the code at the breakpoint. I'm not sure but I think /home/dvavra/proj/Hello/Debug/src was simply the last directory tried by Eclipse and not something from the debug info.

Compilation directory asked for the directory location then used that as the base directory path.

When I set a breakpoint, Eclipse sent the relative and absolute paths. In this case the debug source paths (in Eclipse) started at the project directory.

675,740 44-break-insert -f /home/dvavra/proj/Hello/src/Hello.cpp:73
675,741 44^done,bkpt={number="4",type="breakpoint",disp="keep",enabled="y",addr="0x0000000000400db3"\
,func="main()",file="../src/Hello.cpp",fullname="/home/dvavra/proj/Hello/src/Hello.cpp",line="73",th\
read-groups=["i1"],times="0",original-location="/home/dvavra/proj/Hello/src/Hello.cpp:73"}



The debug info in the executable has the path to the compilation directory (also the location of the executable) and a relative path to the source
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_producer    : (indirect string, offset: 0xf0): GNU C11 6.3.1 20161221 (Red Hat 6.3.1-1) -mtune=generic -march=x86-64 -g -O2 -fmessage-length=0
    <10>   DW_AT_language    : 12       (ANSI C99)
    <11>   DW_AT_name        : (indirect string, offset: 0x5b): ../src/Florp.c
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x1e): /home/dvavra/proj/Hello/Debug
 :
:
 <0><3f1>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <3f2>   DW_AT_producer    : (indirect string, offset: 0x43cf): GNU C++11 6.3.1 20161221 (Red Hat 6.3.1-1) -mtune=generic -march=x86-64 -g -O0 -std=c++11 -fmessage-length=0
    <3f6>   DW_AT_language    : 4       (C++)
    <3f7>   DW_AT_name        : (indirect string, offset: 0xc05): ../src/Hello.cpp
    <3fb>   DW_AT_comp_dir    : (indirect string, offset: 0x1e):  /home/dvavra/proj/Hello/Debug


If you've found something that works, by all means stick to it. The default settings work for me.

Re: Where are debug launcher "source container" types documented? [message #1754537 is a reply to message #1754483] Sun, 19 February 2017 19:04 Go to previous messageGo to next message
Roger James is currently offline Roger JamesFriend
Messages: 8
Registered: November 2016
Junior Member
The paths in the dwarf compile unit blocks are the same in my system.

I suspect the difference is I am using an external makefile project.

Once again does anyone know where or if this stuff is documented.

It really annoying when you get a message that a absolute path name that exists on the system cannot be found, and the breakpoint does not get its tiny almost invisible tick.

Roger
Re: Where are debug launcher "source container" types documented? [message #1754572 is a reply to message #1754537] Mon, 20 February 2017 12:37 Go to previous messageGo to next message
Jonah Graham is currently offline Jonah GrahamFriend
Messages: 416
Registered: June 2014
Senior Member
Hi Roger,

I don't know if this helps, but probably some of the info from CDT N&N is needed in the documentation: https://wiki.eclipse.org/CDT/User/NewIn90#Improved_Source_Lookup_Path_Mapping

The key line is "The new implementation uses the GDB feature "substitute-path" to allow the debugger backend to directly perform the mapping of the source path to the actual location."

HTH,
Jonah
Re: Where are debug launcher "source container" types documented? [message #1754605 is a reply to message #1754572] Mon, 20 February 2017 20:06 Go to previous message
Roger James is currently offline Roger JamesFriend
Messages: 8
Registered: November 2016
Junior Member
Jonah,

I had looked at that.

I have now discovered the root cause of my problems. The project I am working on is in eclipse terminology an external makefile project. This makefile uses ccache to cut down rebuilds. I have written a cautionary tail about using ccache in a debugging environment here https://lists.gt.net/mythtv/dev/606984. Suffice to say that if you have more than copy of a source hierarchy you can end up with unexpected debug information in objects in one tree that have unchanged source from ones that were previously compiled in another tree. The result is total confusion.

Roger
Previous Topic:Debug configuration does not attach automatically to the process
Next Topic:How to find all ifs, switch cases, etc.
Goto Forum:
  


Current Time: Thu Mar 28 12:41:16 GMT 2024

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

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

Back to the top