LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-26-2004, 01:36 PM   #1
markhod
Member
 
Registered: Sep 2003
Posts: 103

Rep: Reputation: 15
unable to step through function in shared object library using gdb


Hello,

I am using the 2.4.20-30HEP2.7smp kernel with gcc 2.95.3 and gdb 6.0 I compile many classes into a shared object library which is loaded into a piece of software called 'root'. From root I can run a macro which accesses the class member functions in the shared object library. The problem is a I get a segmentation fault and want to trace the problem. I can set a breakpoint easily enough:

(gdb) b 'TauSelector::SetCutNBitsComposite(TTree *, TauBoolArray, int, int, vector<int, allocator<int> >, TString)'
Breakpoint 1 at 0x4192da74
(gdb)

Then I continue the running of root and set my macro going from within root:

(gdb) c
Continuing.

root [0] .x macros/TestCode.cc

Breakpoint 1, 0x4192da74 in TauSelector::SetCutNBitsComposite () from /u/br/markhod/TauCPAnalysis/tmp/libTauCPAnalysis.so
(gdb)

When I try to step through the function I get told:
(gdb) n
Single stepping until exit from function SetCutNBitsComposite__11TauSelectorP5TTreeG12TauBoolArrayiiGt6vector2ZiZt9allocator1ZiG7TString,
which has no line number information.
0x41892aaa in TauKs0Selector::MakeKs0Selection () from /u/br/markhod/TauCPAnalysis/tmp/libTauCPAnalysis.so

How do I get the ability to step through the function line by line? I compiled with the options ROPT=-Debug-noOptimize and also tried compiling with ROPT=-Debug-noOptimize-shared, but in both cases the above happens.

Any ideas where I am going wrong?

Thanks,

Mark
 
Old 04-26-2004, 04:32 PM   #2
markhod
Member
 
Registered: Sep 2003
Posts: 103

Original Poster
Rep: Reputation: 15
Hi,

It turns out the rather simple solution is to subsitute 'g++' for 'g++
-g' everywhere in my makefile. There is no need to pass options
ROPT=-Debug-noOptimise to gmake as far as I see. With just the -g option
to g++ I get line numbers and can finally debug my code

Thanks,

Mark
 
Old 01-03-2009, 02:00 AM   #3
Rodrex Lee
LQ Newbie
 
Registered: May 2008
Posts: 6

Rep: Reputation: 0
Hello markhod,

i am just one step back stuck from u;me not able to set breakpoint in shared library fucntion;The shared library is in c++ & contains overloaded function;i just dont know whether the problem is due to overloaded fucntion or memory mapping problem of shared library i.e setting the breakpoint before the memory map of shared library is available.

whenever i try to set the breakpoint like this:-
[root $]b 'BPatch_addressSpace::insertSnippetAtPointsWhen(BPatch_snippet const&, std::vector<BPatch_point*, std::allocator<BPatch_point*> > const&, BPatch_callWhen, BPatch_snippetOrder)'
Cannot access memory at address 0x399754

it never stops & never goes inside library function to track the function step by step

also when stepping inside the application;gdb says unable to find the header files

hey!!! i am little bit confused wid all;please help me out ;if u r able to atleast set the breakpoint;may be we can move together to get all the things up!!!

hoping ur reply soon

regards,
rodrex.

Last edited by Rodrex Lee; 01-03-2009 at 02:34 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: Franziss Linux - Newbie 10 06-28-2010 05:47 AM
gdb won't single step thru the function frankie_DJ Programming 2 10-06-2004 05:50 AM
error while loading shared libraries: libdb-4.1.so: cannot open shared object file putquery8581 Linux - Software 1 10-01-2004 07:03 AM
canīt step into shared library captainfreedom Programming 3 05-23-2004 01:12 PM
shared object library won't load (libstdc++) sleepylight Linux - General 4 04-27-2004 04:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration