LinuxQuestions.org
Visit Jeremy's Blog.
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 01-31-2011, 12:34 AM   #1
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Debugging QT project through GDB in COMMAND LINE


First step will obviously be to compile the QT project with -g option, but how to do that through command line?
 
Old 01-31-2011, 03:36 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Anisha Kaul View Post
First step will obviously be to compile the QT project with -g option, but how to do that through command line?
Doesn't Qt build mechanism have a notion of compiler switches ?

Anyway, one can always write a wrapper around 'g++' so that the wrapper would actually call 'g++ -g ...', and provide the wrapper through $PATH or as compiler to a build mechanism.
 
1 members found this post helpful.
Old 01-31-2011, 03:52 AM   #3
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Thanks for responding, but I couldn't understand much of your post.

With the compiler switches did you mean this? http://doc.trolltech.com/4.3/qmake-v...html#qmake-cxx

You mean I am supposed to put QMAKE_CXXFLAGS_DEBUG in the Makefile? or I am barking at the wrong tree?
 
Old 01-31-2011, 04:13 AM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by Anisha Kaul View Post
Thanks for responding, but I couldn't understand much of your post.

With the compiler switches did you mean this? http://doc.trolltech.com/4.3/qmake-v...html#qmake-cxx

You mean I am supposed to put QMAKE_CXXFLAGS_DEBUG in the Makefile? or I am barking at the wrong tree?
Looks like QMAKE_CXXFLAGS_DEBUG is the right thing to use.
 
Old 02-02-2011, 02:25 AM   #5
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
I have added this to the .pro file:
Code:
QMAKE_CXXFLAGS_DEBUG *= -pg
QMAKE_LFLAGS_DEBUG *= -pg
inspired from here: http://www.qtcentre.org/archive/index.php/t-4957.html
 
Old 02-02-2011, 05:31 AM   #6
mac.tieu
Member
 
Registered: Jan 2010
Location: Vietnam
Distribution: Arch
Posts: 65

Rep: Reputation: 22
Try to run 'qmake' again with parameter 'CONFIG+=debug' then 'make clean' and 'make'.

MT.
 
Old 02-02-2011, 05:40 AM   #7
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731

Original Poster
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Thanks but I am using QtCreator, so I just build the project through QtCreator and then when I ran the the executable with GDB, GDB was able to read the symbols.
 
  


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
DISCUSSION: Debugging with GDB (Part 1) Matir LQ Articles Discussion 4 11-09-2016 10:33 PM
debugging with GDB jone kim Linux - General 2 04-13-2010 12:22 AM
Debugging a GUI application with gdb pamparana Programming 1 04-01-2009 11:36 AM
Debugging Problem in Gdb akm3 Programming 5 01-01-2009 10:03 AM
Help debugging with gdb and core files moon.es Programming 1 05-28-2005 04:58 AM

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

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