Author Topic: Debug extern program with code::block.  (Read 2225 times)

manza

  • Guest
Debug extern program with code::block.
« on: June 28, 2016, 09:23:11 am »
Hi.
I Search on google but I don't find the answear to my question.

I create à program on windows, and when I use some function my application crash. What I would like to do is, open code::block in debug mode with corrects parameters by cliking on the debug button.

Is it possible to do this? And how can I do this?

I try to edit the registry editor, but i only succed to run gdb but not in the code::block environment.

Think's for yours answear and sorry for my bad english.

Eric Méaux

Offline raynebc

  • Almost regular
  • **
  • Posts: 217
Re: Debug extern program with code::block.
« Reply #1 on: June 28, 2016, 07:37:36 pm »
Assuming Codeblocks is correctly set up to see your compiler and debugger, make sure you are compiling with debugging symbols (you can set this globally by in Settings>Compiler>Global compiler settings>Compiler settings tab by checking the "Produce debugging symbols" checkbox or by enabling that option in your project's build options either project-wide or on a per target basis).  If you just enabled debugging symbols, rebuild the project (Build>Rebuild).  Then you can launch the program in the debugger (click the red play button in the debugger toolbar or use Debug>Start).  When your program crashes, the debugger should pull up the line of code where the crash occurred (as long as it's within your source code that was build with debugging symbols).  You can then add debugging watches to look at the values of variables at that point of execution.  You can also set breakpoints at/before that point of failure and restart the program through the debugger so that the execution of your program pauses and you can see the values of watches or step through the program line by line, etc.  If you want to start the program with specific command line arguments, you can set those in "Project>Set program's arguments".