Breakpoints not hitting up

In my code base of C++ the breakpoints are not hitting up.
I have built a code base(C++ on Windows) in visual studio and created a dll and its corrresponding pdb files.

I ran the application and then connected it to windbg, set the symbols properly and source code path is also proper.
I have set the breakpoints in a suspected file.
The problem is the breakpoints are not hitting up.
When I make the changes at that place(where I have set the breakpoints) the corresponding changes and printfs around the breakpopints gets reflected in the output.
But while running the application the breakpoints does not hit.

What might be the reason behind this and how to resolve it?

> I have set the breakpoints in a suspected file.

The problem is the breakpoints are not hitting up.

WinDbg connected as kernel debugger? Use breakpoint on access (execute): “ba e 1 <target_address>”. Or use “.pagein /p <target_process> <target_address>” before setting a breakpoint. Memory (target code) may be paged at this time.</target_address></target_process></target_address>

Thanks Alexey for the reply.
Sorry I forgot to mention that I am debugging a usermode application code and windbg is directly attched to application process.

If it is 32bit code , use __asm{ int 3 } in code where you want to break.
or you can use __debugbreak() ;

Since you are debugging user mode code , it is better you use VS for debugging.

Thanks,
–rc

On Wed, Sep 14, 2011 at 9:35 AM, wrote:
> In my code base of C++ the breakpoints are not hitting up.
> I have built a code base(C++ on Windows) in visual studio and created a dll and its corrresponding pdb files.
>
> I ran the application and then connected it to windbg, set the symbols properly and source code path is also proper.
> I have set the breakpoints in a suspected file.
> The problem is the breakpoints are not hitting up.
> When I make the changes at that place(where I have set the breakpoints) the corresponding changes and printfs around the breakpopints gets reflected in the output.
> But while running the application the breakpoints does not hit.
>
> What might be the reason behind this and how to resolve it?
>
>
> —
> WINDBG is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>

Actually, there is an intrinsic, __debugbreak(), that you can use. No
need for asm. Or you can use _CrtDbgBreak().

On 9/14/2011 1:27 PM, Rudra ठाकुर wrote:

If it is 32bit code , use __asm{ int 3 } in code where you want to break.
or you can use __debugbreak() ;

Since you are debugging user mode code , it is better you use VS for debugging.

Thanks,
–rc

Hi Windbg is excellent y\to debug usermode c++, but sometimes it struggles
when you set the first brekepoint in the source window. To overcome this,
you can use the x command to find the address and then set break with the desired address

0:001> x *!*OnButtonCra*
00401b80 CrashTest!CCrashTestDlg::OnButtonCrash (void)
0:001> bp 00401b80
0:001> g
Breakpoint 8 hit
eax=00401b80 ebx=00000001 ecx=0018fe10 edx=00000000 esi=00000000 edi=00000111
eip=00401b80 esp=0018f6fc ebp=0018f704 iopl=0 nv up ei ng nz ac pe c

Regards
Kjell Gunnar