This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 120350

Summary: Breakpoints do not work in WinAPI application
Product: cnd Reporter: Alexander Pepin <apepin>
Component: DebuggerAssignee: _ gordonp <gordonp>
Status: VERIFIED FIXED    
Severity: blocker CC: ttran
Priority: P1    
Version: 6.x   
Hardware: All   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: sample WinAPI application
gdb log
Patch against release60 version

Description Alexander Pepin 2007-10-29 14:28:50 UTC
This happened when I tried to debug "real-life" Windows application. After I simplified the project and left only
necessary bits to reproduce the bug. 

Steps to reproduce:
- create a simple Windows application using WinAPI (see attached sample project)
- build the application
- set a breakpoint in line 10 in hellowin1.cc (before creating a window)
- set a breakpoint in line 36 in mainwin.cc (in the window message handler)
- start debugger
Result: Application does not stop at breakpoints but starts successfully and application window appears. It looks oddly
but breakpoints start working if I add "#include <iostream.h>" into hellowin1.cc.
Comment 1 Alexander Pepin 2007-10-29 14:30:06 UTC
Created attachment 51894 [details]
sample WinAPI application
Comment 2 Alexander Pepin 2007-10-29 14:41:50 UTC
Created attachment 51899 [details]
gdb log
Comment 3 Alexander Pepin 2007-10-29 14:43:46 UTC
Breakpoints work in Eclipse and in command line GDB.
Comment 4 _ gordonp 2007-11-06 00:19:46 UTC
Since breakpoints in shared libraries can't be set until the shared library is loaded, the standard
way of doing this is to set an invisible and temporary breakpoint at main. When gdb stops at this
breakpoint, it creates the "real" breakpoints.

In a WinAPI app, there is no "main" function so the breakpoints don't get set. I added a check for
Windows and create an invisible/temp breakpoint at WinMain. This successfully completes the breakpoint
validation phase for all apps.
Comment 5 Alexander Pepin 2007-11-07 17:37:34 UTC
verified in trunk build 20071107
Comment 6 Jesse Grodnik 2007-11-07 19:07:10 UTC
This is a requested NB 6.0 high resistance fix.
Comment 7 _ gordonp 2007-11-07 19:24:34 UTC
Created attachment 52682 [details]
Patch against release60 version
Comment 8 Thomas Preisler 2007-11-07 19:56:05 UTC
Code changes reviewed by Thomas Preisler (thp).
Comment 9 _ gordonp 2007-11-08 23:40:09 UTC
Change committed into release60 branch.
Comment 10 Alexander Pepin 2007-11-09 17:26:43 UTC
verified in RC1 build (20071109)