Using Visual Studio 2010 IDE来调试firefox源码

Setting up the build is somewhat straight forward on windows however I could not find any instructions on setting up a Visual Studio project for editing and debugging. I’m writing down the instructions I was given on IRC for my future benefits and for others. I hope at some point someone will take the initiative to put this information on MDN.

These instructions start from the point where you have a simple build of Firefox completed with the latest windows SDK and VS 10.

  • Create a new project using ‘Project from Existing Code’ (See Joe Walker’s comment if you don’t have this).
  • Select ‘Visual C++’, enter a project name (ex: mozilla-central), source directory as project file location, select ‘Show all files in Solution Explorer’.
  • Make sure you un-select ‘Add Files to the project from these folders’, hit Next.
  • Select ‘Use external build system’, hit Finish.
  • Project will be empty until you select ‘Show all Files’ from the solution explorer, File -> close the solution, re-open it. Source files should appear (I had to do this step 3 times)
  • For autocomplete select Project ->Properties -> NMake.
  • Under ‘Preprocessor Definitions’ add XP_WIN (return here later to add any definition your may be compiling with/find missing)
  • Under ‘Include Search Path’ type in ‘<objdir>\dist\include’ (I recommend to have built your project from command line for this step)
  • For debugging select ‘Debugging’ still under the property page, type in the absolute path to firefox.exe. Recommended command argument ‘-P “Minefield” -no-remote’.

I strongly recommend using ‘Console’ when working from the command line.

Optional: Add a build/clean target (Can otherwise be done outside of Visual Studio using the command line)

  • Create a single script, build.sh, that you can invoke that will trigger a build with the configuration you need. It should set all environment variables needed.
  • Copy the ‘mozilla-build/start-msvc10.bat’ to ‘mozilla-build/start-msvc10-build.bat’.
  • Replace the last line to read something like ‘”%MOZILLABUILD%”\msys\bin\bash –login <path-to-your-build-script>/build.sh’.
  • Select Project->Properties->NMake, for Build Command Line type ‘C:\mozilla-build\start-msvc10-build.bat’.
  • Advanced: Create multiple project configuration for each mozconfig build configuration you would like to work with then have them invoke specific build scripts and firefox.exe.

You can modify your script to do incremental builds to reduce your turn around time.

http://benoitgirard.wordpress.com/2011/05/27/using-visual-studio-2010-ide/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值