• cmake v2.8 bin及源码(自动化建构系统)

     CMake 是个跨平台的自动化建构系统,它用组态档控制建构过程(build process)的方式和 Unix 的 Make 相似,只是 CMake 的组态档取名为 CmakeLists.txt。Cmake 并不直接建构出最终的软件,而是产生标准的建构档(如 Unix 的 Makefile 或 Windows Visual C++ 的 projects/workspaces),然后再依一般的建构方式使用。这使得熟悉某个集成开发环境(IDE)的开发者可以用标准的方式建构他的软件,这种可以使用各平台的原生建构系统的能力是 CMake 和 SCons 等其他类似系统的区别之处。CMake 可以编译源代码、制做程式库、产生适配器(wrapper)、还可以用任意的顺序建构执行档。CMake 支援 in-place 建构(二进档和源代码在同一个目录树中)和 out-of-place 建构(二进档在别的目录里),因此可以很容易从同一个源代码目录树中建构出多个二进档。CMake 也支援静态与动态程式库的建构。   “CMake”这个名字是“cross platform make”的缩写。虽然名字中含有“make”,但是CMake和Unix上常见的“make”系统是分开的,而且更为高阶。 编辑本段 历史   CMake是为了解决美国国家医学图书馆出资的Visible Human Project专案下的Insight Segmentation and Registration Toolkit (ITK) 软件的跨平台建构的需求而创造出来的,其设计受到了Ken Martin开发的pcmaker所影响。pcmaker当初则是为了支援Visualization Toolkit这个开放源代码的三维图形和视觉系统才出现的,今日VTK也采用了CMake。在设计CMake之时,Kitware公司的Bill Hoffman采用了pcmaker的一些重要想法,加上更多他自己的点子,想把GNU建构系统的一些功能整合进来。CMake最初的实作是在2000年中作的,在2001年初有了急速的进展,许多改良是来自其他把CMake整合到自己的系统中的开发者,比方说,采用CMake作为建构环境的VXL社群就贡献了很多重要的功能,Brad King为了支援CABLE和GCC-XML这套自动包装工具也加了几项功能,奇异公司的研发部门则用在内部的测试系统DART,还有一些功能是为了让VTK可以过渡到CMake和支援(“美国Los Alamos国家实验室”&“洛斯阿拉莫斯国家实验室”)的Advanced Computing Lab的平行视觉系统ParaView而加的。 编辑本段 功能介绍   组态档是用一种建构软件专用的特殊编程语言写的CMake脚本。   内建C语言、C++、Fortran、Java的自动相依性分析功能。   经由CMake脚本语言支援SWIG、Qt、FLTK。   内建对微软Visual Studio .NET和过去的Visual Studio版本的支援,可以产生后缀为.dsp、.sln和.vcproj的文档。   用传统的时间标签侦测档案内容的改变。   支援平行建构(在多台电脑上同时建构)   在许多操作系统上进行跨平台编译,包括Linux、POSIX相容的系统(AIX、*BSD、HP-UX、IRIX、MinGW/MSYS、Solaris系统)、Mac OS X和微软Windows 95/98/NT/2000/XP等。   产生可以给Graphviz用的全局相依图。   已经和Dart、CTest和CPack等软件测试和释出的工具整合。 编辑本段 应用软件   Bullet Physics Engine   KDE (starting with version 4)   The Visualization Toolkit   Insight Segmentation and Registration Toolkit   ParaView   DevIL - Open Image Library   OpenSceneGraph   Scribus   Drishti   PvPGN   Chicken   ParadisEO   Quantum GIS   OPENCV 编辑本段 cmake的安装   下载cmake   安装cmake   tar –zxvf cmake-2.8.3.tar.gz   ./configure--prefix=/usr/local/cmake/   gmake   make install 注意: 包含win版linux版 源码及bin. 版本为v2.8.4

    3
    163
    38.37MB
    2011-03-03
    10
  • StraceNT v0.8(strace on Windows)

    StraceNT is a System Call Tracer for Windows. It provides similar functionality as of strace on Linux. It can trace all the calls made by a process to the imported functions from a DLL. StraceNT can be very useful in debugging and analyzing the internal working of a program. StraceNT uses IAT patching technique to trace function calls, which is quite reliable and very efficient way for tracing. It also supports filtering based on DLL name and function name and gives you a lot of control on which calls to trace and helps you to easily isolate a problem.

    0
    113
    156KB
    2011-02-28
    9
  • DDKWizard 安装包及ddkbuild_cmd,ddkbuild_bat(用于DDK开发环境搭建)

    DDKWizard is a so-called project creation wizard that allows you to create projects that use the DDKBUILD scripts from OSR (also available in the download section from this site). The wizard will give you several options to configure your project prior to the creation. Have a look at figure 1. Figure 2: Project creation dialog (click to enlarge) Instead of forcing you to use a subset of options and specific DDKs this wizard lets you choose what you want. Of course the template files are predefined and so is the content of the project(s) within certain limits. However, I tried to choose the best options that I could think of and provide a way to create quickly and easily the DDKBUILD project you want. This means that I tried to leave out those things that may limit your choice lateron and add other options that will give you the flexibility to change options quickly long after the project was created. DDKWizard adds a new subfolder in the project creation wizard - see figure 2 - and presents all supported project types there. Currently these are Driver, Empty Driver, Native Application, Win32 console application and Win32 DLL. In either case you just choose the type of project to create, give the name of the project and/or solution as well as other options (at the bottom) and you are being presented the wizard dialog (see figure 1). From the wizard dialog you choose the DDKBUILD script you want to use, the DDK or multiple DDKs as well as the other options. If you are curious about the Property Sheet feature, please download the manual and read the respective section there. Compatibility DDKWizard (1.2.0a) has been tested on the following configurations: Visual Studio Professional .NET with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual Studio Professional .NET 2003 with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual C++ 2005 Express with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual Studio 2005 Professional with WNET DDK and DDKBUILD.CMD on Windows 2003 Server R2 Standard Visual Studio 2008 Professional with WNET DDK and DDKBUILD.CMD on Windows XP From this list one can deduce that it is supposed to also run if you got the respective "non-Express" Visual C++ version. Also if there has been some Visual C++ .NET 2003 Express DDKWizard is prepared for it. Download You could go watch the demo or download right away: Manual: contains the detailed description of how to configure DDKBUILD and use DDKWizard. If you are unsure whether you should download and install DDKWizard grab this file and skim over it. Download: ddkwiz_manual.pdf (~513kB, 2009-12-05@20-11-55, downloaded 31666 times) Installer (incl. manual) of DDKWizard 1.3.0a: this is the setup program which will install DDKWizard along with the manual on your computer and register it with Visual Studio. Download: ddkwizard_setup.exe (~557kB, 2009-12-05@20-12-37, downloaded 72787 times) DDKBUILD.CMD: Stable version 7.4/r60 of OSRs DDKBUILD NT script version. Feedback for this version can be sent to me directly. Download: ddkbuild_cmd.zip (~12kB, 2009-11-28@04-38-36, downloaded 20707 times) DDKBUILD.BAT (obsoleted by the above!): Version 6.12 of OSRs DDKBUILD batch script version. Download: ddkbuild_bat.zip (~6kB, 2008-03-21@15-59-07, downloaded 17226 times) Trunk version of DDKBUILD.CMD The version from trunk is available as well. Please note that this is not necessarily the same version as offered in the ZIP archive above. It may be in a better shape (e.g. reported bugs fixed) or slightly worse (e.g. new feature that is not yet stable). So use this version only if you want to test the latest development version and are able to provide feedback. Here is the link to the prettier ViewVC URL: ddkbuild/trunk - SVN clients get read-only access here. License All projects created by DDKWizard can be put under whatever license you like to put them. The scripts and HTML files which contain the DDKWizard logic are subject to the zlib license starting with version 1.2.0, before it was released under the GPL v2 from 1991. The zlib license is a lot more liberal and allows just about any kind of use for the script and "user interface" part of DDKWizard. The DDKBUILD scripts are mirrored with the permission of OSR. I will try to keep it synchronized at all times. Everything else Contact me here and also visit my blog and my website. Note that I usually announce new versions of DDKWizard and DDKBUILD on my blog - you also might want to subscribe to the RSS feed for DDKWizard and DDKBUILD. This page will be extended whenever I deem it necessary.

    5
    1150
    558KB
    2011-02-27
    49
  • TortoiseSVN-1.6.4.16808-cn(SVN客户端1.6.4中文版)

    版本控制是管理信息修改的艺术,它一直是程序员最重要的工具,程序员经常会花时间作出小的修改,然后又在某一天取消了这些修改,想象一下一个开发者并行工作的团队 - 或许是同时工作在同一个文件!- 你就会明白为什么一个好的系统需要管理潜在的混乱。   什么是 TortoiseSVN?   TortoiseSVN 是 Subversion 版本控制系统的一个免费开源客户端,可以超越时间的管理文件和目录。文件保存在中央版本库,除了能记住文件和目录的每次修改以外,版本库非常像普通的文件服务器。你可以将文件恢复到过去的版本,并且可以通过检查历史知道数据做了哪些修改,谁做的修改。这就是为什么许多人将 Subversion 和版本控制系统看作一种“时间机器”。   某些版本控制系统也是软件配置管理(SCM)系统,这种系统经过精巧的设计,专门用来管理源代码树,并且具备许多与软件开发有关的特性 - 比如,对编程语言的支持,或者提供程序构建工具。不过 Subversion 并不是这样的系统;它是一个通用系统,可以管理任何类型的文件集,包括源代码。   TortoiseSVN 的历史   在2002年,Tim Kemp 发现 Subversion 是一个很好的版本控制系统,但是没有好的图形化客户端,创建一个作为 Windows 外壳集成的 Subversion 客户端的创意来自 TortoiseCVS,一个非常类似的 CVS 客户端。   Tim 学习了 TortoiseCVS 的源代码,将其作为 TortoiseSVN 的基础,然后开始这个项目,注册了域名 tortoisesvn.org,并将源代码提交到网上。此时 Stefan Küng 正在寻找一个好的免费版本控制系统,他发现了 Subversion 和 TortoiseSVN,由于 TortoiseSVN 还不能够使用,他加入了这个项目并开始编程。很快他便重写了大多数代码,并且开始添加命令和特性,此时,最初的代码都已经不复存在了。   随着 Subversion 越来越稳定,吸引了越来越多的用户开始使用 TortoiseSVN 作为他们的 Subversion 客户端。用户群增长迅速(每天都持续增长)。Lübbe Onken 提供了许多漂亮图标和 TortoiseSVN 的 logo,细心照料网站并且管理翻译。   TortoiseSVN 的特性   是什么让 TortoiseSVN 成为一个好的 Subversion 客户端?下面是一个简短的特性列表。   外壳集成   TortoiseSVN 与Windows 外壳(例如资源管理器)无缝集成,你可以保持在熟悉的工具上工作,不需要在每次使用版本控制功能时切换应用程序。   并且你不一定必须使用 Windows 资源管理器,TortoiseSVN 的右键菜单可以工作在其他文件管理器,以及文件/打开对话框等标准的 Windows 应用程序中。你必须牢记,TortoiseSVN 是有意作为 Windows 资源管理器的扩展开发,因此在其他程序可能集成的并不完整,例如重载图标可能不会显示。   重载图标   每个版本控制的文件和目录的状态使用小的重载图标表示,可以让你立刻看出工作副本的状态。   Subversion 命令的简便访问   所有的 Subversion 命令存在于资源管理器的右键菜单,TortoiseSVN 在那里添加子菜单。   因为 TortoiseSVN 是一个 Subversion 客户端,我们也很愿意为你展示一些 Subversion 本身的特性:   目录版本控制   CVS 只能追踪单个文件的历史,但是 Subversion 实现了一个“虚拟”文件系统,可以追踪整个目录树的修改,文件和目录都是版本控制的,结果就是可以在客户端对文件和目录执行移动和复制命令。   原子提交   提交要么完全进入版本库,要么一点都没有,这允许开发者以一个逻辑块提交修改。   版本控制的元数据   每个文件和目录都有一组附加的“属性”,你可以发明和保存任意的键/值对,属性是版本控制的,就像文件内容。   可选的网络层   Subversion 在版本库访问方面有一个抽象概念,利于人们去实现新的网络机制,Subversion 的“高级”服务器是 Apache 网络服务器的一个模块,使用 HTTP 的变种协议 WebDAV/DeltaV 通讯,这给了 Subversion 在稳定性和交互性方面很大的好处,可以直接使用服务器的特性,例如认证、授权、传输压缩和版本库浏览等等。也有一个轻型的,单独运行的 Subversion 服务器,这个服务器使用自己的协议,可以轻松的用 SSH 封装。   一致的数据处理   Subversion 使用二进制文件差异算法展现文件的区别,对于文本(人类可读)和二进制(人类不可读)文件具备一致的操作方式,两种类型的文件都压缩存放在版本库中,差异在网络上双向传递。   高效的分支和标签   分支与标签的代价不与工程的大小成比例,Subversion 建立分支与标签时只是复制项目,使用了一种类似于硬链接的机制,因而这类操作通常只会花费很少并且相对固定的时间,以及很小的版本库空间。   良好的维护能力   Subversion 没有历史负担,它由一系列良好的共享 C 库实现,具有定义良好的 API,这使 Subversion 非常容易维护,可以轻易的被其他语言和程序使用。 注意: 里面包含2个安装包, 先安装原版,再安装中文包. 再将属性设置里面设置 语言种类 为中文即可.

    5
    436
    22.38MB
    2011-02-14
    49
  • upx 3.07 (源码) (一款 可执行程序文件压缩器)

    UPX (the Ultimate Packer for eXecutables)是一款先进的可执行程序文件压缩器,压缩过的可执行文件体积缩小50%-70% ,这样减少了磁盘占用空间、网络上传下载的时间和其它分布以及存储费用。 通过 UPX 压缩过的程序和程序库完全没有功能损失和压缩之前一样可正常地运行,对于支持的大多数格式没有运行时间或内存的不利后果。 UPX 支持许多不同的可执行文件格式 包含 Windows 95/98/ME/NT/2000/XP/CE 程序和动态链接库、DOS 程序、 Linux 可执行文件和核心。 原代码 需要UCL,ZLIB库支持.并且没VS的工程文件. 修改点: 1. 增加了VS2005工程文件. 2. ZLIB以源码方式直接提供. 3. UCL库已经编好的可以直接用. 注意点: 请注意MD MT问题. 弄起来还挺麻烦的. 麻烦给点辛苦费.

    4
    166
    2.76MB
    2011-01-27
    10
  • Windows Server 2003 Resource Kit Tools

    The Microsoft® Windows® Server 2003 Resource Kit Tools are a set of tools to help administrators streamline management tasks such as troubleshooting operating system issues, managing Active Directory®, configuring networking and security features, and automating application deployment. The Microsoft® Windows® Server 2003 Resource Kit Tools are a set of tools to help administrators streamline management tasks such as troubleshooting operating system issues, managing Active Directory®, configuring networking and security features, and automating application deployment. The following tools are provided: Acctinfo.dll (documented in Readme.htm) Adlb.exe: Active Directory Load Balancing Tool Admx.msi: ADM File Parser Atmarp.exe: Windows ATM ARP Server Information Tool Atmlane.exe: Windows ATM LAN Emulation Client Information Autoexnt.exe: AutoExNT Service Cdburn.exe: ISO CD-ROM Burner Tool Checkrepl.vbs: Check Replication Chklnks.exe: Link Check Wizard Chknic.exe: Network Interface Card Compliance Tool for Network Load Balancing Cleanspl.exe: Spooler Cleaner Clearmem.exe: Clear Memory Clusdiag.msi: Cluster Diagnostics and Verification Tool Clusfileport.dll: Cluster Print File Port Clusterrecovery.exe: Server Cluster Recovery Utility Cmdhere.inf: Command Here Cmgetcer.dll: Connection Manager Certificate Deployment Tool Compress.exe: Compress Files Confdisk.exe: Disk Configuration Tool Consume.exe: Memory Consumers Tool Creatfil.exe: Create File Csccmd.exe: Client-Side Caching Command-Line Options Custreasonedit.exe: Custom Reason Editor (documented in Readme.htm) Delprof.exe: User Profile Deletion Utility Dh.exe: Display Heap Diskraid.exe: RAID Configuration Tool Diskuse.exe: User Disk Usage Tool Dnsdiag.exe: SMTP DNS Diagnostic Tool (documented in Readme.htm) Dumpfsmos.cmd: Dump FSMO Roles Dvdburn.exe: ISO DVD Burner Tool Empty.exe: Free Working Set Tool Eventcombmt.exe: Check Replication Fcopy.exe: File Copy Utility for Message Queuing Frsflags.vbs Getcm.exe: Connection Manager Profile Update Gpmonitor.exe: Group Policy Monitor Gpotool.exe: Group Policy Objects Hlscan.exe: Hard Link Display Tool Ifilttst.exe: IFilter Test Suite Ifmember.exe: User Membership Tool Inetesc.adm: Internet Explorer Enhanced Security Configuration Iniman.exe: Initialization Files Manipulation Tool Instcm.exe: Install Connection Manager Profile Instsrv.exe: Service Installer Intfiltr.exe: Interrupt Affinity Tool Kerbtray.exe: Kerberos Tray Kernrate.exe: Kernel Profiling Tool Klist.exe: Kerberos List Krt.exe: Certification Authority Key Recovery Lbridge.cmd: L-Bridge Linkd.exe Linkspeed.exe: Link Speed List.exe: List Text File Tool Lockoutstatus.exe: Account Lockout Status (documented in Readme.htm) Logtime.exe Lsreport.exe: Terminal Services Licensing Reporter Lsview.exe: Terminal Services License Server Viewer Mcast.exe: Multicast Packet Tool Memmonitor.exe: Memory Monitor Memtriage.exe: Resource Leak Triage Tool Mibcc.exe: SNMP MIB Compiler Moveuser.exe: Move Users Mscep.dll: Certificate Services Add-on for Simple Certificate Enrollment Protocol Nlsinfo.exe: Locale Information Tool Now.exe: STDOUT Current Date and Time Ntimer.exe: Windows Program Timer Ntrights.exe Oh.exe: Open Handles Oleview.exe: OLE/COM Object Viewer Pathman.exe: Path Manager Permcopy.exe: Share Permissions Copy Perms.exe: User File Permissions Tool Pfmon.exe: Page Fault Monitor Pkiview.msc: PKI Health Tool Pmon.exe: Process Resource Monitor Printdriverinfo.exe: Drivers Source Prnadmin.dll: Printer Administration Objects Qgrep.exe Qtcp.exe: QoS Time Stamp Queryad.vbs: Query Active Directory Rassrvmon.exe: RAS Server Monitor Rcontrolad.exe: Active Directory Remote Control Add-On Regini.exe: Registry Change by Script Regview.exe (documented in Readme.htm) Remapkey.exe: Remap Windows Keyboard Layout Robocopy.exe: Robust File Copy Utility Rpccfg.exe: RPC Configuration Tool Rpcdump.exe Rpcping.exe RPing: RPC Connectivity Verification Tool Rqc.exe: Remote Access Quarantine Client Rqs.exe: Remote Access Quarantine Agent Setprinter.exe: Spooler Configuration Tool Showacls.exe Showperf.exe: Performance Data Block Dump Utility Showpriv.exe: Show Privilege Sleep.exe: Batch File Wait Sonar.exe: FRS Status Viewer Splinfo.exe: Print Spooler Information Srvany.exe: Applications as Services Utility Srvcheck.exe: Server Share Check Srvinfo.exe: Remote Server Information Srvmgr.exe: Server Manager Ssdformat.exe: System State Data Formatter Subinacl.exe Tail.exe Tcmon.exe: Traffic Control Monitor Timeit.exe (documented in Readme.htm) Timezone.exe: Daylight Saving Time Update Utility Tsctst.exe: Terminal Server Client License Dump Tool Tsscalling.exe: Terminal Services Scalability Planning Tools Uddicatschemeeditor.exe: UDDI Services Categorization Scheme Editor Uddiconfig.exe: UDDI Services Command-line Configuration Utility Uddidataexport.exe: UDDI Data Export Wizard Usrmgr.exe: User Manager for Domains Vadump.exe: Virtual Address Dump Vfi.exe: Visual File Information Volperf.exe: Shadow Copy Performance Counters Volrest.exe: Shadow Copies for Shared Folders Restore Tool Vrfydsk.exe: Verify Disk Winexit.scr: Windows Exit Screen Saver Winhttpcertcfg.exe: WinHTTP Certificate Configuration Tool Winhttptracecfg.exe: WinHTTP Tracing Facility Configuration Tool Winpolicies.exe: Policy Spy Wins.dll: WINS Replication Network Monitor Parser Wlbs_hb.dll & Wlbs_rc.dll: Windows Load Balancing Server Network Monitor Parsers

    5
    75
    11.77MB
    2011-01-25
    4
  • google test (源码 v1.5)

    Google Test (gtest)是Google的开源C++测试框架

    4
    39
    1.02MB
    2010-12-30
    4
  • vld(Visual Leak Detector 内存泄露检测工具 源码)

    初识Visual Leak Detector   灵活自由是C/C++语言的一大特色,而这也为C/C++程序员出了一个难题。当程序越来越复杂时,内存的管理也会变得越加复杂,稍有不慎就会出现内存问题。内存泄漏是最常见的内存问题之一。内存泄漏如果不是很严重,在短时间内对程序不会有太大的影响,这也使得内存泄漏问题有很强的隐蔽性,不容易被发现。然而不管内存泄漏多么轻微,当程序长时间运行时,其破坏力是惊人的,从性能下降到内存耗尽,甚至会影响到其他程序的正常运行。另外内存问题的一个共同特点是,内存问题本身并不会有很明显的现象,当有异常现象出现时已时过境迁,其现场已非出现问题时的现场了,这给调试内存问题带来了很大的难度。   Visual Leak Detector是一款用于Visual C++的免费的内存泄露检测工具。相比较其它的内存泄露检测工具,它在检测到内存泄漏的同时,还具有如下特点:   1、 可以得到内存泄漏点的调用堆栈,如果可以的话,还可以得到其所在文件及行号;   2、 可以得到泄露内存的完整数据;   3、 可以设置内存泄露报告的级别;   4、 它是一个已经打包的lib,使用时无须编译它的源代码。而对于使用者自己的代码,也只需要做很小的改动;   5、 他的源代码使用GNU许可发布,并有详尽的文档及注释。对于想深入了解堆内存管理的读者,是一个不错的选择。   可见,从使用角度来讲,Visual Leak Detector简单易用,对于使用者自己的代码,唯一的修改是#include Visual Leak Detector的头文件后正常运行自己的程序,就可以发现内存问题。从研究的角度来讲,如果深入Visual Leak Detector源代码,可以学习到堆内存分配与释放的原理、内存泄漏检测的原理及内存操作的常用技巧等。   本文首先将介绍Visual Leak Detector的使用方法与步骤,然后再和读者一起初步的研究Visual Leak Detector的源代码,去了解Visual Leak Detector的工作原理。   使用Visual Leak Detector(1.0)   下面让我们来介绍如何使用这个小巧的工具。   首先从网站上下载zip包,解压之后得到vld.h, vldapi.h, vld.lib, vldmt.lib, vldmtdll.lib, dbghelp.dll等文件。将.h文件拷贝到Visual C++的默认include目录下,将.lib文件拷贝到Visual C++的默认lib目录下,便安装完成了。因为版本问题,如果使用windows 2000或者以前的版本,需要将dbghelp.dll拷贝到你的程序的运行目录下,或其他可以引用到的目录。   接下来需要将其加入到自己的代码中。方法很简单,只要在包含入口函数的.cpp文件中包含vld.h就可以。如果这个cpp文件包含了stdafx.h,则将包含vld.h的语句放在stdafx.h的包含语句之后,否则放在最前面。如下是一个示例程序:   #include <vld.h>   void main()   {   …   }   接下来让我们来演示如何使用Visual Leak Detector检测内存泄漏。下面是一个简单的程序,用new分配了一个int大小的堆内存,并没有释放。其申请的内存地址用printf输出到屏幕上。   #include <vld.h>   #include <stdlib.h>   #include <stdio.h>   void f()   {   int *p = new int(0x12345678);   printf("p=%08x, ", p);   }   void main()   {   f();   }   编译运行后,在标准输出窗口得到:   p=003a89c0   在Visual C++的Output窗口得到:   WARNING: Visual Leak Detector detected memory leaks!   ---------- Block 57 at 0x003A89C0: 4 bytes ---------- --57号块0x003A89C0地址泄漏了4个字节   Call Stack: --下面是调用堆栈   d:\test\testvldconsole\testvldconsole\main.cpp (7): f --表示在main.cpp第7行的f()函数   d:\test\testvldconsole\testvldconsole\main.cpp (14): main –双击以引导至对应代码处   f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (586): __tmainCRTStartup   f:\rtm\vctools\crt_bld\self_x86\crt\src\crtexe.c (403): mainCRTStartup   0x7C816D4F (File and line number not available): RegisterWaitForInputIdle   Data: --这是泄漏内存的内容,0x12345678   78 56 34 12 xV4..... ........   Visual Leak Detector detected 1 memory leak.   第二行表示57号块有4字节的内存泄漏,地址为0x003A89C0,根据程序控制台的输出,可以知道,该地址为指针p。程序的第7行,f()函数里,在该地址处分配了4字节的堆内存空间,并赋值为0x12345678,这样在报告中,我们看到了这4字节同样的内容。   可以看出,对于每一个内存泄漏,这个报告列出了它的泄漏点、长度、分配该内存时的调用堆栈、和泄露内存的内容(分别以16进制和文本格式列出)。双击该堆栈报告的某一行,会自动在代码编辑器中跳到其所指文件的对应行。这些信息对于我们查找内存泄露将有很大的帮助。   这是一个很方便易用的工具,安装后每次使用时,仅仅需要将它头文件包含进来重新build就可以。而且,该工具仅在build Debug版的时候会连接到你的程序中,如果build Release版,该工具不会对你的程序产生任何性能等方面影响。所以尽可以将其头文件一直包含在你的源代码中。   Visual Leak Detector工作原理   下面让我们来看一下该工具的工作原理。   在这之前,我们先来看一下Visual C++内置的内存泄漏检测工具是如何工作的。Visual C++内置的工具CRT Debug Heap工作原来很简单。在使用Debug版的malloc分配内存时,malloc会在内存块的头中记录分配该内存的文件名及行号。当程序退出时CRT会在main()函数返回之后做一些清理工作,这个时候来检查调试堆内存,如果仍然有内存没有被释放,则一定是存在内存泄漏。从这些没有被释放的内存块的头中,就可以获得文件名及行号。   这种静态的方法可以检测出内存泄漏及其泄漏点的文件名和行号,但是并不知道泄漏究竟是如何发生的,并不知道该内存分配语句是如何被执行到的。要想了解这些,就必须要对程序的内存分配过程进行动态跟踪。Visual Leak Detector就是这样做的。它在每次内存分配时将其上下文记录下来,当程序退出时,对于检测到的内存泄漏,查找其记录下来的上下文信息,并将其转换成报告输出。   初始化   Visual Leak Detector要记录每一次的内存分配,而它是如何监视内存分配的呢?Windows提供了分配钩子(allocation hooks)来监视调试堆内存的分配。它是一个用户定义的回调函数,在每次从调试堆分配内存之前被调用。在初始化时,Visual Leak Detector使用_CrtSetAllocHook注册这个钩子函数,这样就可以监视从此之后所有的堆内存分配了。   如何保证在Visual Leak Detector初始化之前没有堆内存分配呢?全局变量是在程序启动时就初始化的,如果将Visual Leak Detector作为一个全局变量,就可以随程序一起启动。但是C/C++并没有约定全局变量之间的初始化顺序,如果其它全局变量的构造函数中有堆内存分配,则可能无法检测到。Visual Leak Detector使用了C/C++提供的#pragma init_seg来在某种程度上减少其它全局变量在其之前初始化的概率。根据#pragma init_seg的定义,全局变量的初始化分三个阶段:首先是compiler段,一般c语言的运行时库在这个时候初始化;然后是lib段,一般用于第三方的类库的初始化等;最后是user段,大部分的初始化都在这个阶段进行。Visual Leak Detector将其初始化设置在compiler段,从而使得它在绝大多数全局变量和几乎所有的用户定义的全局变量之前初始化。   记录内存分配   一个分配钩子函数需要具有如下的形式:   int YourAllocHook( int allocType, void *userData, size_t size, int blockType, long requestNumber, const unsigned char *filename, int lineNumber);   就像前面说的,它在Visual Leak Detector初始化时被注册,每次从调试堆分配内存之前被调用。这个函数需要处理的事情是记录下此时的调用堆栈和此次堆内存分配的唯一标识——requestNumber。   得到当前的堆栈的二进制表示并不是一件很复杂的事情,但是因为不同体系结构、不同编译器、不同的函数调用约定所产生的堆栈内容略有不同,要解释堆栈并得到整个函数调用过程略显复杂。不过windows提供一个StackWalk64函数,可以获得堆栈的内容。StackWalk64的声明如下:   BOOL StackWalk64( DWORD MachineType, HANDLE hProcess, HANDLE hThread, LPSTACKFRAME64 StackFrame, PVOID ContextRecord, PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);STACKFRAME64结构表示了堆栈中的一个frame。给出初始的STACKFRAME64,反复调用该函数,便可以得到内存分配点的调用堆栈了。   // Walk the stack.   while (count < _VLD_maxtraceframes) {   count++;   if (!pStackWalk64(architecture, m_process, m_thread, &frame, &context,   NULL, pSymFunctionTableAccess64, pSymGetModuleBase64, NULL)) {   // Couldn't trace back through any more frames.   break;   }   if (frame.AddrFrame.Offset == 0) {   // End of stack.   break;   }   // Push this frame's program counter onto the provided CallStack.   callstack->push_back((DWORD_PTR)frame.AddrPC.Offset);   }   那么,如何得到初始的STACKFRAME64结构呢?在STACKFRAME64结构中,其他的信息都比较容易获得,而当前的程序计数器(EIP)在x86体系结构中无法通过软件的方法直接读取。Visual Leak Detector使用了一种方法来获得当前的程序计数器。首先,它调用一个函数,则这个函数的返回地址就是当前的程序计数器,而函数的返回地址可以很容易的从堆栈中拿到。下面是Visual Leak Detector获得当前程序计数器的程序:   #if defined(_M_IX86) || defined(_M_X64)   #pragma auto_inline(off)   DWORD_PTR VisualLeakDetector::getprogramcounterx86x64 ()   {   DWORD_PTR programcounter;   __asm mov AXREG, [BPREG + SIZEOFPTR] // Get the return address out of the current stack frame   __asm mov [programcounter], AXREG // Put the return address into the variable we'll return   return programcounter;   }   #pragma auto_inline(on)   #endif // defined(_M_IX86) || defined(_M_X64)   得到了调用堆栈,自然要记录下来。Visual Leak Detector使用一个类似map的数据结构来记录该信息。这样可以方便的从requestNumber查找到其调用堆栈。分配钩子函数的allocType参数表示此次堆内存分配的类型,包括_HOOK_ALLOC, _HOOK_REALLOC, 和 _HOOK_FREE,下面代码是Visual Leak Detector对各种情况的处理。   switch (type) {   case _HOOK_ALLOC:   visualleakdetector.hookmalloc(request);   break;   case _HOOK_FREE:   visualleakdetector.hookfree(pdata);   break;   case _HOOK_REALLOC:   visualleakdetector.hookrealloc(pdata, request);   break;   default:   visualleakdetector.report("WARNING: Visual Leak Detector: in allochook(): Unhandled allocation type (%d).\n", type);   break;   }   这里,hookmalloc()函数得到当前堆栈,并将当前堆栈与requestNumber加入到类似map的数据结构中。hookfree()函数从类似map的数据结构中删除该信息。hookrealloc()函数依次调用了hookfree()和hookmalloc()。   检测内存泄露   前面提到了Visual C++内置的内存泄漏检测工具的工作原理。与该原理相同,因为全局变量以构造的相反顺序析构,在Visual Leak Detector析构时,几乎所有的其他变量都已经析构,此时如果仍然有未释放之堆内存,则必为内存泄漏。   分配的堆内存是通过一个链表来组织的,检查内存泄漏则是检查此链表。但是windows没有提供方法来访问这个链表。Visual Leak Detector使用了一个小技巧来得到它。首先在堆上申请一块临时内存,则该内存的地址可以转换成指向一个_CrtMemBlockHeader结构,在此结构中就可以获得这个链表。代码如下:   char *pheap = new char;   _CrtMemBlockHeader *pheader = pHdr(pheap)->pBlockHeaderNext;   delete pheap;   其中pheader则为链表首指针。   报告生成   前面讲了Visual Leak Detector如何检测、记录内存泄漏及其其调用堆栈。但是如果要这个信息对程序员有用的话,必须转换成可读的形式。Visual Leak Detector使用SymGetLineFromAddr64()及SymFromAddr()生成可读的报告。   // Iterate through each frame in the call stack.   for (frame = 0; frame < callstack->size(); frame++) {   // Try to get the source file and line number associated with   // this program counter address.   if (pSymGetLineFromAddr64(m_process,   (*callstack)[frame], &displacement, &sourceinfo)) {   ...   }   // Try to get the name of the function containing this program   // counter address.   if (pSymFromAddr(m_process, (*callstack)[frame],   &displacement64, pfunctioninfo)) {   functionname = pfunctioninfo->Name;   }   else {   functionname = "(Function name unavailable)";   }   ...   }   概括讲来,Visual Leak Detector的工作分为3步,首先在初始化注册一个钩子函数;然后在内存分配时该钩子函数被调用以记录下当时的现场;最后检查堆内存分配链表以确定是否存在内存泄漏并将泄漏内存的现场转换成可读的形式输出。有兴趣的读者可以阅读Visual Leak Detector的源代码。   总结   在使用上,Visual Leak Detector简单方便,结果报告一目了然。在原理上,Visual Leak Detector针对内存泄漏问题的特点,可谓对症下药——内存泄漏不是不容易发现吗?那就每次内存分配是都给记录下来,程序退出时算总账;内存泄漏现象出现时不是已时过境迁,并非当时泄漏点的现场了吗?那就把现场也记录下来,清清楚楚的告诉使用者那块泄漏的内存就是在如何一个调用过程中泄漏掉的。   Visual Leak Detector是一个简单易用内存泄漏检测工具。现在最新的版本是1.9a,采用了新的检测机制,并在功能上有了很多改进。读者不妨体验一下。 附 源码 及其最后四个版本安装包. 支持vs2008 vs2010.

    5
    1188
    5.17MB
    2010-12-16
    34
  • Omaha 源码(一套软件自动更新库, 已应用于google多款产品)

    Introduction Omaha, otherwise known as Google Update, is a program to install requested software and keep it up to date. So far, Omaha supports many Google products for Windows, including Google Chrome and Google Earth, but there is no reason for it to only support Google products. We know that keeping software updated is both important and hard, and so by open-sourcing this project, our hope is that perhaps we can help others solve this problem. So, if you'd like to get involved, or even use Omaha to support your own software projects, then just follow the instructions in the Getting Started guide below, and you'll be good to go! Getting Started If you would just like to browse the source, you can do so here. However, if you'd like to contribute to the development of Omaha, there are much more detailed instructions in our Developer Setup Guide that you can follow to download and build Omaha. Design Overview A high level design overview of Omaha is provided here.

    1
    273
    7.5MB
    2010-11-11
    50
  • google-breakpad 源码(一个开源多平台的系统崩溃报告)

    An open-source multi-platform crash reporting system 使用google-breakpad生成dump文件 breakpad的主要功能就是生成dump文件,还可以将dump文件发送的远程http服务器。 breakpad的SVN在这里http://google-breakpad.googlecode.com/svn/trunk linux,mac,solaris,windows下面产生dump文件的例子文件在这几个文件里面,他们的流程几乎是一样的。 src/client/linux/handler/exception_handler_test.cc src/client/mac/handler/exception_handler_test.cc src/client/solaris/handler/exception_handler_test.cc src/processor/testdata/test_app.cc 首先编译breakpad中的exception_handler库,然后链接过去就可以了。

    4
    288
    6.61MB
    2010-11-10
    20
  • 分享王者

    成功上传51个资源即可获取
关注 私信
上传资源赚积分or赚钱