Author Topic: How to debug application compiled from an external Makefile ?  (Read 4939 times)

Offline rix

  • Single posting newcomer
  • *
  • Posts: 5
How to debug application compiled from an external Makefile ?
« on: November 18, 2005, 11:48:14 am »
Hi there,

I'm working on an application based on Qt opensrc edition.
I setup the following options in my project:

  Project - Properties - [X] This is a custom Makefile
  Build - Compiler options - Others - Build method: Work with Makefiles

to be able to properly compile by using the Makefile generated by qmake.
However, when I try to debug, I get the following:

  Selecting target: default
  Compiling: failed
  Aborting debugging session

So I tried to change the following:

  Project - Properties - Target - default - Type: Command only

But in this case, I get a message "Can't debug such a target..."
I'm using C::B 1.0-rc2 + MinGW 5.0 (so independant to C::B) + gdb 5.2.1

So how can I debug through C::B but at the same time compile from an external makefile?
(my objective is in fact to be able to use qmake generated Makefiles as much as possible, while being able to use C::B wonderfull editor and debug features at the same time)

Offline rix

  • Single posting newcomer
  • *
  • Posts: 5
Re: How to debug application compiled from an external Makefile ?
« Reply #1 on: November 21, 2005, 10:17:44 am »
... no one having an idea ? :(

Compilation from C::B is working properly (by using my existing makefile), but I'm unable to debug (either with a 'Compiling: failed' message or a 'Can't debug such a target' message)!
I really would like to use C::B to edit and debug, so if someone has any idea on how to create such a project, it would be really helpful to me.
« Last Edit: November 21, 2005, 10:20:25 am by rix »

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: How to debug application compiled from an external Makefile ?
« Reply #2 on: November 21, 2005, 10:31:38 am »
Hello,

Just a small suggestion. May be you can try to search the C::B forum for Qt topics. There are some and may be one of them could be useful. You can also try to write an email to Qt-interest forum. May be someone can help you.

Best wishes,
Michael
 

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: How to debug application compiled from an external Makefile ?
« Reply #3 on: November 21, 2005, 10:58:36 am »
... no one having an idea ? :(

Compilation from C::B is working properly (by using my existing makefile), but I'm unable to debug (either with a 'Compiling: failed' message or a 'Can't debug such a target' message)!
I really would like to use C::B to edit and debug, so if someone has any idea on how to create such a project, it would be really helpful to me.

The problem lies in the debugger trying to make sure everything is built before debugging so that you 're actually debugging an up-to-date version of your code.
When you get this:
Code
  Selecting target: default
  Compiling: failed
  Aborting debugging session

what is printed in the Build Log?
Be patient!
This bug will be fixed soon...

Offline rix

  • Single posting newcomer
  • *
  • Posts: 5
Re: How to debug application compiled from an external Makefile ?
« Reply #4 on: November 21, 2005, 11:15:15 am »
Thank you very much for the suggestions, guys!

what is printed in the Build Log?

Well, the debugger is starting now.
In fact, the Makefile autogenerated by qmake didn't contain a 'default' rule, but only 'debug' and 'release' rules. ;)
I renamed the 'default' rule to 'debug' in C::B, and the debugger started!
However, now, I'm having the following problem:

Code
Starting debugger: done
Adding source dir: Z:\qt_applications\current\qt\
Adding file: Z:\qt_applications\current\qt\qt_app.exe
Changing directory to: Z:/QT_APP~1/current/qt
ðò: No such file or directory.
error
error

The debugger seems to be started anyway (Debug - Debug command is grayed, and Debug - Stop debugger is enabled), but I can't use any debug commands.
Any idea on where these 'No such file or directory' and 'error' messages come from?
« Last Edit: November 21, 2005, 11:17:41 am by rix »

Offline rix

  • Single posting newcomer
  • *
  • Posts: 5
Re: How to debug application compiled from an external Makefile ?
« Reply #5 on: November 21, 2005, 11:21:41 am »
After having a look at http://cvs.sourceforge.net/viewcvs.py/codeblocks/codeblocks/src/plugins/debuggergdb/debuggergdb.cpp?view=markup ,
seeing how the 'Changing directory to:' was displayed in DebuggerGDB::Debug(), I tried to specify 'Execution working dir' to '.', to skip this directory change.
But I always get the following:

Code
Selecting target: debug
Compiling: done
Starting debugger: done
Adding source dir: Z:\qt_applications\current\qt\
Adding file: Z:\qt_applications\current\qt\qt_app.exe
¤ó: No such file or directory.
error
error

So it seems the problem occurs later, and is in no way related to the working dir.
« Last Edit: November 21, 2005, 11:24:32 am by rix »

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: How to debug application compiled from an external Makefile ?
« Reply #6 on: November 21, 2005, 11:35:08 am »
This seems like a bug in the debugger...
My suggestion is to change "qt_applications" to something less than 8 chars to see if this fixes it for you.

The debugger has been greatly improved in CVS and doesn't have the bug you mentioned.
Be patient!
This bug will be fixed soon...

Offline rix

  • Single posting newcomer
  • *
  • Posts: 5
Re: How to debug application compiled from an external Makefile ?
« Reply #7 on: November 21, 2005, 11:54:10 am »
My suggestion is to change "qt_applications" to something less than 8 chars to see if this fixes it for you.

I changed to a smaller directory name (z:\qt), but the problem still occur... :(

The debugger has been greatly improved in CVS and doesn't have the bug you mentioned.

Ok, I think I will try to compile the CVS version. ;)

Thank you very much!