Archive

Posts Tagged ‘Debug’

Firefox.exe Created !! The Firefox debug build completed on Vista!

September 1st, 2009 Frank 1 comment

This is a follow up post to a series I’ve been posting. The previous post to this posting was “Firefox – Found time to Try again!

I finally was able to get Firefox to build on my Vista machine. It has given me a lot of trouble and I’ve had to troubleshoot several times. Relative to my previous post, I was last held up on a “NSInstall” error. NSinstall.exe would report “Bad File Number”.

The solution was reducing the directory depth. I had my mercurial repository in a sub folder of my documents folder. Specifically C:\Users\Frank\Documents\hg-repos\mozilla-fv-expirement\. I moved the directory to C:\mozilla-fv-expirement\ and re-ran the build script. It did it’s thing and I was able to fire up good-’ol firefox.exe from the [...]\dist\bin folder. I even checked my gmail account on it.

Now where?

I felt that before I started hacking and understanding the source code, I should be able to build the program. That way, if I make a significant change I can see how the code base reacts to it. Though, my intentions are not to hack but to understand how it works. The ability to drop print statements in should help with this… maybe…

Additionally, I hope to contribute to the Mozilla Litmus QA system. I might as well — I did take the time to build the trunk. :-)

Firefox – Found time to Try again!

August 29th, 2009 Frank No comments

My attempts to build Firefox on windows continue today. If you recall , previously, I’ve had great success with Mac OS X which I tried by chance but I’ve had problems while attempting the same thing on Windows.

This experience has made me decided that my troubles with building open source program in the past has stemmed from my usage of non-unix based operating systems — Windows — and my lack of understand about make, autoconf, python and perl.

Ok, lets go….

I’ve updated to the latest tip of Mozilla Central and at this very moment, I’m at revision 80f4cdc242b9. I expect to be working with this revision throughout the remainder of this post. Though, in general the exact revision shouldn’t matter if you are attempting the same thing.

I’ve just tried to build with the command make -f client.mk

I’ve received an error and while writing this I just thought of why. It’s stupid reason but one is bound to make mistakes like this. Simply put, I forgot the very required mozconfig file. I cloned my “clean” repository to a new directory to start over and I forgot this file. For records (and search engines) the exact error I received was “configure: error: –enable-application=APP was not specified and is required.”

So, now lets actually follow the directions since we are not experts.

I’ve reread the MDC about building Firefox and I’ve created a .mozconfig files. I’ll put it below for my and your reference. Don’t assume you should use this — check out the Mozilla docs. They are very straight forward.

# My first mozilla config - https://developer.mozilla.org/en/Configuring_Build_Options

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@

ac_add_options --enable-application=browser
mk_add_options MOZ_CO_PROJECT=browser

# Use the follow two for debugging (if desired)
# ac_add_options --enable-debug    
# ac_add_options --enable-tests

The # is the comment indicator and as you can see, I’ve setup but not enabled my options for debugging. I hope to use these later but for now I’ve decided to disable them.

Given the above .mozconfig file, I’ve attempted to rebuild and run in to an apparent known issue with building on Vista. Mozilla has done a beautiful job document the reason and how to fix it.The exact error is: “configure: error: System header oleacc.idl is not available” but right afterward the URL is given.

To correct this problem, Mozilla has listed three options. I’ve elected to attempt the “Use Windows 2008 SDK” option. I wasn’t sure which to pick but I decided that the 2008 SDK seems to be supported as the site states “Unfortunately, the Vista or Windows 2008 SDKs are required to build Mozilla”. I wish the page made a recommendation or gave pros and cons but perhaps it doesn’t matter…

The next error

After getting the Windows 2008 SDK installed and up to date, I received another error. This time the error read “nsinstall: Bad file number”. I’m not sure where to go from here, so I posted at the usenet.

The prevalent solution was to run as administrator, according to these two articles:

This hasn’t worked for me; I’m still trying to figure this out. Apparently, my success is not going to come today so I’m setting this aside for the time being.

In the hopes of continuing soon, I’ve posted two questions:

Debug VBScript with Visual Studio

May 21st, 2009 Frank 13 comments

For a project that I work on at at my primary employer, we use VBScript inside of DTS packages. Until this project, I’ve not had too much experience with VBScript. What I’ve found most frustrating about the language is the inability to step though the code… until a recent discovery. I’ve found that if I save the target code to my local machine as a VBS file and execute it with WScript.exe, I can attach a debugger to it.

I’ve discovered this by poking around and I don’t know too much about WScript.exe. I’m sure if you Google it, you can find more about it.

For this to work, you’ll need a copy of Visual Studio installed. I am not sure if any of the express editions will work. Drop a line in the comments if you find it will. As a quick walk though:

  1. Save your code as a VBS file. Don’t forget to call Main (or your main) function as wscript won’t automatically call main.
  2. Open a command prompt.
  3. Navigate to the location of the file.
  4. Type: WScript.exe FileName.vbs //D //X
  5. You should be prompted to select a debugger, select a new instance of either Visual Studio 2003, 2005 or 2008.
  6. Visual studio will open up and break at the very first line.
  7. Step though the code.

For an example, save the following as “Example.vbs” on your desktop.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
MsgBox "Starting Script!"
Dim i : i = 0
Const C_Max = 100
Dim sPrimeNumberList : sPrimeNumberList = "Prime Numbers: " & vbCrLf
For i = 0 to C_Max
  If IsNumberPrimeNumber(i) Then
     sPrimeNumberList = sPrimeNumberList & cStr(i) & ", "
  End If
Next
MsgBox sPrimeNumberList
MsgBox "Script Completed."

Public Function IsNumberPrimeNumber(ByVal iNumber)
Dim bIsPrime : bIsPrime = True
For j = 2 To iNumber\2
  bIsPrime = iNumber Mod j > 0
  If Not bIsPrime Then Exit For
Next
IsNumberPrimeNumber = bIsPrime
End Function

Open a command prompt and navigate to your desktop:

Command Prompt for Debugging VBScript from Visual Studio

Command Prompt for Debugging VBScript from Visual Studio

Once there, type in the following:

1
 wscript Example.vbs //D //X

You should then be presented with a dialog similar to the following:

Visual Studio Debugging VBScript

Visual Studio Debugging VBScript

Once you make a selection, you should get something like the following:

Debugging VBScript from Visual Studio

Debugging VBScript from Visual Studio

From here, I’ll assume you are familiar enough with Visual Studio to play with the debugger and learn how it works. When debugging VBScript, I’ve found that you don’t have all the options that you might be used to such as Step In To, but for me simply having this much is a life saver.

To get around the step-in-to thing, I simply use Run to Cursor. It works like a charm.

Update: I just found that (at least on this computer) and in Visual Studio 2003, I have all my standard code-stepping buttons available. I’m not sure why on my work computer I only have Step-Over but either way, this is still a life saver.