Changes between Version 8 and Version 9 of Debugging With Visual Studio
- Timestamp:
- Mar 2, 2014 5:44:49 PM (10 years ago)
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 = 3 2 4 = Watch Window = 5 You can open any of the Watch windows using the `Debug > Windows > Watch` submenu. 3 1. Open `Source/WebKit/WebKit.vcxproj/WebKit.sln` using Visual Studio 2013 or Visual Studio Express (Desktop) 2013 or later. 6 4 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.5 If 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. 8 6 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.7 2. Set `WinLauncher` as the solution's `StartUp` project. 10 8 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 }}} 9 Select 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. 16 10 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. 11 3. Launch the debugger 18 12 19 = Debugging Multi-Process Applications = 13 Choose `Debug > Start Debugging`. 14 15 = Debugging DumpRenderTree = 16 17 1. Set `DumpRenderTreeLauncher` as your startup project. 18 19 2. Set the layout test as a command argument. 20 21 In `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 23 3. Launch the debugger. 24 25 = Debugging WebKit2 / WebKitTestRunner = 26 20 27 You 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. 21 28 … … 24 31 Visual 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. 25 32 26 = Inspecting WebKit2 API types = 33 = Miscellaneous Tips = 34 35 == Using the Microsoft and Safari Symbol Servers == 36 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. 37 38 == Using Watch Window == 39 You 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 47 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: 48 {{{ 49 {,,CoreFoundation}CFShow((void*)0x12345678) 50 }}} 51 52 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. 53 54 == Inspecting WebKit2 API types == 27 55 28 56 You 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):