Query : How to open source files in New Windbg

Hi All,

Can anyone please explain how to open source files in new pre-release
version of Windbg?
I tried using File\Open Source File, Using the GUI button, using the
.srcpath option and also by first breaking-in using Ctrl+C (as required in
old version) but of no use. I have also set the symbol path correctly .

Thanks in advance,

Regards,
Abhijit

Did you try - File\Open Source File…?

While there are a few shortcomings (like Options not working) I like this
version of Windbg quite a bit. It has a vastly superior GUI to the
previous
versions and you can thankfully set breakpoints during runtime.

Note: since "Source File Path … " is grayed out you need to use .srcpath
in order for source level debugging to work.

Daniel Nemiroff

Abhijit,

Since I’ve already gone on record as thinking that the NEW! IMPROVED!
windbag is a pile of sh*t, I’m probably the wrong person to answer this
question.

The GUI does not work with at least some versions of NT 4.0. Given the state
of GUI dlls, this is not really very surprising. However, one would think
that open file just works out of the box. If you can upgrade your host to
w2k then open file will work. But really, don’t expect this version to do
much for you, it is badly broken.

Mark Roddy
Windows 2000/NT Consultant
Hollis Technology Solutions
www.hollistech.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Abhijit Mirajkar
Sent: Wednesday, May 03, 2000 2:43 AM
To: NT Developers Interest List
Subject: [ntdev] Query : How to open source files in New Windbg

Hi All,

Can anyone please explain how to open source files in new pre-release
version of Windbg?
I tried using File\Open Source File, Using the GUI button, using the
.srcpath option and also by first breaking-in using Ctrl+C (as required in
old version) but of no use. I have also set the symbol path correctly .

Thanks in advance,

Regards,
Abhijit

Did you try - File\Open Source File…?

While there are a few shortcomings (like Options not working) I like this
version of Windbg quite a bit. It has a vastly superior GUI to the
previous
versions and you can thankfully set breakpoints during runtime.

Note: since "Source File Path … " is grayed out you need to use .srcpath
in order for source level debugging to work.

Daniel Nemiroff


You are currently subscribed to ntdev as: xxxxx@wattanuck.mv.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Did you setup your environment variables that the windbg help says to. I
have found that some of the GUI features in winbag just dont work right, but
most of the non-gui stuff does. (i.e. I would setup a environment variable
for symbols before I would trust doing it via the GUI).

Winbag is very picky about its environment. I do the following to get it
working on my systems.

  1. Setup the environment variables that the Windbg help says you need for
    symbol setup. Verify that it is reading the correct symbols on boot (Read
    the message in the Console window as the OS boots up).

  2. Use the .srcpath command to set you source path up (Again, read the
    console to be sure it read the correct path)

  3. Make sure you have the correct symbols built (.pdb files if you are using
    VC 6.0) and are copying the into the correct directory.

  4. Use File/Open to open you file and set breaks etc etc

The new version of winbag is working fine for me now, but I found that I had
to have *EVERYTHING* exactly right. It will fail to find stuff if you have a
path in-correct or something like that. I had an issue because I was not
copying my symbol files to the correct directory, and was always loading a
stale symbol file (Typo in my install script).

Hope this helps

-Chris


Christopher Pane
Software Engineer
Vanteon
www.vanteon.com
xxxxx@vanteon.com

----- Original Message -----
From: “Abhijit Mirajkar”
To: “NT Developers Interest List”
Sent: Wednesday, May 03, 2000 2:42 AM
Subject: [ntdev] Query : How to open source files in New Windbg

>
> Hi All,
>
> Can anyone please explain how to open source files in new pre-release
> version of Windbg?
> I tried using File\Open Source File, Using the GUI button, using the
> .srcpath option and also by first breaking-in using Ctrl+C (as required in
> old version) but of no use. I have also set the symbol path correctly .
>
> Thanks in advance,
>
> Regards,
> Abhijit
>
>
> > Did you try - File\Open Source File…?
> >
> > While there are a few shortcomings (like Options not working) I like
this
> > version of Windbg quite a bit. It has a vastly superior GUI to the
> previous
> > versions and you can thankfully set breakpoints during runtime.
> >
> > Note: since "Source File Path … " is grayed out you need to use
.srcpath
> > in order for source level debugging to work.
> >
> > Daniel Nemiroff
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@vanteon.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)

