Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Query : How to open source files in New Windbg

OSR_Community_UserOSR_Community_User Member Posts: 110,217
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
>

Comments

  • Mark_RoddyMark_Roddy Member - All Emails Posts: 4,665
    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: [email protected]
    [mailto:[email protected]]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: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    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
    [email protected]




    ----- Original Message -----
    From: "Abhijit Mirajkar" <[email protected]>
    To: "NT Developers Interest List" <[email protected]>
    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: [email protected]
    > To unsubscribe send a blank email to $subst('Email.Unsub')
  • OSR_Community_User-48OSR_Community_User-48 Member Posts: 74
    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.

    2) 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:[email protected]]
    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: [email protected]
    To unsubscribe send a blank email to $subst('Email.Unsub')
  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    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.

    2) 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
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 16-20 October 2023 Live, Online
Developing Minifilters 13-17 November 2023 Live, Online
Internals & Software Drivers 4-8 Dec 2023 Live, Online
Writing WDF Drivers 10-14 July 2023 Live, Online