Open main menu

CDOT Wiki β

Changes

Dive into Mozilla Debugging Mozilla Lab

1,903 bytes added, 20:18, 28 February 2007
C++ with VS.NET
== Instructions ==
=== C++ with Visual Studio.NET 2005 === * In VS.NET , click '''File > Open > Project/Solution....''' Navigate to your debug-built firefox.exe, perhaps in '''mozilla/objdir/dist/bin'''. This will create a '''Solution File (.sln)''' in the same directory as firefox.exe. * Now right-click firefox.exe in '''Solution Explorer''' and add '''MOZ_NO_REMOTE=1''' to the list of '''Environment variables'''. * Open a source file ('''File > Open > File...'''), for example, '''mozilla/widget/src/windows/nsWindow.cpp''', and set a breakpoint. You do this by clicking to the left of the line numbers--you should see a '''red circle'''. For example, you could set a breakpoint on the [http://lxr.mozilla.org/seamonkey/source/widget/src/windows/nsWindow.cpp#5253 mouse scrollwheel code] at '''line 5256''' to see when it gets executed and how it works:  4289 PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *aRetValue) 4290 { ... 5253 // Handle both flavors of mouse wheel events. 5254 #ifndef WINCE 5255 if (msg ==WM_MOUSEWHEEL || msg == WM_MOUSEHWHEEL) { 5256 static int iDeltaPerLine, iDeltaPerChar; 5257 static ULONG ulScrollLines, ulScrollChars = 1; 5258 static int currentVDelta, currentHDelta; 5259 static HWND currentWindow = 0; 5260 5261 PRBool isVertical = msg == WM_MOUSEWHEEL; ... * Now run Firefox from within VS.NET by pressing '''F5''' or by clicking '''Debug > Start Debugging'''. * Try rolling the mouse scrollwheel once the browser is fully loaded. * When you get dropped into the debugger, you can advance line-by-line using '''F11'''. VS.NET will automatically load the other source files it needs to show you what's happening. Notice the '''Call Stack''' window, which will help orient you as you learn the program's flow. Also, notice how you can inspect variables at run-time using the '''Autos''' window.
=== JavaScript with Venkman ===