Windbg: Can't set breakpoints

Dear Driver Experts,

I’m a new windbg user and I’m having a hard time on trying to set a simple
breakpoint on my C code. I’m using windbg 6.3.0017.0. My host and my target
are Win XP/SP2 systems linked with a null-modem cable.

Here’s what I have done so far:

1)I’ve set my symbol path to directory C:\Symbols:
SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

2)I added my driver’s symbols (vsc.sys and vsc.pdb) by using SymStore and
specified it to place the symbols in directory C:\Symbols as well

3)I placed the same “vsc.sys” driver file on my target plus its “inf” file.

When I first pressed F9 alongside a source line in DriverEntry, windbg tried to
resolve the missing symbols and then sent this message box:

“Code not found. Breakpoint not set.”

Then I checked whether my driver symbols were loaded by looking into my module
list: the kernel symbols are present on the module list but not my driver
symbols.

So, I forced windbg to load my driver symbols by trying these commands:

  1. kd> ld vsc.pdb

Output:
No modules matched ‘VSC.PDB’
It doesn’t work with “vsc.sys” either.

  1. kd> .reload vsc.pdb

Output:
“vsc.pdb” was not found in the image list.
Debugger will attempt to load “vsc.pdb” at given base 00000000.

Please provide the full image name, including the extension (i.e.
kernel32.dll)
for more reliable results. Base address and size overrides can be
given as .reload <image.ext>=,.
Unable to add module at 00000000

I have spent the last 2 days on reading intensively the documentation and any
bits of related answers from OSR so any suggestions or assistance is more than
welcomed!

Chi-Truc Dinh</image.ext>

At this point I would insert a software breakpoint in the code in
DriverEntry as follows:

DriverEntry(…)
{

DbgBreakPoint();

return Status;
}

This will at least get you into the attached debugger with your driver
loaded. Don’t forget to take the breakpoint out when you have fixed the
windbg problem :slight_smile:

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Chi Truc Dinh
Sent: Sunday, September 04, 2005 12:25 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Windbg: Can’t set breakpoints

Dear Driver Experts,

I’m a new windbg user and I’m having a hard time on trying to
set a simple breakpoint on my C code. I’m using windbg
6.3.0017.0. My host and my target are Win XP/SP2 systems
linked with a null-modem cable.

Here’s what I have done so far:

1)I’ve set my symbol path to directory C:\Symbols:
SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

2)I added my driver’s symbols (vsc.sys and vsc.pdb) by using
SymStore and specified it to place the symbols in directory
C:\Symbols as well

3)I placed the same “vsc.sys” driver file on my target plus
its “inf” file.

When I first pressed F9 alongside a source line in
DriverEntry, windbg tried to resolve the missing symbols and
then sent this message box:

“Code not found. Breakpoint not set.”

Then I checked whether my driver symbols were loaded by
looking into my module
list: the kernel symbols are present on the module list but
not my driver symbols.

So, I forced windbg to load my driver symbols by trying these
commands:

  1. kd> ld vsc.pdb

Output:
No modules matched ‘VSC.PDB’
It doesn’t work with “vsc.sys” either.

  1. kd> .reload vsc.pdb

Output:
“vsc.pdb” was not found in the image list.
Debugger will attempt to load “vsc.pdb” at given base 00000000.

Please provide the full image name, including the
extension (i.e.
kernel32.dll)
for more reliable results. Base address and size
overrides can be
given as .reload <image.ext>=,.
> Unable to add module at 00000000
>
> I have spent the last 2 days on reading intensively the
> documentation and any bits of related answers from OSR so any
> suggestions or assistance is more than welcomed!
>
> Chi-Truc Dinh
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as:
> xxxxx@hollistech.com To unsubscribe send a blank email to
> xxxxx@lists.osr.com
></image.ext>

Try running “bu vsc!DriverEntry” in the command window then loading your
driver. This will setup an unresolved breakpoint which should get
matched up when the driver loads.

I’ve never had good luck setting source-line breakpoints from the UI
before the binary has actually loaded (WinDBG seems to associate the
module info with the file when it opens it automatically, but if you
open a file yourself it has no idea which module it’s associated with).

-p

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Chi Truc Dinh
Sent: Sunday, September 04, 2005 9:25 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Windbg: Can’t set breakpoints

