Difference between revisions of "Debug Mode Firefox 1.5"

From CDOT Wiki
Jump to: navigation, search
(Instructions)
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Run Firefox 1.5 in Debug mode =
 
= Run Firefox 1.5 in Debug mode =
 +
 
Written By [[user:yshen6|Yi Shen]].
 
Written By [[user:yshen6|Yi Shen]].
  
 
== Introduction ==
 
== Introduction ==
I previously wrote how to [[Assignment_1_(yshen6)|build Firefox]] in Windows, and here I was work on how to run firefox 1.5 in debug mode by Visual Studio 2003 debuger and better understand how certain things work.
+
I previously wrote how to [[Assignment_1_(yshen6)|build Firefox]] in Windows, and here I was work on how to run Firefox 1.5 in debug mode by Visual Studio 2003 debuger and better understand how certain things work.
  
 
== Required ==
 
== Required ==
 +
 
# Firefox 1.5 already build on Windows
 
# Firefox 1.5 already build on Windows
 
# Microsoft Visual Studio 2003 installed
 
# Microsoft Visual Studio 2003 installed
  
 
== Instructions ==
 
== Instructions ==
First we need open the firefix project in Visual Studio: File>Open>Project... this will start the Open Project Dialog and you should navigate to your firefox.exe directory. For me it is: C:\proj\mozilla\hopefullyWorked.firefox.optimized\dist\bin
+
 
 +
First we need open the Firefox project in Visual Studio:  
 +
<pre>File>Open>Project...</pre>
 +
This will start the Open Project Dialog and you should navigate to your firefox.exe directory, for me it is:  
 +
<pre>C:\proj\mozilla\hopefullyWorked.firefox.optimized\dist\bin</pre>
 +
[[Image:Yshen6_openProject.JPG]]<br/><br/><br/>
 +
Visual Studio will create a Solution File (.sln) in the same directory as firefox.exe and give you the Solution Explorer<br/><br/><br/>
 +
[[Image:Yshen6_projectSolution.JPG]]<br/><br/><br/>
 +
Now we are ready to set a breakpoint in a source file so we can stop Firefox and inspect it running at the appropriate point. Open a source file
 +
<pre>File > Open > File...</pre>
 +
To find the file that related to your project you need search the keyword at http://lxr.mozilla.org. First you need specify which version of Firefox your working on then do a search for the keyword, for example for our project "Canvas" which Rendering 2D/3D Object on the screen.<br/><br/><br/>
 +
[[Image:Yshen6_searchCanvas.JPG]]<br/><br/><br/>
 +
There are hundreds of lines that in different files related to Canvas, then we need read some commons or go in to code to specify which file we need, for our project is: nsCanvasRenderingContext2D.cpp, then we need go back to our source files and open it:
 +
<pre>C:\proj\mozilla\content\canvas\src\nsCanvasRenderingContext2D.cpp</pre>
 +
Then locate a line for your breakpoint and click to the left of the line number in the gray selection border then it set a red circle:<br/><br/><br/>
 +
[[Image:Yshen6_openFile.JPG]]<br/><br/><br/>
 +
Now we can run Firefox from Visual Studio by pressing F5 or by clicking Debug > Start Debugging, This will require you to save firefox.sln file, save it within the firefox.exe directory:<br/><br/><br/>
 +
[[Image:Yshen6_saveFile.JPG]]:<br/><br/><br/>
 +
Then Visual Studio will run a console window with lots of messages related to debugging within the code. We will end up at the location of the breakpoint(if it is called during the compiling).<br/><br/><br/>
 +
[[Image:Yshen6 debugConsole.JPG]]<br/><br/><br/>
 +
Now we have Firefox in debug mode. We can navigate to the code that building Canvus Objects by setting up breakpoints in the file.
 +
 
 +
== Conclusion ==
 +
To run Firefox in debug mode by Visual Studio does not take very long time and it is not as hard as build it in Windows, but it require you know where to find the project file and find the file that related to your project.

Latest revision as of 22:23, 20 October 2006

Run Firefox 1.5 in Debug mode

Written By Yi Shen.

Introduction

I previously wrote how to build Firefox in Windows, and here I was work on how to run Firefox 1.5 in debug mode by Visual Studio 2003 debuger and better understand how certain things work.

Required

  1. Firefox 1.5 already build on Windows
  2. Microsoft Visual Studio 2003 installed

Instructions

First we need open the Firefox project in Visual Studio:

File>Open>Project...

This will start the Open Project Dialog and you should navigate to your firefox.exe directory, for me it is:

C:\proj\mozilla\hopefullyWorked.firefox.optimized\dist\bin

Yshen6 openProject.JPG


Visual Studio will create a Solution File (.sln) in the same directory as firefox.exe and give you the Solution Explorer


Yshen6 projectSolution.JPG


Now we are ready to set a breakpoint in a source file so we can stop Firefox and inspect it running at the appropriate point. Open a source file

File > Open > File...

To find the file that related to your project you need search the keyword at http://lxr.mozilla.org. First you need specify which version of Firefox your working on then do a search for the keyword, for example for our project "Canvas" which Rendering 2D/3D Object on the screen.


Yshen6 searchCanvas.JPG


There are hundreds of lines that in different files related to Canvas, then we need read some commons or go in to code to specify which file we need, for our project is: nsCanvasRenderingContext2D.cpp, then we need go back to our source files and open it:

C:\proj\mozilla\content\canvas\src\nsCanvasRenderingContext2D.cpp

Then locate a line for your breakpoint and click to the left of the line number in the gray selection border then it set a red circle:


Yshen6 openFile.JPG


Now we can run Firefox from Visual Studio by pressing F5 or by clicking Debug > Start Debugging, This will require you to save firefox.sln file, save it within the firefox.exe directory:


Yshen6 saveFile.JPG:


Then Visual Studio will run a console window with lots of messages related to debugging within the code. We will end up at the location of the breakpoint(if it is called during the compiling).


Yshen6 debugConsole.JPG


Now we have Firefox in debug mode. We can navigate to the code that building Canvus Objects by setting up breakpoints in the file.

Conclusion

To run Firefox in debug mode by Visual Studio does not take very long time and it is not as hard as build it in Windows, but it require you know where to find the project file and find the file that related to your project.