News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

How to debug a WinApi App with Threads

Started by flammi, October 26, 2006, 02:22:27 PM

Previous topic - Next topic

flammi

Hello,

I want to debug a Win32 Gui Project.
The only problem is, that this App uses Threads ( CreateThread(...) ). ( debugging of Apps without Threads works fine! )
The debugger didn't stop at breakpoints in the Thread i created, only breakpoints in the WinMain Thread were recognized.

How can i debug the Thread i created with CreateThread()???

Produce debugging Symbols is enabled.
I am using Code::Blocks 1.0 revision 3140 (a Nightly Build) with MingW.

mandrav

Nothing special to do. Set a breakpoint inside the thread's code and it will break. If it doesn't (and breakpoint filename error is not printed in the log), it means the code was never run.
Be patient!
This bug will be fixed soon...

Pecan

#2
See the warnings about breakpoints in ctor/dtors.
http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks

kkez

I just tested a breakpoint inside a thread proc in a winapi app, and gdb stops where it is. So that means your code wasn't run :)

Ps: Pecan, you forgot an s: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks   :)

MortenMacFly

Quote from: Pecan on October 26, 2006, 03:02:41 PM
See the warnings about breakpoints in ctor/dtors.
http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks
See: This page is useful from the first second... why didn't we do this in the first place...?! ;-)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

flammi

Hmm, i created a new Build Target and now the debugger is working fine. I don't changed anything in the code and at the position of the breakpoints.  :D

Thank you for your help.

MortenMacFly

Quote from: flammi on October 26, 2006, 04:27:42 PM
Hmm, i created a new Build Target and now the debugger is working fine. I don't changed anything in the code and at the position of the breakpoints.  :D
You may haver simply missed to *re*-build your sources after enabling the debugger switch. Thus the compiler still uses the old object files since they are up-to-date, but they don't inlcude debug symbols.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]