Dear Driver Experts,

I’m a new windbg user and I’m having a hard time on trying to set a
simple breakpoint on my C code. I’m using windbg 6.3.0017.0. My host
and my target are Win XP/SP2 systems linked with a null-modem cable.

Here’s what I have done so far:

1)I’ve set my symbol path to directory C:\Symbols:
SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols

2)I added my driver’s symbols (vsc.sys and vsc.pdb) by using SymStore
and specified it to place the symbols in directory C:\Symbols as well

3)I placed the same “vsc.sys” driver file on my target plus its “inf”
file.

When I first pressed F9 alongside a source line in DriverEntry, windbg
tried to resolve the missing symbols and then sent this message box:

“Code not found. Breakpoint not set.”

Then I checked whether my driver symbols were loaded by looking into my
module
list: the kernel symbols are present on the module list but not my
driver symbols.

So, I forced windbg to load my driver symbols by trying these commands:

  1. kd> ld vsc.pdb

Output:
No modules matched ‘VSC.PDB’
It doesn’t work with “vsc.sys” either.

  1. kd> .reload vsc.pdb

Output:
“vsc.pdb” was not found in the image list.
Debugger will attempt to load “vsc.pdb” at given base 00000000.

Please provide the full image name, including the extension (i.e.
kernel32.dll)
for more reliable results. Base address and size overrides can be
given as .reload <image.ext>=,.
Unable to add module at 00000000

I have spent the last 2 days on reading intensively the documentation
and any bits of related answers from OSR so any suggestions or
assistance is more than welcomed!

Chi-Truc Dinh


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com</image.ext>

Hi,

Thanks to Mark and Peter for your replies! I tried DbgBreakpoint() but it
didn’t work. Since I’ve spent about 5 days on setting up windbg and learning
its use without acquiring enough ease using this debugger, i’ve decided to
leave windbg on hold and use SoftIce instead. But I am going to use windbg
again someday because i believe windbg makes the debugging task easier, once
the driver and its symbols are properly loaded. Your suggestions will surely
be useful to me in the future.

Thanks again!

Chi-Truc

Selon Peter Wieland :

> Try running “bu vsc!DriverEntry” in the command window then loading your
> driver. This will setup an unresolved breakpoint which should get
> matched up when the driver loads.
>
> I’ve never had good luck setting source-line breakpoints from the UI
> before the binary has actually loaded (WinDBG seems to associate the
> module info with the file when it opens it automatically, but if you
> open a file yourself it has no idea which module it’s associated with).
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Chi Truc Dinh
> Sent: Sunday, September 04, 2005 9:25 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Windbg: Can’t set breakpoints
>
> Dear Driver Experts,
>
> I’m a new windbg user and I’m having a hard time on trying to set a
> simple breakpoint on my C code. I’m using windbg 6.3.0017.0. My host
> and my target are Win XP/SP2 systems linked with a null-modem cable.
>
> Here’s what I have done so far:
>
> 1)I’ve set my symbol path to directory C:\Symbols:
> SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
>
> 2)I added my driver’s symbols (vsc.sys and vsc.pdb) by using SymStore
> and specified it to place the symbols in directory C:\Symbols as well
>
> 3)I placed the same “vsc.sys” driver file on my target plus its “inf”
> file.
>
>
> When I first pressed F9 alongside a source line in DriverEntry, windbg
> tried to resolve the missing symbols and then sent this message box:
>
> “Code not found. Breakpoint not set.”
>
> Then I checked whether my driver symbols were loaded by looking into my
> module
> list: the kernel symbols are present on the module list but not my
> driver symbols.
>
> So, I forced windbg to load my driver symbols by trying these commands:
> 1) kd> ld vsc.pdb
>
> Output:
> No modules matched ‘VSC.PDB’
> It doesn’t work with “vsc.sys” either.
>
> 2) kd> .reload vsc.pdb
>
> Output:
> “vsc.pdb” was not found in the image list.
> Debugger will attempt to load “vsc.pdb” at given base 00000000.
>
> Please provide the full image name, including the extension (i.e.
> kernel32.dll)
> for more reliable results. Base address and size overrides can be
> given as .reload <image.ext>=,.
> Unable to add module at 00000000
>
> I have spent the last 2 days on reading intensively the documentation
> and any bits of related answers from OSR so any suggestions or
> assistance is more than welcomed!
>
> Chi-Truc Dinh
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: unknown lmsubst tag argument: ‘’
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
></image.ext>

If DbgBreakPoint did not work, it is almost for sure because you are
building your driver free, not checked. This could also explain your
problem setting a breakpoint since lines can be eliminated with the
optimizations of free.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply

“Chi Truc Dinh” wrote in message
news:xxxxx@ntdev…
> Hi,
>
> Thanks to Mark and Peter for your replies! I tried DbgBreakpoint() but it
> didn’t work. Since I’ve spent about 5 days on setting up windbg and
> learning
> its use without acquiring enough ease using this debugger, i’ve decided to
> leave windbg on hold and use SoftIce instead. But I am going to use
> windbg
> again someday because i believe windbg makes the debugging task easier,
> once
> the driver and its symbols are properly loaded. Your suggestions will
> surely
> be useful to me in the future.
>
> Thanks again!
>
> Chi-Truc
>
> Selon Peter Wieland :
>
>> Try running “bu vsc!DriverEntry” in the command window then loading your
>> driver. This will setup an unresolved breakpoint which should get
>> matched up when the driver loads.
>>
>> I’ve never had good luck setting source-line breakpoints from the UI
>> before the binary has actually loaded (WinDBG seems to associate the
>> module info with the file when it opens it automatically, but if you
>> open a file yourself it has no idea which module it’s associated with).
>>
>> -p
>>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com] On Behalf Of Chi Truc Dinh
>> Sent: Sunday, September 04, 2005 9:25 AM
>> To: Windows System Software Devs Interest List
>> Subject: [ntdev] Windbg: Can’t set breakpoints
>>
>> Dear Driver Experts,
>>
>> I’m a new windbg user and I’m having a hard time on trying to set a
>> simple breakpoint on my C code. I’m using windbg 6.3.0017.0. My host
>> and my target are Win XP/SP2 systems linked with a null-modem cable.
>>
>> Here’s what I have done so far:
>>
>> 1)I’ve set my symbol path to directory C:\Symbols:
>> SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
>>
>> 2)I added my driver’s symbols (vsc.sys and vsc.pdb) by using SymStore
>> and specified it to place the symbols in directory C:\Symbols as well
>>
>> 3)I placed the same “vsc.sys” driver file on my target plus its “inf”
>> file.
>>
>>
>> When I first pressed F9 alongside a source line in DriverEntry, windbg
>> tried to resolve the missing symbols and then sent this message box:
>>
>> “Code not found. Breakpoint not set.”
>>
>> Then I checked whether my driver symbols were loaded by looking into my
>> module
>> list: the kernel symbols are present on the module list but not my
>> driver symbols.
>>
>> So, I forced windbg to load my driver symbols by trying these commands:
>> 1) kd> ld vsc.pdb
>>
>> Output:
>> No modules matched ‘VSC.PDB’
>> It doesn’t work with “vsc.sys” either.
>>
>> 2) kd> .reload vsc.pdb
>>
>> Output:
>> “vsc.pdb” was not found in the image list.
>> Debugger will attempt to load “vsc.pdb” at given base 00000000.
>>
>> Please provide the full image name, including the extension (i.e.
>> kernel32.dll)
>> for more reliable results. Base address and size overrides can be
>> given as .reload <image.ext>=,.
>> Unable to add module at 00000000
>>
>> I have spent the last 2 days on reading intensively the documentation
>> and any bits of related answers from OSR so any suggestions or
>> assistance is more than welcomed!
>>
>> Chi-Truc Dinh
>>
>>
>>
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>> —
>> Questions? First check the Kernel Driver FAQ at
>> http://www.osronline.com/article.cfm?id=256
>>
>> You are currently subscribed to ntdev as: unknown lmsubst tag argument:
>> ‘’
>> To unsubscribe send a blank email to xxxxx@lists.osr.com
>>
>>
>
>
>
></image.ext>

Ok, i see. You’re right. Thanks for your comment!

CT

Selon Don Burn :

> If DbgBreakPoint did not work, it is almost for sure because you are
> building your driver free, not checked. This could also explain your
> problem setting a breakpoint since lines can be eliminated with the
> optimizations of free.
>
>
> –
> Don Burn (MVP, Windows DDK)
> Windows 2k/XP/2k3 Filesystem and Driver Consulting
> Remove StopSpam from the email to reply
>
>
>
>
> “Chi Truc Dinh” wrote in message
> news:xxxxx@ntdev…
> > Hi,
> >
> > Thanks to Mark and Peter for your replies! I tried DbgBreakpoint() but it
> > didn’t work. Since I’ve spent about 5 days on setting up windbg and
> > learning
> > its use without acquiring enough ease using this debugger, i’ve decided to
> > leave windbg on hold and use SoftIce instead. But I am going to use
> > windbg
> > again someday because i believe windbg makes the debugging task easier,
> > once
> > the driver and its symbols are properly loaded. Your suggestions will
> > surely
> > be useful to me in the future.
> >
> > Thanks again!
> >
> > Chi-Truc
> >
> > Selon Peter Wieland :
> >
> >> Try running “bu vsc!DriverEntry” in the command window then loading your
> >> driver. This will setup an unresolved breakpoint which should get
> >> matched up when the driver loads.
> >>
> >> I’ve never had good luck setting source-line breakpoints from the UI
> >> before the binary has actually loaded (WinDBG seems to associate the
> >> module info with the file when it opens it automatically, but if you
> >> open a file yourself it has no idea which module it’s associated with).
> >>
> >> -p
> >>
> >> -----Original Message-----
> >> From: xxxxx@lists.osr.com
> >> [mailto:xxxxx@lists.osr.com] On Behalf Of Chi Truc Dinh
> >> Sent: Sunday, September 04, 2005 9:25 AM
> >> To: Windows System Software Devs Interest List
> >> Subject: [ntdev] Windbg: Can’t set breakpoints
> >>
> >> Dear Driver Experts,
> >>
> >> I’m a new windbg user and I’m having a hard time on trying to set a
> >> simple breakpoint on my C code. I’m using windbg 6.3.0017.0. My host
> >> and my target are Win XP/SP2 systems linked with a null-modem cable.
> >>
> >> Here’s what I have done so far:
> >>
> >> 1)I’ve set my symbol path to directory C:\Symbols:
> >> SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
> >>
> >> 2)I added my driver’s symbols (vsc.sys and vsc.pdb) by using SymStore
> >> and specified it to place the symbols in directory C:\Symbols as well
> >>
> >> 3)I placed the same “vsc.sys” driver file on my target plus its “inf”
> >> file.
> >>
> >>
> >> When I first pressed F9 alongside a source line in DriverEntry, windbg
> >> tried to resolve the missing symbols and then sent this message box:
> >>
> >> “Code not found. Breakpoint not set.”
> >>
> >> Then I checked whether my driver symbols were loaded by looking into my
> >> module
> >> list: the kernel symbols are present on the module list but not my
> >> driver symbols.
> >>
> >> So, I forced windbg to load my driver symbols by trying these commands:
> >> 1) kd> ld vsc.pdb
> >>
> >> Output:
> >> No modules matched ‘VSC.PDB’
> >> It doesn’t work with “vsc.sys” either.
> >>
> >> 2) kd> .reload vsc.pdb
> >>
> >> Output:
> >> “vsc.pdb” was not found in the image list.
> >> Debugger will attempt to load “vsc.pdb” at given base 00000000.
> >>
> >> Please provide the full image name, including the extension (i.e.
> >> kernel32.dll)
> >> for more reliable results. Base address and size overrides can be
> >> given as .reload <image.ext>=,.
> >> Unable to add module at 00000000
> >>
> >> I have spent the last 2 days on reading intensively the documentation
> >> and any bits of related answers from OSR so any suggestions or
> >> assistance is more than welcomed!
> >>
> >> Chi-Truc Dinh
> >>
> >>
> >>
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> >> http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >> —
> >> Questions? First check the Kernel Driver FAQ at
> >> http://www.osronline.com/article.cfm?id=256
> >>
> >> You are currently subscribed to ntdev as: unknown lmsubst tag argument:
> >> ‘’
> >> To unsubscribe send a blank email to xxxxx@lists.osr.com
> >>
> >>
> >
> >
> >
> >
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@polymtl.ca
> To unsubscribe send a blank email to xxxxx@lists.osr.com
></image.ext>