零一
小狐狸
小狐狸
  • UID15135
  • 注册日期2006-10-23
  • 最后登录2006-12-24
  • 发帖数4
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:13265回复:9

如何用vc调试firefox

楼主#
更多 发布于:2006-10-23 11:40
firefox编译成功了但是在vc调试过程中无法定位到源代码,谁能帮帮我
零一
小狐狸
小狐狸
  • UID15135
  • 注册日期2006-10-23
  • 最后登录2006-12-24
  • 发帖数4
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
1楼#
发布于:2006-10-23 11:40
问题解决了
问题解决了 但是调试过程没有像直接用vc建的工程那样调着舒服
零一
小狐狸
小狐狸
  • UID15135
  • 注册日期2006-10-23
  • 最后登录2006-12-24
  • 发帖数4
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
2楼#
发布于:2006-10-23 11:40
调试介绍
看到有人看我发的帖子,估计有人也遇到同样的问题了 我就把我的调试方法给说一下。
打开vc   file-->open workspace-->选择 mozilla/dist/bin/firefox.exe 打开
按f5 或f10 开始吧   。
设断点    打开将要设断点的文件  设置断点就行了  注意:
要想调试程序  需要在编译过程中给加上ac_add_options --enable-debug
编译选项   否则断点不起作用 或不能定位断言位置
欢迎大家一起来讨论
hnstxx
千年狐狸
千年狐狸
  • UID1952
  • 注册日期2005-01-09
  • 最后登录2013-05-14
  • 发帖数4977
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
3楼#
发布于:2006-10-23 11:40
支持楼主的共享行为,顶一下。
MM:你是个外表冷酷,内心却很甜蜜的男人。
leonary
千年狐狸
千年狐狸
  • UID4095
  • 注册日期2005-03-16
  • 最后登录2016-12-24
  • 发帖数1908
  • 经验11枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
4楼#
发布于:2006-10-23 11:40
我看你的帖子了,不过没遇到你的问题,因为编译都没过
再狡猾的猎手也斗不过好狐狸
零一
小狐狸
小狐狸
  • UID15135
  • 注册日期2006-10-23
  • 最后登录2006-12-24
  • 发帖数4
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
5楼#
发布于:2006-10-23 11:40
编译没有过你遇到的问题是什么?提示什么错
在编译过程中,先看一下编译说明,在www.mozilla.org上有  
在windows下编译需注意
1,安装编译说明说的必需软件
2,make.exe这个程序的版本,我编译的是firefox 1.5的   他要求make.exe的版本不能是3.8.1或更高,要3.8.0
3,在源代码所在目录下建立一个mozconfig文件
4,把cygwin下的link.exe名字改掉
我不擅长写东西,以前都是只看不发,现在觉得得和大家一起交流一下要不然都落伍了,软件开发就是累呀。如果有不明白的地方欢迎交流
leonary
千年狐狸
千年狐狸
  • UID4095
  • 注册日期2005-03-16
  • 最后登录2016-12-24
  • 发帖数1908
  • 经验11枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
6楼#
发布于:2006-10-23 11:40
嗯,谢谢你的帖子,上半年折腾过一次,用VS2005没编过去,下载2003太麻烦,后来也没信心继续了。现在折腾gentoo,等过一段时间再继续
再狡猾的猎手也斗不过好狐狸
eastnet
小狐狸
小狐狸
  • UID21570
  • 注册日期2007-10-25
  • 最后登录2007-12-03
  • 发帖数6
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
7楼#
发布于:2006-10-23 11:40
官方网站上介绍,就是直接调试编译后的可执行文件,这也叫调试吗?哪位大虾指点指点到底如何调试比较好,可以代码跟踪的调试,谢谢!还有这些代码不知道如何下手看。谢谢!
leonary
千年狐狸
千年狐狸
  • UID4095
  • 注册日期2005-03-16
  • 最后登录2016-12-24
  • 发帖数1908
  • 经验11枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 社区居民
8楼#
发布于:2006-10-23 11:40
跨平台的开发不会给搞一个sln、dsw文件出来,makefile当然是王道。可以在VC里面抓进程已经不错了,要是用GCC编译的连IDE都没有

阅读代码的问题我的建议是你没有w行以上的编码经验还是先不要去看那些代码,把基础知识学好了再说。mozilla里面很多都是遗留的c代码,风格不好,对你学习编程有负面作用
再狡猾的猎手也斗不过好狐狸
firefoxvswebkit
小狐狸
小狐狸
  • UID22145
  • 注册日期2007-12-04
  • 最后登录2008-09-27
  • 发帖数5
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
9楼#
发布于:2006-10-23 11:40
Debugging Firefox using Visual Studio .NET 2005(转贴)
以下是转贴,我调试 firefox时也是参考这里所说的方法.原文见这里



Introduction
I wrote previously on how to build Firefox trunk on Windows using Visual Studio .NET 2005, and my next task was to use the VS debugger to try and better understand how certain things work. I'm primarily interested in how events move from the OS through Firefox's event system, eventually becoming DOM events. However, you can use these steps to investigate whatever interests you.

As I did before, I continue to post these with the disclaimer that you are advised to consult the official documentation before reading/trying what I've written. You can find an official FAQ on debugging Mozilla on Win32 here.

Firefox, meet Visual Studio. Visual Studio, meet Firefox.
The first step is to open VS.NET 2005 and then do File > Open > Project/Solution.... This will start the Open Dialog, and you should navigate to firefox.exe located in the dist\bin directory within the objdir you specified in .mozconfig (e.g., mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-objdir). [NOTE: for me that's C:\proj\mozilla\firefox-objdir\dist\bin\firefox.exe]  




This will create a Solution File (.sln) in the same directory as firefox.exe and give you the following in Solution Explorer [NOTE: we'll manually load source files in a moment, so don't worry that you don't see any source files yet]

Now you need to right-click firefox.exe in Solution Explorer and add MOZ_NO_REMOTE=1 to the list of Environment variables. This allows a second Firefox to start along side one that may already be running (e.g., the one you're reading this document in).

At this point you are ready to set a breakpoint in a source file so you can stop Firefox and inspect it running at the appropriate point. Open a source file [File > Open > File...], for example, C:\proj\mozilla\widget\windows\nsWindow.cpp. Then locate a suitable location for your breakpoint(s) and click to the left of the line numbers in the gray selection border--you should see a filled red circle:

Finally, you can run Firefox from within VS.NET by pressing F5 or by clicking Debug > Start Debugging. This will cause a console window to open with lots of messages related to debugging within the code. Eventually, you should get dropped into the debugger at the location of your breakpoint (NOTE: if you pick a line that doesn't get called, this won't happen, so choose wisely!).
Now you can do all the magic that's possible with the VS.NET debugger. In the example below you can see that the program has been halted at line 4346--my breakpoint. I've advanced beyond that manually using the F11 key to line 4350. As you step through the code, VS.NET will automatically load the other source files it needs to show you what's happening. Notice the Call Stack window, which will help orient you as you learn the program's flow. Also, notice how you can inspect variables at run-time using the Autos window. As you can see, the mouse has been moved (that's what caused the WM_MOUSEMOVE message) and the X and Y values are (524, 416).

Conclusion
There is too much to say about the VS.NET debugger for me to do it here. You would do well to familiarize yourself with its many options so that you can take advantage of all the features. Happy debugging.
游客

返回顶部