THe open dialog in this package does not work on NT4. Sorry.

Here are some work arounds:

  1. If the srcpath is set correctly then Windbg will automaticly open the
    file for the current executing code, for example when a breakpoint is
    hit.

I tried this for a user mode app. I started the app on the windbg
commandline. At the initial breakpoint I set the srcpath, then did a “g
main”. It executed to main then brought up the source file w/ main in
it.

For kernel mode I hooked up the debugger. Broke it. Did a “bp
testsys!DriverEntry” (testsys is a test driver I use sometimes) set
srcpath, then did “g”. Then on the target I started the driver. When
the breakpoint was hit Windbg brought up the source.

Once the source is up you can select lines and to “run to cursor” and
set breakpoints with the GUI.

  1. Another workaround is to use the console source commands. Normally
    these are not used in Windbg because you have windows, but they are very
    useful if you us plain old console kd.exe. You can open one file at a
    time with the command “lsf file” then you can use “ls” and “lsa” to
    display source in the command window.

Combined with the following commands one can do effective source level
debugging in kd.exe (not as nice as the GUI, but it works):
.lines - Tell the debugger you want to use line information (on
by default in Windbg)
l+* - Tell the debugger what you want to use source
for

You can set breakpoints on a given line by the following command
bp source.c:45
or
bp mydriver!source.c:45
Where mydriver is the module, source.c is your source file and 45 is the
line number. Becareful the ` are backticks, not apostrophes.

With these work arounds you can get Windbg to open the source for you
and avoid the problem with the dialog.

Enjoy

-----Original Message-----
From: Abhijit Mirajkar [mailto:xxxxx@controlnet.co.in]
Sent: Tuesday, May 02, 2000 11:43 PM
To: NT Developers Interest List
Subject: [ntdev] Query : How to open source files in New Windbg

Hi All,

Can anyone please explain how to open source files in new pre-release
version of Windbg?
I tried using File\Open Source File, Using the GUI button, using the
.srcpath option and also by first breaking-in using Ctrl+C (as required
in
old version) but of no use. I have also set the symbol path correctly .

Thanks in advance,

Regards,
Abhijit

Did you try - File\Open Source File…?

While there are a few shortcomings (like Options not working) I like
this
version of Windbg quite a bit. It has a vastly superior GUI to the
previous
versions and you can thankfully set breakpoints during runtime.

Note: since "Source File Path … " is grayed out you need to use
.srcpath
in order for source level debugging to work.

Daniel Nemiroff


You are currently subscribed to ntdev as: xxxxx@microsoft.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

RE: [ntdev] Query : How to open source files in New Windbg
Hi Nathan,

Thanks a lot for your help. It worked fine when I used the ‘bp’ command. Also thanks to Christopher as it works only when I setup the environment variables using batch files. Setting up with GUI doesn’t help.

THe open dialog in this package does not work on NT4. Sorry.

Here are some work arounds:

  1. If the srcpath is set correctly then Windbg will automaticly open the file for the current executing code, for example when a breakpoint is hit.

I tried this for a user mode app. I started the app on the windbg commandline. At the initial breakpoint I set the srcpath, then did a “g main”. It executed to main then brought up the source file w/ main in it.

For kernel mode I hooked up the debugger. Broke it. Did a “bp testsys!DriverEntry” (testsys is a test driver I use sometimes) set srcpath, then did “g”. Then on the target I started the driver. When the breakpoint was hit Windbg brought up the source.

Once the source is up you can select lines and to “run to cursor” and set breakpoints with the GUI.

  1. Another workaround is to use the console source commands. Normally these are not used in Windbg because you have windows, but they are very useful if you us plain old console kd.exe. You can open one file at a time with the command “lsf file” then you can use “ls” and “lsa” to display source in the command window.

Combined with the following commands one can do effective source level debugging in kd.exe (not as nice as the GUI, but it works):

.lines - Tell the debugger you want to use line information (on by default in Windbg)
l+* - Tell the debugger what you want to use source for

You can set breakpoints on a given line by the following command
bp source.c:45
or
bp mydriver!source.c:45
Where mydriver is the module, source.c is your source file and 45 is the line number. Becareful the ` are backticks, not apostrophes.

With these work arounds you can get Windbg to open the source for you and avoid the problem with the dialog.

Enjoy