⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manual-intro.html

📁 memory checking tool 源代码valgrind-3.2.1.tar.gz 这是英文使用手册
💻 HTML
字号:
<html xmlns:cf="http://docbook.sourceforge.net/xmlns/chunkfast/1.0"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>1.營ntroduction</title><link rel="stylesheet" href="vg_basic.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.69.0"><link rel="start" href="index.html" title="Valgrind Documentation"><link rel="up" href="manual.html" title="Valgrind User Manual"><link rel="prev" href="manual.html" title="Valgrind User Manual"><link rel="next" href="manual-core.html" title="2.燯sing and understanding the Valgrind core"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div><table class="nav" width="100%" cellspacing="3" cellpadding="3" border="0" summary="Navigation header"><tr><td width="22px" align="center" valign="middle"><a accesskey="p" href="manual.html"><img src="images/prev.png" width="18" height="21" border="0" alt="Prev"></a></td><td width="25px" align="center" valign="middle"><a accesskey="u" href="manual.html"><img src="images/up.png" width="21" height="18" border="0" alt="Up"></a></td><td width="31px" align="center" valign="middle"><a accesskey="h" href="index.html"><img src="images/home.png" width="27" height="20" border="0" alt="Up"></a></td><th align="center" valign="middle">Valgrind User Manual</th><td width="22px" align="center" valign="middle"><a accesskey="n" href="manual-core.html"><img src="images/next.png" width="18" height="21" border="0" alt="Next"></a></td></tr></table></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="manual-intro"></a>1.營ntroduction</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="manual-intro.html#manual-intro.overview">1.1. An Overview of Valgrind</a></span></dt><dt><span class="sect1"><a href="manual-intro.html#manual-intro.navigation">1.2. How to navigate this manual</a></span></dt></dl></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="manual-intro.overview"></a>1.1.燗n Overview of Valgrind</h2></div></div></div><p>Valgrind is a suite of simulation-based debugging and profilingtools for programs running on Linux (x86, amd64 and ppc32).  The systemconsists of a core, which provides a synthetic CPU in software, and aseries of tools, each of which performs some kind of debugging,profiling, or similar task.  The architecture is modular, so that newtools can be created easily and without disturbing the existingstructure.</p><p>A number of useful tools are supplied as standard.  Insummary, these are:</p><div class="orderedlist"><ol type="1"><li><p><span><strong class="command">Memcheck</strong></span> detects memory-management problems    in your programs.  All reads and writes of memory are checked, and    calls to malloc/new/free/delete are intercepted. As a result,    Memcheck can detect the following problems:</p><div class="itemizedlist"><ul type="disc"><li><p>Use of uninitialised memory</p></li><li><p>Reading/writing memory after it has been      free'd</p></li><li><p>Reading/writing off the end of malloc'd      blocks</p></li><li><p>Reading/writing inappropriate areas on the      stack</p></li><li><p>Memory leaks -- where pointers to malloc'd      blocks are lost forever</p></li><li><p>Mismatched use of malloc/new/new [] vs      free/delete/delete []</p></li><li><p>Overlapping <code class="computeroutput">src</code> and      <code class="computeroutput">dst</code> pointers in      <code class="computeroutput">memcpy()</code> and related      functions</p></li></ul></div><p>Problems like these can be difficult to find by other means,    often lying undetected for long periods, then causing occasional,    difficult-to-diagnose crashes.</p></li><li><p><span><strong class="command">Cachegrind</strong></span> is a cache profiler.  It    performs detailed simulation of the I1, D1 and L2 caches in your CPU    and so can accurately pinpoint the sources of cache misses in your    code.  If you desire, it will show the number of cache misses,    memory references and instructions accruing to each line of source    code, with per-function, per-module and whole-program summaries.  If    you ask really nicely it will even show counts for each individual    machine instruction.</p><p>On x86 and AMD64, Cachegrind auto-detects your machine's cache    configuration using the <code class="computeroutput">CPUID</code>    instruction, and so needs no further configuration info, in most    cases.</p><p>Cachegrind is nicely complemented by Josef Weidendorfer's    amazing KCacheGrind visualisation tool     (<a href="http://kcachegrind.sourceforge.net/cgi-bin/show.cgi/KcacheGrindIndex" target="_top">http://kcachegrind.sourceforge.net</a>),    a KDE application which presents these profiling results in a    graphical and easier-to-understand form.</p></li><li><p><span><strong class="command">Helgrind</strong></span> finds data races in multithreaded    programs.  Helgrind looks for memory locations which are accessed by    more than one (POSIX p-)thread, but for which no consistently used    (pthread_mutex_)lock can be found.  Such locations are indicative of    missing synchronisation between threads, and could cause    hard-to-find timing-dependent problems.</p><p>Helgrind ("Hell's Gate", in Norse mythology) implements the    so-called "Eraser" data-race-detection algorithm, along with various    refinements (thread-segment lifetimes) which reduce the number of    false errors it reports.  It is as yet somewhat of an experimental    tool, so your feedback is especially welcomed here.</p><p>Helgrind has been hacked on extensively by Jeremy    Fitzhardinge, and we have him to thank for getting it to a    releasable state.</p><p>NOTE: Helgrind is, unfortunately, not available in Valgrind    3.1.X, as a result of threading changes that happened in the 2.4.0    release.  We hope to reinstate its functionality in a future 3.2.0    release.</p></li></ol></div><p>A couple of minor tools (<span><strong class="command">Lackey</strong></span> and<span><strong class="command">Nulgrind</strong></span>) are also supplied.  These aren'tparticularly useful -- they exist to illustrate how to create simpletools and to help the valgrind developers in various ways.  Nulgrind isthe null tool -- it adds no instrumentation.  Lackey is a simple exampletool which counts instructions, memory accesses, and the number ofinteger and floating point operations your program does.</p><p>Valgrind is closely tied to details of the CPU and operatingsystem, and to a lesser extent, the compiler and basic C libraries.Nonetheless, as of version 3.1.0 it supports several platforms:x86/Linux (mature), AMD64/Linux (maturing), and PPC32/Linux (immaturebut works well).  Valgrind uses the standard Unix<code class="computeroutput">./configure</code>,<code class="computeroutput">make</code>, <code class="computeroutput">makeinstall</code> mechanism, and we have attempted to ensure thatit works on machines with kernel 2.4 or 2.6 and glibc2.2.X--2.3.X.</p><p>Valgrind is licensed under the <a href="license.gpl.html"> The GNU General Public License</a>,version 2.  The <code class="computeroutput">valgrind/*.h</code> headersthat you may wish to include in your code (eg.<code class="filename">valgrind.h</code>, <code class="filename">memcheck.h</code>) aredistributed under a BSD-style license, so you may include them in yourcode without worrying about license conflicts.  Some of the PThreadstest cases, <code class="filename">pth_*.c</code>, are taken from "PthreadsProgramming" by Bradford Nichols, Dick Buttlar &amp; Jacqueline ProulxFarrell, ISBN 1-56592-115-1, published by O'Reilly &amp; Associates,Inc.</p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="manual-intro.navigation"></a>1.2.燞ow to navigate this manual</h2></div></div></div><p>The Valgrind distribution consists of the Valgrind core, uponwhich are built Valgrind tools, which do different kinds of debuggingand profiling.  This manual is structured similarly.</p><p>First, we describe the Valgrind core, how to use it, and the flagsit supports.  Then, each tool has its own chapter in this manual.  Youonly need to read the documentation for the core and for the tool(s) youactually use, although you may find it helpful to be at least a littlebit familar with what all tools do.  If you're new to all this, youprobably want to run the Memcheck tool.  If you want to write a newtool, read <a href="writing-tools.html">Writing a New Valgrind Tool</a>.</p><p>Be aware that the core understands some command line flags, andthe tools have their own flags which they know about.  This means thereis no central place describing all the flags that are accepted -- youhave to read the flags documentation both for <a href="manual-core.html">Valgrind's core</a> and for the tool you want to use.</p></div></div><div><br><table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer"><tr><td rowspan="2" width="40%" align="left"><a accesskey="p" href="manual.html">&lt;&lt;燰algrind User Manual</a>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -