Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » How to debug a shared library and see its source?
How to debug a shared library and see its source? [message #199043] Fri, 03 August 2007 14:24 Go to next message
Eclipse UserFriend
Originally posted by: randy.electronsweatshop.com

I am using CDT 3.1.2 with Eclipse 3.2 under Gentoo Linux. I have a
project that calls some libraries I have written, and I would like to be
able to use the debugger to step through the library code. I have been
able to get my project to link with my libraries and run just fine, but
I am unable to step into the library code when debugging. I've tried
adding the path to the source code in the debug settings (under the
source tab) but that doesn't seem to work. When I try to "step into"
the library code, it just does a "step over". What settings can I use
to fix this? Thanks!

Randy

P.S. I'm new to the newsgroup, and I apologize if this has been asked
before. I did spend a reasonable amount of time searching the archives
for the answer to my question and didn't find it.
Re: How to debug a shared library and see its source? [message #199053 is a reply to message #199043] Fri, 03 August 2007 16:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

Have you built the libraries for debug? With gcc, this is -O0 -g3.

--
Derek


Randy Barlow wrote:
> I am using CDT 3.1.2 with Eclipse 3.2 under Gentoo Linux. I have a
> project that calls some libraries I have written, and I would like to be
> able to use the debugger to step through the library code. I have been
> able to get my project to link with my libraries and run just fine, but
> I am unable to step into the library code when debugging. I've tried
> adding the path to the source code in the debug settings (under the
> source tab) but that doesn't seem to work. When I try to "step into"
> the library code, it just does a "step over". What settings can I use
> to fix this? Thanks!
>
> Randy
>
> P.S. I'm new to the newsgroup, and I apologize if this has been asked
> before. I did spend a reasonable amount of time searching the archives
> for the answer to my question and didn't find it.
Re: How to debug a shared library and see its source? [message #199060 is a reply to message #199053] Fri, 03 August 2007 17:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: randy.electronsweatshop.com

Derek Morris wrote:
> Have you built the libraries for debug? With gcc, this is -O0 -g3.

Yes, the libraries have been built using the debug mode in Eclipse,
which does seem to use those flags by default. Other ideas?

R
Re: How to debug a shared library and see its source? [message #199068 is a reply to message #199060] Sat, 04 August 2007 03:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dmsubs.NOSPAM.consertum.com

1. Are you sure that it is the debug version of the libraries that are being
used at runtime?
2. Is the source to the libraries also available?
3. Have you tried setting a breakpoint in the library?
--
Derek


Randy Barlow wrote:
> Derek Morris wrote:
>> Have you built the libraries for debug? With gcc, this is -O0 -g3.
>
> Yes, the libraries have been built using the debug mode in Eclipse,
> which does seem to use those flags by default. Other ideas?
>
> R
Re: How to debug a shared library and see its source? [message #199081 is a reply to message #199068] Sat, 04 August 2007 14:11 Go to previous message
Eclipse UserFriend
Originally posted by: randy.electronsweatshop.com

Derek Morris wrote:
> 1. Are you sure that it is the debug version of the libraries that are
> being used at runtime?

Yes, as I haven't even built optimized versions on my devel machine
(laptop) as they are intended to be used on very powerful machines.
Also, in the Debug menu under the tab "Debugger" there is a tab for
"Shared Libraries" and I've included the debug versions of the two
libraries in question.

> 2. Is the source to the libraries also available?

Yes, they are libraries that I wrote, and I've put the paths to their
source code in the source tab of the Debug menu. I'm kind of wondering
if something more than that is necessary to get it to actually use that
source.

> 3. Have you tried setting a breakpoint in the library?

I have tried this, but it just doesn't seem to catch it.

If I hover the mouse over code items in the current file it will show me
context of the code that will be called at that point. If I hover over
a constructor for a class defined in one of my libraries, I see the
following messages in the console:

No symbol "new" in current context.
Stopped due to shared library event
Stopped due to shared library event
No symbol "mySpace" in current context.

mySpace is the name of the instance of the object I am trying to create
(don't worry, it has nothing at all to do with MySpace; I'm doing
scientific simulation here :) )

I believe these messages are coming from gdb, and gdb seems to do this
when it doesn't have the source code. I have noted one other oddity:

In the source tab of the debug menu, if I remove "Default" and just add
file system paths for all the source code in the project, it then can't
even find the source code for the current project (i.e., the one that
has int main()) and it will say something to the effect of "No source
found" where it would normally show source code and have a button that
says something like "Locate source code". I've tried just about every
combination to get it to come back, but the only thing that ever works
is to use the "Restore Defaults" button in the source tab. It seems
like this might possibly be a bug? Shouldn't putting the paths to all
the source code in the project that I want to debug (as in, I don't want
to debug into the C/C++ libraries :)) be all that is necessary in the
source tab?

Thanks for any further help you can offer!

R
Previous Topic:Debugger is creating breakpoints by itself as long as no resume has been called
Next Topic:download stats
Goto Forum:
  


Current Time: Wed May 07 12:10:41 EDT 2025

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

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

Back to the top