Changes between Version 8 and Version 9 of Debugging With Visual Studio


Ignore:
Timestamp:
Mar 2, 2014 5:44:49 PM (10 years ago)
Author:
BJ Burg
Comment:

restructure sections into wk1/wk2/test runners/misc.

Legend:

Unmodified
Added
Removed
Modified
  • Debugging With Visual Studio

    v8 v9  
    1 = Using the Microsoft and Safari Symbol Servers =
    2 Follow the [http://developer.apple.com/internet/safari/windows_symbols_agree.html instructions for using the Microsoft and Safari symbol servers] so that Visual Studio can show you backtraces that involve closed-source components.
     1= Debugging WebKit =
    32
    4 = Watch Window =
    5 You can open any of the Watch windows using the `Debug > Windows > Watch` submenu.
     31. Open `Source/WebKit/WebKit.vcxproj/WebKit.sln` using Visual Studio 2013 or Visual Studio Express (Desktop) 2013 or later.
    64
    7 [http://msdn.microsoft.com/en-us/magazine/default.aspx MSDN Magazine] published a very useful [http://msdn.microsoft.com/en-us/magazine/dd252945.aspx article about Watch window pseudo-variables and format specifiers]. Those of particular interest to WebKit developers are mentioned explicitly below, but the whole article is worth a read.
     5If you get errors about not being able to find `.props` files, run `Tools/Scripts/update-webkit`, then close and relaunch Cygwin and Visual Studio or Visual Studio Express.
    86
    9 Adding `$err,hr` to the Watch Window will show you what `::GetLastError()` would return at this moment, and will show you both the numerical error value and the error string associated with it.
     72. Set `WinLauncher` as the solution's `StartUp` project.
    108
    11 = Calling CFShow =
    12 When debugging code that uses CF types, you can invoke the [http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/c/func/CFShow CFShow] function in the Immediate window (`Debug > Windows > Immediate` or `Ctrl+Alt+I`) to print a debug description of a CF object to the Output window like so:
    13 {{{
    14 {,,CoreFoundation}CFShow((void*)0x12345678)
    15 }}}
     9Select the `WinLauncher` project in the Solution Explorer, then choose `Project > Set as StartUp Project`. This will cause the project to turn bold in the Solution Explorer.
    1610
    17 Note that you usually won't be able to pass a variable name as the parameter to `CFShow`, as the Immediate window will get confused and think you're specifying a symbol in CoreFoundation.dll rather than whatever code you're debugging. It's usually easiest just to pass the address of the object directly as above.
     113. Launch the debugger
    1812
    19 = Debugging Multi-Process Applications =
     13Choose `Debug > Start Debugging`.
     14
     15= Debugging DumpRenderTree =
     16
     171. Set `DumpRenderTreeLauncher` as your startup project.
     18
     192. Set the layout test as a command argument.
     20
     21In `DumpRenderTreeLauncher`'s properties, go to `Configuration Properties > Debugging` and set the `Command Arguments` field to the full path of the layout test you want to debug.
     22
     233. Launch the debugger.
     24
     25= Debugging WebKit2 / WebKitTestRunner =
     26
    2027You can attach a single debugger to more than one process. To do this, launch or attach to the first process, then use `Tools > Attach to Process…` or `Ctrl+Alt+P` to attach to the second process. Your breakpoints will apply to both processes.
    2128
     
    2431Visual Studio will always pause all processes (i.e., you can't pause just one process). Similarly, Visual Studio will always step all processes when using the Step In/Over/Out commands.
    2532
    26 = Inspecting WebKit2 API types =
     33= Miscellaneous Tips =
     34
     35== Using the Microsoft and Safari Symbol Servers ==
     36Follow the [http://developer.apple.com/internet/safari/windows_symbols_agree.html instructions for using the Microsoft and Safari symbol servers] so that Visual Studio can show you backtraces that involve closed-source components.
     37
     38== Using Watch Window ==
     39You can open any of the Watch windows using the `Debug > Windows > Watch` submenu.
     40
     41[http://msdn.microsoft.com/en-us/magazine/default.aspx MSDN Magazine] published a very useful [http://msdn.microsoft.com/en-us/magazine/dd252945.aspx article about Watch window pseudo-variables and format specifiers]. Those of particular interest to WebKit developers are mentioned explicitly below, but the whole article is worth a read.
     42
     43 * Adding `$err,hr` to the Watch Window will show you what `::GetLastError()` would return at this moment, and will show you both the numerical error value and the error string associated with it.
     44
     45== Calling CFShow ==
     46
     47When debugging code that uses CF types, you can invoke the [http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFTypeRef/Reference/reference.html#//apple_ref/c/func/CFShow CFShow] function in the Immediate window (`Debug > Windows > Immediate` or `Ctrl+Alt+I`) to print a debug description of a CF object to the Output window like so:
     48{{{
     49{,,CoreFoundation}CFShow((void*)0x12345678)
     50}}}
     51
     52Note that you usually won't be able to pass a variable name as the parameter to `CFShow`, as the Immediate window will get confused and think you're specifying a symbol in `CoreFoundation.dll` rather than whatever code you're debugging. It's usually easiest just to pass the address of the object directly as above.
     53
     54== Inspecting WebKit2 API types ==
    2755
    2856You can inspect WebKit2 API types in Visual Studio by casting them to their underlying WebKit2 implementation type. For example, say you have a `WKMutableDictionaryRef` that points to address `0x12345678` and want to see what it contains. You can view its contents using the following watch expression (in either the Watch Window or Quick Watch Window):