-
Notifications
You must be signed in to change notification settings - Fork 8
Note debugging TImelapse
On OS X, you must adjust some settings for the second-level inspector to work. Enter the following at the command line:
defaults write com.apple.Safari __WebInspectorPageGroupLevel1__.WebKit2ApplicationChromeModeEnabled -bool YES
defaults write com.apple.Safari __WebInspectorPageGroupLevel1__.WebKit2DeveloperExtrasEnabled -bool YES
WebKit is able to log debug and error information from many sources.
Inside Web Inspector, any console.log or console.assert messages will appear in the second-level inspector in a debug build. To make these messages additionally appear in the console (even in release builds), set the following preference:
defaults write com.apple.Safari __WebInspectorPageGroupLevel1__.WebKit2LogsPageMessagesToSystemConsoleEnabled -bool YES
To permanently enable logging messages from the replay infrastructure, set the following preference (OS X):
defaults write -g WebCoreLogging -string "WebReplay"
This can also be used to enable other logging within WebCore by concatenating the log levels with a comma. You can see a list of available levels inside Source/WebCore/platform/Logging.h. Other components such as WebKit2 have separate log levels.
NB. For debugging nondeterminism issues, Brian prefers a wider set of logging that includes network, events, and the page cache. Here's his setting:
defaults write com.apple.WebProcess WebCoreLogging -string "WebReplay,Events,Loading,Network,PageCache,History"
There are several ways to do this (OS X):
- Open XCode manually, select "Product > Attach to Process..." from the menu bar.
For OSX 10.8: Attach to WebProcess to debug JavaScriptCore, WebCore, Inspector backend, and the WebProcess-side of WebKit2. Attach to SafariForWebKitDevelopment to debug the UIProcess-side of WebKit2.
For OSX 10.9: Attach to com.apple.WebKit.WebContent.Development to debug JavaScriptCore, WebCore, Inspector, and the WebProcess-side of WebKit2. Attach to SafariForWebKitDevelopment to debug the UIProcess-side of WebKit2. Attach to com.apple.WebKit.Networking.Development to debug the NetworkProcess-side of WebKit2. Note that the WebContent process could be destroyed when navigating between domains, and you will have to re-attach the debugger.
- To debug under lldb/gdb, run the script
Tools/Scripts/debug-safari, passing--debugor--release. (You can set the default configuration of release or debug using the scriptTools/Scripts/set-webkit-configuration.
For more tips, see the debugging section of the WebKit wiki.