Feeds:
Posts
Comments

Posts Tagged ‘Debugging’

Howdy,

Once again about WADA, but this one will be short. I’ve added a new functionality, which is:

 

  • Filter W3WPs by related Identity (as of the application pool)

 

Thanks to my colleague Patrick  for suggesting this functionality!

The UI has changed a little, offering the new drop down for the identities:

WADA_1.1_Screenshot

The WADA 1.1 download is still available at the Visual Studio Gallery.

 

Please note: The Application Pool- and Identities-Filters are mutually exclusive.

 

Best regards,

Martin

Read Full Post »

Hi fellows,

Today I released the first version of the WADA Visual Studio 2010 extension for web developers – it enables you to being able to attach processes to the VS debugger – not simple processes, but the w3wp. I guess, some of you know the issue:

  • > 1 application pools
  • > 1 w3wp processes

How could we know which process is right for being debugged by us? First, we could use one of the numerous scripts out there (like iisapp.vbs for Windows 2k3), but they provide poor integration into the VS2010 IDE (actually none at all). This is where the strengths of using WADA come into play.

What this Tool Can Do:

  • List all w3wp processes, along with the application pool names
  • List w3wp processes for a specific application pool
  • Attach a selected process to the debugger

Why should I Choose This over Scripts?

  1. You can remain in the IDE
  2. Directly attach W3WP to the Debugger (not possible with e.g. iisapp.vbs)
  3. Filter by Application Pool of Interest (not possible with e.g. iisapp.vbs)
  4. No more need for manually matching IDs (from script output) against the “Attach to Process” window’s process list

Is it Bulletproof?

No. Not at all. Please be aware that this extension comes in its first version and may contain errors and/or undesired behaviour. It also assumes that you have administrative rights on the machine you are working with it (also VS must be run in administrator mode). Hence, I’d like to emphasize that I cannot be held liable for any usage of the code causing undesired behaviour, loss of data, any damages caused to any soft- or hardware (including source code) of the user. Please do not try it in production environments. It is intended for testing purposes only.

In case you intend to test it, it would be really nice if you provided some feedback on it using the post.

Screenshot

WADA_Screenshot

Usage

  1. Go to View -> Other Windows -> WADA Advanced Attacher
  2. Select Application Pool of Interest (optional, otherwise all will be considered)
  3. Click “Get Procs” (ensure that “Only W3WP” is checked)
  4. Select Process from list
  5. Click “Attach”

Download

WADA 1.0 (Visual Studio Gallery)

Installation is done simply through double-clicking on the downloaded .vsix package.

I hope you enjoy it!

Best regards,

Martin

Read Full Post »

Howdy people,

This time we’re going to have a look at another small (but effective) improvement in Visual Studio 2010: The breakpoints got some new achievements, namely:

  1. Labeling breakpoints
  2. Searching for breakpoints (Breakpoints Window)
  3. Specifying hit counters
  4. Import/Export breakpoints

Labeling is easy-to-use and newly available in Visual Studio 2010 (not in the Express Editions). Later on, we can also use these labels for searching.

After setting up a small console application (containing only the default-generated Program class), let’s declare an array of type Int32 and name it values. A simple foreach loop should iterate over the array. We’ll also place a breakpoint at the beginning of the loop. That’s enough for showing the new achievements. Figure 1 shows it:

 

image

Figure 1: After setting the breakpoint

 

After we’ve set the breakpoint, we can deliberately access the labels by right-clicking on the breakpoint and choosing EDIT LABELS from the context menu, as seen in Figure 2.

 

image

Figure 2: Accessing labels after a right click on the breakpoint

A window will open, allowing to define a new breakpoint label or to assign an existing one. In our case, I have already defined a label “NumberLoop”, which we’re gonna reuse. A check near the label in the list does the assignment, and confirming the dialog window sets the assignment. From now on, our breakpoint is called “NumberLoop”.

image

Figure 3: Label definition/assignment

We can verify the assignment immediately by bringing up the Breakpoints Window, which is located under Debug-Windows-Breakpoints Window (CTRL+D, B).

image

Figure 4: The breakpoints window, showing our breakpoint w/ label

The breakpoints window basically shows all breakpoints along with their name (i.e. filename and position in the code, as well w/ label, conditions and hit count). Additional columns can be defined by using the menu entry “Columns”, as seen in Figure 4. Defining another label in the code, 2 lines below, will result in Figure 5. Let’s try to enter “Number” as a search term in the menu of the breakpoints window.

image

Figure 5: 2 Breakpoints, before search

image

Figure 6:  After search – our breakpoint was found

The advantage is clear: When having lots and lots of breakpoints, it will be easy to give them meaningful names, so they can be found easier afterwards.

Moreover, by right-clicking on the desired breakpoint, a context menu will open, containing the entry “Go To Source Code” (“Go To Disassembly”, respectively), allowing you to navigate directly to the position in the code, where the breakpoint is located.

The hit counters where already available in VS2008, and haven’t really changed, but for the sake of completeness they shall be named here as well. Right-clicking on a breakpoint allows you to define a hit counter for a specific breakpoint.

 

image

Figure 7: Defining hit counters for breakpoints

It means, the breakpoint will only be hit when a certain hit counter is reached. If you only want to see how many times a break point actually is passed, it is recommended to set the hit count to a very high value (that will never actually be reached). This way you can evaluate the hit counter afterwards and check for the actual value.

image

Figure 8: The hit count definition window

Breakpoints with conditions and/or hit counts are displayed as image. Disabled breakpoints will invert the colours.

The last new feature is the import / export of breakpoints. It is also available in the breakpoints window. The 2 buttons image are for exporting and importing, respectively, and will produce/accept an XML file containing not only the breakpoints, but also applying the search criteria you defined in the breakpoints window. This way it’s easy to reuse even your breakpoints. In a possible scenario you want to pass your breakpoints to another developer, who is working on the same project, this seems quite a handy feature.

Enjoy finding and exterminating bugs!

Best regards,

Martin

Read Full Post »