LinuxQuestions.org
Review your favorite Linux distribution.
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 10-16-2014, 04:37 AM   #1
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
gdb, debug with separate debug file and different source dir problem


Hi,

I have to use a special version for qt,
this comes with libQtWhatever.so.VERSION and libQtWhatever.so.VERSION.debug
I downloaded the Qt VERSION sources

now I need to debug and step through some Qt methods
but it does not work

I have used
set debug-file-directory /where/the/lib/are
(lib and lib.debug are in the same dir)

and
directory /where/I/expect/the/source

(in fact, for directory I used several versions, like ..src/widgets and src/widgets/graphicsview)


but it does not work, I can not step into the qt code and inspect the location where I have the crash

what am I doing wrong?
 
Old 10-16-2014, 06:19 AM   #2
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi.

Just guessing: are you sure that the executable file you are debugging actually uses your compiled library? Maybe you need to set LD_PRELOAD environment variable?
 
Old 10-16-2014, 07:07 AM   #3
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Original Poster
Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
using ldd I can see it points exactly to those libraries
there is also no alternative (since there are no other qt5 libs on this system)
so I assume that I am either doing something wrong, or files miss something

I am also not sure if I have a problem with the debug libs,
I get good info where the crash happens, backtrace an method call that causes the problem
but I can not step (nor does is stop at the location where the crash happens)

if this
Quote:
readelf -a libQt5Widgets.so.5.1.1 | grep debug
[25] .gnu_debuglink PROGBITS 00000000 5c857c 000024 00 0 0 1
a valid debuglink ?
 
Old 10-16-2014, 11:03 AM   #4
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 792

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Just guessing here, too:

Quote:
lib and lib.debug are in the same dir
Are there symlinks in the directory also? e.g.:
Quote:
@libQtWhatever.so
If so, try changing them to point to the respective debug libraries

Last edited by norobro; 10-16-2014 at 11:04 AM. Reason: typo
 
Old 10-16-2014, 11:32 AM   #5
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi.

Try
Code:
(gdb) sharedlibrary libQtWhatever
(gdb) info sources
to check that debug symbols are loaded and to find out where gdb expect to find source files for your library. What exactly happens when you try to step into some qt5 function?

Last edited by firstfire; 10-16-2014 at 11:34 AM.
 
1 members found this post helpful.
Old 10-17-2014, 01:55 AM   #6
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Original Poster
Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
sharedlibrary ....
Symbols already loaded for ....(full path)


info sources,
a long list, and the qt sources are loaded, so everything is here


it seems that my lookup path is messed up or I need to to a path substitution, need to find out what

when I step into qt function, nothing happens, (list shows nothing), tui is showing me my code where the call is done.


parts of sources look like this

Quote:

../../include/QtGui/5.1.1/QtGui/private/../../../../../src/gui/text/qtextdocumentlayout_p.h, .moc/debug-shared/moc_qgraphicsitem.cpp,
../../include/QtGui/5.1.1/QtGui/private/../../../../../src/gui/text/qtextengine_p.h, graphicsview/qgraphicsitem.cpp, ../../include/QtGui/../../src/gui/text/qtextobject.h,
../../include/QtGui/../../src/gui/text/qtextlayout.h, ../../include/QtGui/../../src/gui/text/qtextformat.h, ../../include/QtGui/../../src/gui/math3d/qmatrix4x4.h,
graphicsview/qgraphicsgridlayout.cpp, graphicsview/qgraphicsgridlayout.h, ../../include/QtWidgets/../../src/widgets/widgets/qplaintextedit.h,
../../include/QtWidgets/../../src/widgets/widgets/qtextedit.h, ../../include/QtWidgets/../../src/widgets/itemviews/qtableview.h,
../../include/QtWidgets/5.1.1/QtWidgets/private/../../../../../src/widgets/itemviews/qitemeditorfactory_p.h, ../../include/QtWidgets/../../src/widgets/widgets/qlineedit


or

Quote:
/home/somePerson/some/where/qt/qt-5.1.1/qt-everywhere-opensource-src-5.1.1/qtbase/include/QtCore/../../src/corelib/xml/qxmlstream.h,
so it seems I have to fiddle and play around with setting the right source dirs and path substitution
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Redirect all DEBUG statements to a separate log file rhssh Programming 1 12-30-2011 06:22 PM
debug library source in GDB/DDD knobby67 Programming 1 08-25-2009 02:24 PM
cannot debug with gdb ufmale Programming 9 04-27-2009 05:21 PM
gdb: problem while debug an executable file smartgupta Programming 2 10-16-2008 04:51 AM
gdb: missing the seperate debug info file vikhr Linux - Software 1 05-16-2008 01:08 AM

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

All times are GMT -5. The time now is 05:14 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