Changes

Jump to: navigation, search

Dive into Mozilla Debugging Mozilla Lab

847 bytes added, 13:56, 19 March 2007
no edit summary
* 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_REMOTEXPCOM_DEBUG_BREAK=1warn''' to the list of '''Environment variables'''. Next, add the following to the '''Command Arguments''' list: '''-p ''development'' --no-remote''' where ''development'' is the name of a profile you've created for testing (NOTE: use -Profilemanager if you haven't done this yet, and create one).
* 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 5261''' to see when it gets executed and how it works:
http://lxr.mozilla.org/seamonkey/source/calendar/providers/wcap/calWcapCalendar.js#128
 
=== Exercise: debugging FirstXpcom ===
 
Using the same techniques we've just learned, we can also debug [[Dive into Mozilla First XPCOM Component|FirstXpcom's]] C++ code (we'll write a XUL/JS extension in a later lab).
 
Try adding breakpoints to the methods in '''FirstXpcom.cpp''', for example in '''::Add'''.
 
Use the [[Dive_into_Mozilla_First_XPCOM_Component#Accessing_FirstXpcom_from_the_JavaScript_Shell|JavaScript Shell]] to write some code in order to create and call the methods of FirstXpcom. Make sure you can see your code being executed via the breakpoints you've set in VS.NET.
== Resources ==

Navigation menu