Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » What is the best/correct way to specify debugger source containers for an external makefile project
What is the best/correct way to specify debugger source containers for an external makefile project [message #1748295] Mon, 21 November 2016 20:31 Go to next message
Roger James is currently offline Roger JamesFriend
Messages: 8
Registered: November 2016
Junior Member
I have played with a number of different ways of specifying source paths to the gdb debugger for an external makefile project. None of them work consistently in all circumstances.

With just the default source container and it's default children. I get source file not found errors in the gdb console window. These contain the full correct source path and filename for my system, this full path is what is in the debug info for the executable. If I run gdb standalone and entry this path as a source directory gdb would find the file whether the full path was specified in the debug info or not. Since under eclipse CDT neon it does not, I can only assume that the red error message in the gdb console window is not put there by GDB or that GDB has been asked to look on path that is not the one reported in the message.

Is this correct?

Secondly if my assumption the children of the default source container are themselves source containers is correct. How do I found out what their parameters are? Searching the user documentation I cannot even find a definition of what a source container actually is, though I can guess. Can anyone help me with this.

If I add a compilation path source container after the default source container and set it to the top of my source tree, at least I can set breakpoints. However I still get a source file not found error, but this time it just contains the file name not the full path.
Can anyone tell me why this is?

Also in the second case above not all things work when debugging. So something in this setup is not working biderectionally.

I have searched for answers to these questions. They seem to have been asked in many different forms, but never fully answered. A definition of what a source path container is that can be added to the user documentation would be a good start.

If I am being dumb and have missed something obvious please accept my apologies, and tell me what it is.

Roger
Re: What is the best/correct way to specify debugger source containers for an external makefile proj [message #1748417 is a reply to message #1748295] Wed, 23 November 2016 00:11 Go to previous messageGo to next message
David VavraFriend
Messages: 1415
Registered: October 2012
Senior Member
I use makefiles almost exclusively.
I am using MARS.2 and have had no problems with the debugger.
Here is the default debug dialog source tab settings for one of my projects:

index.php/fa/27667/0/

The entire project view has been added automatically,
I don't have any subdirectories in my source directory but, since all of the directories in the project have been included, I can only assume any subdirectories would have been included.

Not sure what you mean about finding parameters of source directories.

Is it possible that your programs were linked with the wrong debug information?
Three are a number of Linux utilities that will dump the debug information: nm, readelf and objdump come to mind.


Re: What is the best/correct way to specify debugger source containers for an external makefile proj [message #1748465 is a reply to message #1748417] Wed, 23 November 2016 11:09 Go to previous messageGo to next message
Roger James is currently offline Roger JamesFriend
Messages: 8
Registered: November 2016
Junior Member
Hi David,

I am using Neon. I think the source mapping stuff has been rewritten in this release.

The debug information in my executable has correct full absolute path names to the relevant files.

Your image shows a tree of source path containers, not a file system tree. Here is what it looks like on my system.

index.php/fa/27675/0/

So the little blue folder icon is a "project" source container that have as an attribute (parameter) the absolute file system directory for the project. The items underneath it are file system directory source containers that should have as an attribute a file system relative or absolute path. So the combination of the project source container and file system directory source container and its children should provide atributes to construct a file system path to the source files (I think Confused ).

My problem is that I cannot work out why it is not working on my system because I cannot "edit" the default container or its children to see what their current attributes are.

Roger


Re: What is the best/correct way to specify debugger source containers for an external makefile proj [message #1748473 is a reply to message #1748465] Wed, 23 November 2016 12:59 Go to previous messageGo to next message
David VavraFriend
Messages: 1415
Registered: October 2012
Senior Member
Doesn't appear to have been materially changed in NEON from MARS.
The Add button is adding mostly whole directories and subdirectories.

Workspace Folder allowed me to add a single folder from the selected workspace.
File System Directory allowed me to add a selected directory from the file system.
[i]Workspace[/] added every project tree in the workspace.


The name of your project is "master"?
It has been added to the configuration already.
If the list in the configuration contains the source directory of interest I would think gdb would find it.

Did you try dumping the debug information in the executable?
Doing so may give you a clue as to how to specify the source location.

You can run gdb as a stand-alone to see what it is up to.
You can also interact with gdb from the gdb console in Eclipse when debugging.

There are a number of commands related to the gdb search list.
One of the is show substitute-path
Although I didn't get anything when I tried it. Eclipse may not use it.
Here's the full command list: https://sourceware.org/gdb/onlinedocs/gdb/Source-Path.html

FWIW:
I also got three messages saying source could not be found.
None of them are in my program but there are old breakpoints to them.
I can see Eclipse trying to set them in the gdb Trace console (I've shown the last).
Apparently old information as there are no breakpoints currently set in the source.

bkpt={number="6",type="breakpoin\
t",disp="keep",enabled="y",addr="<PENDING>",pending="/home/dvavra/proj/HCP-FANN/src/Train.cpp:277",t\
imes="0",original-location="/home/dvavra/proj/HCP-FANN/src/Train.cpp:277"}]

No source file named /home/dvavra/proj/knnl-0.1.4/knnl/source/main.cpp.
No source file named /home/dvavra/proj/fann/src/fann_io.c.
No source file named /home/dvavra/proj/HCP-FANN/src/Train.cpp.

These I ignore.
If gdb can't find the source, when you step into it, Eclipse will offer to display the disassembly.
Re: What is the best/correct way to specify debugger source containers for an external makefile proj [message #1748487 is a reply to message #1748473] Wed, 23 November 2016 14:49 Go to previous messageGo to next message
Roger James is currently offline Roger JamesFriend
Messages: 8
Registered: November 2016
Junior Member
Hi David,

With just the normal default source container tree set. The debugger can find files in any files in the diectories in and below the directory where the main executable resides. In my case this is
/home/roger/mythdev/mythrfj/mythtv/programs/mythbackend

Files from anywhere else in my source tree such as
/home/roger/mythdev/mythrfj/libs/libmythtv

Cannot be found.

If I delete the default container and replace with a project source container identical to the one under the default container. Then no files at all can be found. This means that files are being found by either the absolute file path container or the program relative containers, show that the files are being found via the absolute path container. Repeating the experiment I did with the project source container with the other containers, I found that files were being found by the absolute path container. I also found out that neither of these containers have parameters (which is probably why you cannot edit them to see what they are set to). So it means that means that they are finding source by some kind of algorithm. Which goes back to one of my original questions. Where is this stuff documented?

But that leaves me with my problem with finding files from other parts of my source tree.


Quote:

Re: What is the best/correct way to specify debugger source containers for an external makefile proj Wed, 23 November 2016 12:59
David Vavra
Doesn't appear to have been materially changed in NEON from MARS.
The Add button is adding mostly whole directories and subdirectories.

//https://kichwacoders.com/2016/04/12/improved-cdt-source-lookup-path-mappings-in-neon/
Quote:

Workspace Folder allowed me to add a single folder from the selected workspace.
File System Directory allowed me to add a selected directory from the file system.
[i]Workspace[/] added every project tree in the workspace.


The name of your project is "master"?
It has been added to the configuration already.

Yes. I know.
Quote:

If the list in the configuration contains the source directory of interest I would think gdb would find it.

It doesn't. See above.
Quote:

Did you try dumping the debug information in the executable?
Doing so may give you a clue as to how to specify the source location.

I mentioned doing that in my original message Smile. The source paths in the debug info are all absolute paths that are correct for my file system. Here is one that is found by absolute path container.
0000000000000000 T _ZN28MythBackendCommandLineParserC1Ev	/home/roger/mythdev/mythrfj/mythtv/progr
ams/mythbackend/commandlineparser.cpp:6

and here is one that is not
0000000000001388 r _ZZN11EitCacheDVB13ScheduleTable14ProcessSectionEPK24DVBEventInformationTablebR4QMapIy28QExplicitlySharedDataPointerINS_5EventEEEyE12__FUNCTION__	/home/roger/mythdev/mythrfj/mythtv/libs/libmythtv/eitcachedvb.cpp:310

Quote:

You can run gdb as a stand-alone to see what it is up to.
You can also interact with gdb from the gdb console in Eclipse when debugging.

There are a number of commands related to the gdb search list.
One of the is show substitute-path
Although I didn't get anything when I tried it. Eclipse may not use it.
Here's the full command list: https://sourceware.org/gdb/onlinedocs/gdb/Source-Path.html

I tried all that a number of times. The substitute search path is empty when the debugger is run by eclipse.
Quote:

FWIW:
I also got three messages saying source could not be found.
None of them are in my program but there are old breakpoints to them.
I can see Eclipse trying to set them in the gdb Trace console (I've shown the last).
Apparently old information as there are no breakpoints currently set in the source.

bkpt={number="6",type="breakpoin\
t",disp="keep",enabled="y",addr="<PENDING>",pending="/home/dvavra/proj/HCP-FANN/src/Train.cpp:277",t\
imes="0",original-location="/home/dvavra/proj/HCP-FANN/src/Train.cpp:277"}]

No source file named /home/dvavra/proj/knnl-0.1.4/knnl/source/main.cpp.
No source file named /home/dvavra/proj/fann/src/fann_io.c.
No source file named /home/dvavra/proj/HCP-FANN/src/Train.cpp.

If eclipse is setting them, then Run/Remove All Breakpoints should get rid of them. Razz

I am struggling to make sense of all this. Eclipse is a steep learning curve for me.

I am going to try adding absolute path containers individually for the libraries. But this does not seem the right way to do this.

I am now convinced that the "source file not found" messages are being generated by eclipse from the returns from the gdb api and that the text of the messages does not accurately represent what gdb has been asked to look for.

Any comments anyone.

Cheers

Roger
Re: What is the best/correct way to specify debugger source containers for an external makefile proj [message #1748501 is a reply to message #1748487] Wed, 23 November 2016 16:24 Go to previous message
David VavraFriend
Messages: 1415
Registered: October 2012
Senior Member
The gbd trace should show what actions correspond to the messages. When I debug with ddd vs. Eclipse I don't get the errors which are the result of Eclipse setting phantom breakpoints. Run/Remove All Breakpoints likely would remove them but it wasn't my point (granted I wasn't clear enough) and not something I care to do.

I don't have any problems with symbols and breakpoints in the two libraries that I refence from this project. Note they aren't even mentioned in the debug configuration. In fact, adding the directories for the sources in the missing messages in my post won't fix anything because they really don't exist in the executable.

Maybe you should to submit a bug report instead of posting here but you should submit a gdb trace with it.
Previous Topic:How do I find out what the current settings are for the children of the default source container
Next Topic:Adding pkg_config as linker option
Goto Forum:
  


Current Time: Tue Jan 25 21:16:01 GMT 2022

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

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

Back to the top