Difference between revisions of "Mercurial Source Server 0.1 Instructions"

From CDOT Wiki
Jump to: navigation, search
 
Line 48: Line 48:
 
If you see this output, you've successfully modified the pdb file.
 
If you see this output, you've successfully modified the pdb file.
  
== Re-running the Source Server ==
+
= Re-running the Source Server =
  
 
Re-run visual studio (or WinDbg if you prefer) using your existing source server settings, attach to firefox.exe. After the symbols have been loaded, switch to the call stack. Keep in mind that the old xul.pdb had over 6000 indexed source files, while the new xul.pdb has only 6 indexed source files for testing purposes.
 
Re-run visual studio (or WinDbg if you prefer) using your existing source server settings, attach to firefox.exe. After the symbols have been loaded, switch to the call stack. Keep in mind that the old xul.pdb had over 6000 indexed source files, while the new xul.pdb has only 6 indexed source files for testing purposes.

Latest revision as of 19:59, 18 October 2008

NOTE: I was only able to get this to work when linking my debugger (Visual Studio 2008) to Firefox, not Minefield. I used Firefox 3.0.3.

Source Server Setup Instructions

To set up the source server on your page, see this page.

0.1 Instructions

Download this file. The contents of this zip file can be modified in two possible ways.

NOTE: Make sure you've set up the source server and downloaded the pdb files into whatever directory you specified in either Visual Studio or WinDbg. Personally I use Visual Studio 2008.

First Method

In the zip file you've just downloaded, there is a folder called xul.pdb. Copy this folder into the location of your source files to override the existing xul.pdb.

Second Method

In the zip file you've just downloaded, there is a file named xul-test.stream. Copy this file to <wherever you store your symbols>/xul.pdb/<random binary value>/, you should see the actual .pdb file in this folder.

Next, if you don't have the Debugging Tools For Windows, download them here. Once you install the tools, add the srcsrv folder to your system's PATH. Back to the folder with xul.pdb and xul-test.stream. In your command line, run pdbstr -w -p:xul.pdb -i:xul-test.stream -s:srcsrv. To make sure the stream was inserted properly, run pdbstr -r -p:xul.pdb -s:srcsrv. You should see the following output:

SRCSRV: ini ------------------------------------------------
VERSION=2
INDEXVERSION=2
VERCTRL=http
SRCSRV: variables ------------------------------------------
HGSERVER=http://hg.mozilla.org/mozilla-central
SRCSRVVERCTRL=http
HTTP_EXTRACT_TARGET=%hgserver%/index.cgi/raw-file/7356c512e9e1/%var3%/%fnfile%(%var1%)
SRCSRVTRG=%http_extract_target%
SRCSRVCMD=
SRCSRV: source files ---------------------------------------
e:\fx19rel\winnt_5.2_depend\mozilla\xpcom\io\SpecialSystemDirectory.cpp*MYSERVER*xpcom/io
e:\fx19rel\winnt_5.2_depend\mozilla\xpcom\io\SpecialSystemDirectory.h*MYSERVER*xpcom/io
e:\fx19rel\winnt_5.2_depend\mozilla\netwerk\cache\src\nsCacheMetaData.h*MYSERVER*netwerk/cache/src
e:\fx19rel\winnt_5.2_depend\mozilla\netwerk\cache\src\nsCacheService.h*MYSERVER*netwerk/cache/src
e:\fx19rel\winnt_5.2_depend\mozilla\widget\src\xpwidgets\nsBaseAppShell.h*MYSERVER*widget/src/xpwidgets
e:\fx19rel\winnt_5.2_depend\mozilla\widget\src\xpwidgets\nsBaseAppShell.h*MYSERVER*widget/src/xpwidgets
e:\fx19rel\winnt_5.2_depend\mozilla\widget\src\xpwidgets\nsBaseAppShell.cpp*MYSERVER*widget/src/xpwidgets
e:\fx19rel\winnt_5.2_depend\mozilla\widget\src\xpwidgets\nsBaseAppShell.h*MYSERVER*widget/src/xpwidgets
e:\fx19rel\winnt_5.2_depend\mozilla\widget\src\xpwidgets\nsBaseAppShell.h*MYSERVER*widget/src/xpwidgets
SRCSRV: end ------------------------------------------------

If you see this output, you've successfully modified the pdb file.

Re-running the Source Server

Re-run visual studio (or WinDbg if you prefer) using your existing source server settings, attach to firefox.exe. After the symbols have been loaded, switch to the call stack. Keep in mind that the old xul.pdb had over 6000 indexed source files, while the new xul.pdb has only 6 indexed source files for testing purposes.

In the call stack, look for a call to nsBaseAppShell.cpp. If you try to grab source files for another method inside xul.dll (by double clicking on the stack line), it won't work. If you try to open a line call outside of xul.dll, you'll most likely be asked to execute a cvs command.

However, if you try to click on a line call inside nsBaseAppShell.cpp (you should see this file often in the stack) you'll notice in the status bar in the bottom left corner that Visual Studio is downloading the files from hg.mozilla.org/...../nsBaseAppShell.cpp, followed by the nsBaseAppShell.cpp file being opened up in VS. For further proof, right click on the nsBaseAppShell.cpp tab and select Open Containing Folder. You should see a location similar to the following:

Mercurial destination.jpg

This address shows that the file was downloaded from the mozilla-central tree.