Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Setting a debug configuration
Setting a debug configuration [message #525635] Wed, 07 April 2010 09:53 Go to next message
Harry Houdini is currently offline Harry HoudiniFriend
Messages: 142
Registered: February 2010
Senior Member
Hello,

I want to set a debug configuration, but I am experiencing some troubles.

First of all, some pieces of information :

1. my project is a dynamic library, so I have to atatch it to a host application.
2. I use SConS to generate my object files (see at the end for details)
3. I use GDB (DSF)

For debug, I chose "C/C++ Atatch to Application". Here are my debug settings :

Main tab :
Project : my project's name, selected with the Browse button
C/C++ Application : the .so generated by SCons

Debugger tab :
Main tab :
GDB debugger : gdb/mi
All other controls are empty/unchecked
Share Libraries :
Driectories : empty
Load shared library symbols automatically : checked
Use shared library symbols for debugger applications

Source tab :
Source Lookup Path : my project
Search for Duplicate source files on the path

Common tab :
everything with its defalut value


SCons generate the object files (.os) and the dynamic library (.so) in an other place than the source files. Then the .os file is moved away agin at an other location on the hard drive. Tha's the file I set in the Debug configuration main tab.

Next, I run the debug session. SCons build the project, copy the files.. Next I attach to the host application. But in the sources part, I get a .csettings tab,a nd a message saying : "Resource '/myProject/.csettings does not exist".

There is a .csettings directory in my project directory, but my project isn't as the roolt level (why is there a starting / in the message ??).

EDIT : The console says
.dynamic section for "myProject.so" is not at the expected address (wrong library or version mismatch?)

Thanks for help.

[Updated on: Wed, 07 April 2010 13:27]

Report message to a moderator

Re: Setting a debug configuration [message #525667 is a reply to message #525635] Wed, 07 April 2010 12:32 Go to previous messageGo to next message
Marc Khouzam is currently offline Marc KhouzamFriend
Messages: 357
Registered: July 2009
Senior Member
> Next I attach to the host application.

You do this through the dialog window that comes up after you launch?

> But in the sources part, I get a .csettings tab,a nd a message saying : "Resource '/myProject/.csettings does not exist".

I don't understand what you mean by "in the sources part"

Marc
Re: Setting a debug configuration [message #525668 is a reply to message #525635] Wed, 07 April 2010 12:32 Go to previous messageGo to next message
Toralf Lund is currently offline Toralf LundFriend
Messages: 70
Registered: July 2009
Member
Hmmm... I could be wrong, but as far as I understand, "Attach to Application" doesn't quite work the way you seem to assume. I believe it's normally used to connect a debug session for an executable given by "C/C++ Application", to an already existing process created by starting exactly that executable. And not to associate a shared object with an executable or similar.

Also, when you are debugging a normal application, you can "debug into" any .so file that application happens to load.

In other words, you might want to create a small test application that links to your .so file, and fill in the path to this in "C/C++ Application". Or, why not use the one you already seem to have, i.e. the "host application" you are referring to?

As for the error message, I've noticed in the past that when a source file given in the program's symbol table could not be found on the file system, the resource name in the error message was fairly meaningless. In other words, it did not give the name of the file that was actually missing. So ".csettings" might not be what you really need to look for...
Re: Setting a debug configuration [message #525671 is a reply to message #525667] Wed, 07 April 2010 12:37 Go to previous messageGo to next message
Harry Houdini is currently offline Harry HoudiniFriend
Messages: 142
Registered: February 2010
Senior Member
Marc Khouzam wrote on Wed, 07 April 2010 08:32
> Next I attach to the host application.
You do this through the dialog window that comes up after you launch?

Yes.

Quote:
I don't understand what you mean by "in the sources part"

The workbench area where there are the sources to debug.
Re: Setting a debug configuration [message #525683 is a reply to message #525668] Wed, 07 April 2010 13:09 Go to previous messageGo to next message
Harry Houdini is currently offline Harry HoudiniFriend
Messages: 142
Registered: February 2010
Senior Member
Toralf Lund wrote on Wed, 07 April 2010 08:32
Hmmm... I could be wrong, but as far as I understand, "Attach to Application" doesn't quite work the way you seem to assume. I believe it's normally used to connect a debug session for an executable given by "C/C++ Application", to an already existing process created by starting exactly that executable. And not to associate a shared object with an executable or similar.

So what should I put in the field ? The host application, or the same project, but compiled/linked as a .so ?
Re: Setting a debug configuration [message #525693 is a reply to message #525683] Wed, 07 April 2010 13:34 Go to previous messageGo to next message
Toralf Lund is currently offline Toralf LundFriend
Messages: 70
Registered: July 2009
Member
Oodini wrote on Wed, 07 April 2010 09:09
Toralf Lund wrote on Wed, 07 April 2010 08:32
Hmmm... I could be wrong, but as far as I understand, "Attach to Application" doesn't quite work the way you seem to assume. I believe it's normally used to connect a debug session for an executable given by "C/C++ Application", to an already existing process created by starting exactly that executable. And not to associate a shared object with an executable or similar.

So what should I put in the field ? The host application, or the same project, but compiled/linked as a .so ?

The host application.
Re: Setting a debug configuration [message #525701 is a reply to message #525693] Wed, 07 April 2010 13:52 Go to previous messageGo to next message
Harry Houdini is currently offline Harry HoudiniFriend
Messages: 142
Registered: February 2010
Senior Member
Thanks ! It's better. The execution does top at the break points.

But in the Error Log tab, I get many errors :

Internal error logged from CDI Debug:
C Model Exception: C Model Status [Invalid path ... ]

My project has many directories, but the sources are only in one of them. So, in "Source Lookup Path", I put a Workspace Folder (the one containing the source).

It seems that gdb explore the directories from where is located the my .so, go up, and try to do something with .so located in other directories...

Does the debugger know anything about what has been built ?

[Updated on: Wed, 07 April 2010 13:54]

Report message to a moderator

Re: Setting a debug configuration [message #525709 is a reply to message #525701] Wed, 07 April 2010 14:20 Go to previous message
Toralf Lund is currently offline Toralf LundFriend
Messages: 70
Registered: July 2009
Member
I'm not sure I understand exactly what you mean, and I'm not familiar with the exact error message, but note that:

  1. I've never added any specific path items to my debug configurations; they just have "Default", which in turn contains the project name as well as "Absolute File Path". The project entry may in turn be expanded into the entire source code directory tree, relative to the project location. This is not something I've filled in - it just appears automatically. It should Just Work in most cases, and there is probably little to gain from restricting the search even though you know only some of the directories have source code.

  2. The .so file that's consulted for debug info etc. is probably the one actually loaded by the executable, and which this will be if you have multiple versions, is controlled by mechanisms outside Eclipse.


Also, generally, what the debugger knows, is what it can read from the excutable itself - and the shared object it loads. Which includes information on what source code files were used, provided that the compiler and linker was told to include "debugging information" (and this hasn't been "stripped" after the build.) The source files are stored with full paths, but you may also tell the debugger to look for them on different locations (e.g. via the option you mentioned.)
Previous Topic:import xxx.
Next Topic:How to implement assembly language content assist
Goto Forum:
  


Current Time: Fri Apr 26 13:28:18 GMT 2024

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

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

Back to the top