[f1607a4] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[8dfc5c3] | 7 | <!ENTITY valgrind-download-http "https://sourceware.org/ftp/valgrind/valgrind-&valgrind-version;.tar.bz2">
|
---|
[ec67287] | 8 | <!ENTITY valgrind-download-ftp "ftp://sourceware.org/pub/valgrind/valgrind-&valgrind-version;.tar.bz2">
|
---|
| 9 | <!ENTITY valgrind-md5sum "817dd08f1e8a66336b9ff206400a5369">
|
---|
| 10 | <!ENTITY valgrind-size "14 MB">
|
---|
| 11 | <!ENTITY valgrind-buildsize "347 MB (additional 228 MB for tests)">
|
---|
| 12 | <!ENTITY valgrind-time "1.1 SBU (additional 5.1 SBU for tests)">
|
---|
[f1607a4] | 13 | ]>
|
---|
| 14 |
|
---|
| 15 | <sect1 id="valgrind" xreflabel="Valgrind-&valgrind-version;">
|
---|
| 16 | <?dbhtml filename="valgrind.html"?>
|
---|
| 17 |
|
---|
| 18 | <sect1info>
|
---|
| 19 | <othername>$LastChangedBy$</othername>
|
---|
| 20 | <date>$Date$</date>
|
---|
| 21 | </sect1info>
|
---|
| 22 |
|
---|
| 23 | <title>Valgrind-&valgrind-version;</title>
|
---|
| 24 |
|
---|
| 25 | <indexterm zone="valgrind">
|
---|
| 26 | <primary sortas="a-Valgrind">Valgrind</primary>
|
---|
| 27 | </indexterm>
|
---|
| 28 |
|
---|
| 29 | <sect2 role="package">
|
---|
| 30 | <title>Introduction to Valgrind</title>
|
---|
| 31 |
|
---|
| 32 | <para>
|
---|
| 33 | <application>Valgrind</application> is an instrumentation framework for
|
---|
| 34 | building dynamic analysis tools. There are Valgrind tools that can
|
---|
| 35 | automatically detect many memory management and threading bugs, and
|
---|
| 36 | profile programs in detail. Valgrind can also be used to build new
|
---|
[f3429309] | 37 | tools.
|
---|
[f1607a4] | 38 | </para>
|
---|
| 39 |
|
---|
[5f9ca84] | 40 | &lfs81_checked;
|
---|
[f1607a4] | 41 |
|
---|
| 42 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 43 | <itemizedlist spacing="compact">
|
---|
| 44 | <listitem>
|
---|
| 45 | <para>
|
---|
| 46 | Download (HTTP): <ulink url="&valgrind-download-http;"/>
|
---|
| 47 | </para>
|
---|
| 48 | </listitem>
|
---|
| 49 | <listitem>
|
---|
| 50 | <para>
|
---|
| 51 | Download (FTP): <ulink url="&valgrind-download-ftp;"/>
|
---|
| 52 | </para>
|
---|
| 53 | </listitem>
|
---|
| 54 | <listitem>
|
---|
| 55 | <para>
|
---|
| 56 | Download MD5 sum: &valgrind-md5sum;
|
---|
| 57 | </para>
|
---|
| 58 | </listitem>
|
---|
| 59 | <listitem>
|
---|
| 60 | <para>
|
---|
| 61 | Download size: &valgrind-size;
|
---|
| 62 | </para>
|
---|
| 63 | </listitem>
|
---|
| 64 | <listitem>
|
---|
| 65 | <para>
|
---|
| 66 | Estimated disk space required: &valgrind-buildsize;
|
---|
| 67 | </para>
|
---|
| 68 | </listitem>
|
---|
| 69 | <listitem>
|
---|
| 70 | <para>
|
---|
| 71 | Estimated build time: &valgrind-time;
|
---|
| 72 | </para>
|
---|
| 73 | </listitem>
|
---|
| 74 | </itemizedlist>
|
---|
| 75 |
|
---|
| 76 | <bridgehead renderas="sect3">Valgrind Dependencies</bridgehead>
|
---|
| 77 |
|
---|
| 78 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
| 79 | <para role="optional">
|
---|
[ae6d3b8] | 80 | <xref linkend="bind"/> or <xref linkend="bind-utils"/> (for tests),
|
---|
[f1607a4] | 81 | <xref linkend="boost"/>,
|
---|
[35f1730] | 82 | <xref linkend="gdb"/> (for tests),
|
---|
[ae6d3b8] | 83 | <xref linkend="llvm"/> (with Clang), and
|
---|
| 84 | <xref linkend="which"/> (for tests)
|
---|
[f1607a4] | 85 | </para>
|
---|
| 86 |
|
---|
[ae6d3b8] | 87 | <!-- See "maintainer note", below
|
---|
[f1607a4] | 88 | <bridgehead renderas="sect4">Optional for regenerating the documentation</bridgehead>
|
---|
| 89 | <para role="optional">
|
---|
[f3429309] | 90 | <xref linkend="libxslt"/> and
|
---|
[2d98031c] | 91 | <xref linkend="texlive"/> (or <xref linkend="tl-installer"/>)
|
---|
[f1607a4] | 92 | </para>
|
---|
[ae6d3b8] | 93 | -->
|
---|
[f1607a4] | 94 | <para condition="html" role="usernotes">User Notes:
|
---|
| 95 | <ulink url="&blfs-wiki;/valgrind"/>
|
---|
| 96 | </para>
|
---|
| 97 | </sect2>
|
---|
| 98 |
|
---|
| 99 | <sect2 role="installation">
|
---|
| 100 | <title>Installation of Valgrind</title>
|
---|
| 101 |
|
---|
[10ea605e] | 102 | <!-- Fix applied upstream, remove in valgrind 1.14-->
|
---|
| 103 | <para>
|
---|
| 104 | First, fix a bug, which has been exposed by glibc-2.26:
|
---|
| 105 | </para>
|
---|
| 106 |
|
---|
| 107 | <screen><userinput>sed -i '1904s/4/5/' coregrind/m_syswrap/syswrap-linux.c</userinput></screen>
|
---|
| 108 |
|
---|
[bbe0fbf] | 109 | <para>
|
---|
| 110 | Install <application>Valgrind</application> by running the following
|
---|
[1b0d0188] | 111 | commands:
|
---|
| 112 | </para>
|
---|
| 113 |
|
---|
[29dbd37] | 114 | <screen><userinput>sed -i 's|/doc/valgrind||' docs/Makefile.in &&
|
---|
[1b0d0188] | 115 |
|
---|
| 116 | ./configure --prefix=/usr \
|
---|
[f1607a4] | 117 | --datadir=/usr/share/doc/valgrind-&valgrind-version; &&
|
---|
| 118 | make</userinput></screen>
|
---|
| 119 |
|
---|
[0990e658] | 120 | <note>
|
---|
| 121 | <para>
|
---|
| 122 | To run the tests for this package, valgrind requires a version of the
|
---|
[c8385bb7] | 123 | /lib/ld-2.26.so (or later) library with debugging symbols present.
|
---|
[0990e658] | 124 | Normally in LFS these debugging symbols are stripped at the end of
|
---|
| 125 | Chapter 6. To get this library, glibc must be rebuilt with the current
|
---|
| 126 | glibc version using the same compiler that was used to build LFS. The
|
---|
[c8385bb7] | 127 | ld.so can then be renamed to ld-2.26.so.dbg and copied to /lib.
|
---|
[0990e658] | 128 | Then a symlink needs to be changed:</para>
|
---|
| 129 |
|
---|
[c8385bb7] | 130 | <screen role="nodump"><userinput>ln -sfv ld-2.26.so.dbg /lib/ld-linux-x86-64.so.2</userinput></screen>
|
---|
[0990e658] | 131 |
|
---|
| 132 | <para>
|
---|
| 133 | Adjust the above instruction as needed for a 32-bit system or for a
|
---|
| 134 | different version of glibc.
|
---|
| 135 | </para>
|
---|
| 136 |
|
---|
| 137 | <para>
|
---|
| 138 | In addition, other glibc libraries with debugging symbols present
|
---|
| 139 | may be needed for some tests.
|
---|
| 140 | </para>
|
---|
| 141 | </note>
|
---|
| 142 |
|
---|
[f1607a4] | 143 | <para>
|
---|
[bbe0fbf] | 144 | To test the results, issue: <command>make regtest</command>. The tests
|
---|
[ae6d3b8] | 145 | may hang forever if <xref linkend="gdb"/> is not installed. Some tests
|
---|
| 146 | are known to hang also, depending on the version of glibc. Problematic
|
---|
| 147 | tests can be disabled by changing the <userinput>prereq:</userinput> line
|
---|
[0639bb6] | 148 | in the corresponding <filename>.vgtest</filename> file to
|
---|
[ae6d3b8] | 149 | <userinput>prereq: false</userinput>. For example:
|
---|
[f1607a4] | 150 | </para>
|
---|
| 151 |
|
---|
[ae6d3b8] | 152 | <!-- For valgrind-3.12.0, the pth_cond_destroy_busy test hangs forever because
|
---|
| 153 | of some change in glibc-2.25. Should be fixed in next versions of
|
---|
| 154 | valgrind.-->
|
---|
| 155 | <screen><userinput>sed -e 's@prereq:.*@prereq: false@' \
|
---|
| 156 | -i {helgrind,drd}/tests/pth_cond_destroy_busy.vgtest</userinput></screen>
|
---|
| 157 |
|
---|
| 158 | <note>
|
---|
| 159 | <para>
|
---|
| 160 | The <application>OpenMP</application> tests are skipped if libgomp
|
---|
| 161 | has been compiled with <option>--enable-linux-futex</option> (the
|
---|
| 162 | default). If needed, just recompile the libgomp library from
|
---|
| 163 | the gcc build tree, passing <option>--disable-linux-futex</option>
|
---|
| 164 | to configure, storing the library to some place and changing the link
|
---|
| 165 | from <filename>/usr/lib/libgomp.so.1</filename> to point to the new
|
---|
| 166 | library.
|
---|
| 167 | </para>
|
---|
| 168 | </note>
|
---|
| 169 |
|
---|
| 170 | <!-- Note to maintainer: there is a long thread in ticket #5882 explaining
|
---|
| 171 | why we do not provide instructions to rebuild the documentation.
|
---|
| 172 | (still broken with TeXLive 2016) -->
|
---|
| 173 |
|
---|
[f1607a4] | 174 | <para>
|
---|
| 175 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 176 | </para>
|
---|
| 177 |
|
---|
| 178 | <screen role="root"><userinput>make install</userinput></screen>
|
---|
| 179 |
|
---|
| 180 | </sect2>
|
---|
| 181 |
|
---|
| 182 | <sect2 role="commands">
|
---|
| 183 | <title>Command Explanations</title>
|
---|
| 184 |
|
---|
| 185 | <para>
|
---|
[9dfdd942] | 186 | <command>sed -i ... docs/Makefile.in </command>: This sed provides for
|
---|
[f1607a4] | 187 | installing the documentation in a versioned directory.
|
---|
| 188 | </para>
|
---|
| 189 |
|
---|
| 190 | </sect2>
|
---|
| 191 |
|
---|
| 192 | <sect2 role="content">
|
---|
| 193 | <title>Contents</title>
|
---|
| 194 |
|
---|
| 195 | <segmentedlist>
|
---|
| 196 | <segtitle>Installed Programs</segtitle>
|
---|
| 197 | <segtitle>Installed Library</segtitle>
|
---|
| 198 | <segtitle>Installed Directories</segtitle>
|
---|
| 199 |
|
---|
| 200 | <seglistitem>
|
---|
| 201 | <seg>
|
---|
[f3429309] | 202 | callgrind_annotate,
|
---|
| 203 | callgrind_control,
|
---|
| 204 | cg_annotate,
|
---|
| 205 | cg_diff,
|
---|
| 206 | cg_merge,
|
---|
| 207 | ms_print,
|
---|
| 208 | valgrind,
|
---|
[f1607a4] | 209 | valgrind-di-server,
|
---|
[f3429309] | 210 | valgrind-listener, and
|
---|
[f1607a4] | 211 | vgdb
|
---|
| 212 | </seg>
|
---|
| 213 | <seg>
|
---|
[528bf1b] | 214 | libcoregrind-<Arch>-linux.a,
|
---|
| 215 | libreplacemalloc_toolpreload-<Arch>-linux.a,
|
---|
| 216 | libvex-<Arch>-linux.a,
|
---|
[29dbd37] | 217 | libvexmultiarch-amd64-linux.a,
|
---|
[528bf1b] | 218 | vgpreload_core-<Arch>-linux.so,
|
---|
| 219 | vgpreload_drd-<Arch>-linux.so,
|
---|
| 220 | vgpreload_exp-dhat-<Arch>-linux.so,
|
---|
| 221 | vgpreload_exp-sgcheck-<Arch>-linux.so,
|
---|
| 222 | vgpreload_helgrind-<Arch>-linux.so,
|
---|
| 223 | vgpreload_massif-<Arch>-linux.so, and
|
---|
| 224 | vgpreload_memcheck-<Arch>-linux.so, where
|
---|
[29dbd37] | 225 | <Arch> is x86 or amd64
|
---|
[f1607a4] | 226 | </seg>
|
---|
| 227 | <seg>
|
---|
| 228 | /usr/lib/valgrind,
|
---|
[f3429309] | 229 | /usr/include/valgrind, and
|
---|
[f1607a4] | 230 | /usr/share/doc/valgrind-&valgrind-version;
|
---|
| 231 | </seg>
|
---|
| 232 | </seglistitem>
|
---|
| 233 | </segmentedlist>
|
---|
| 234 |
|
---|
| 235 | <variablelist>
|
---|
| 236 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 237 | <?dbfo list-presentation="list"?>
|
---|
| 238 | <?dbhtml list-presentation="table"?>
|
---|
| 239 |
|
---|
| 240 | <varlistentry id="valgrind-prog">
|
---|
| 241 | <term><command>valgrind</command></term>
|
---|
| 242 | <listitem>
|
---|
| 243 | <para>
|
---|
| 244 | is a program for debugging and profiling Linux executables.
|
---|
| 245 | </para>
|
---|
| 246 | <indexterm zone="valgrind valgrind-prog">
|
---|
| 247 | <primary sortas="b-valgrind">valgrind</primary>
|
---|
| 248 | </indexterm>
|
---|
| 249 | </listitem>
|
---|
| 250 | </varlistentry>
|
---|
| 251 |
|
---|
| 252 | <varlistentry id="callgrind_annotate">
|
---|
| 253 | <term><command>callgrind_annotate</command></term>
|
---|
| 254 | <listitem>
|
---|
| 255 | <para>
|
---|
| 256 | takes an output file produced by the
|
---|
| 257 | <application>Valgrind</application> tool Callgrind and prints the
|
---|
| 258 | information in an easy-to-read form.
|
---|
| 259 | </para>
|
---|
| 260 | <indexterm zone="callgrind_annotate">
|
---|
| 261 | <primary sortas="b-callgrind_annotate">callgrind_annotate</primary>
|
---|
| 262 | </indexterm>
|
---|
| 263 | </listitem>
|
---|
| 264 | </varlistentry>
|
---|
| 265 |
|
---|
| 266 | <varlistentry id="callgrind_control">
|
---|
| 267 | <term><command>callgrind_control</command></term>
|
---|
| 268 | <listitem>
|
---|
| 269 | <para>
|
---|
[f3429309] | 270 | controls programs being run by the <application>Valgrind</application>
|
---|
[f1607a4] | 271 | tool Callgrind.
|
---|
| 272 | </para>
|
---|
| 273 | <indexterm zone="valgrind callgrind_control">
|
---|
| 274 | <primary sortas="b-callgrind_control">callgrind_control</primary>
|
---|
| 275 | </indexterm>
|
---|
| 276 | </listitem>
|
---|
| 277 | </varlistentry>
|
---|
| 278 |
|
---|
| 279 | <varlistentry id="cg_annotate">
|
---|
| 280 | <term><command>cg_annotate</command></term>
|
---|
| 281 | <listitem>
|
---|
| 282 | <para>
|
---|
[f3429309] | 283 | is a post-processing tool for the <application>Valgrind</application>
|
---|
[f1607a4] | 284 | tool Cachegrind.
|
---|
| 285 | </para>
|
---|
| 286 | <indexterm zone="valgrind cg_annotate">
|
---|
| 287 | <primary sortas="b-cg_annotate">cg_annotate</primary>
|
---|
| 288 | </indexterm>
|
---|
| 289 | </listitem>
|
---|
| 290 | </varlistentry>
|
---|
| 291 |
|
---|
| 292 | <varlistentry id="cg_diff">
|
---|
| 293 | <term><command>cg_diff</command></term>
|
---|
| 294 | <listitem>
|
---|
| 295 | <para>
|
---|
| 296 | compares two Cachegrind output files.
|
---|
| 297 | </para>
|
---|
| 298 | <indexterm zone="valgrind cg_diff">
|
---|
| 299 | <primary sortas="b-cg_diff">cg_diff</primary>
|
---|
| 300 | </indexterm>
|
---|
| 301 | </listitem>
|
---|
| 302 | </varlistentry>
|
---|
| 303 |
|
---|
| 304 | <varlistentry id="cg_merge">
|
---|
| 305 | <term><command>cg_merge</command></term>
|
---|
| 306 | <listitem>
|
---|
| 307 | <para>
|
---|
| 308 | merges multiple Cachegrind output files into one.
|
---|
| 309 | </para>
|
---|
| 310 | <indexterm zone="valgrind cg_merge">
|
---|
| 311 | <primary sortas="b-cg_merge">cg_merge</primary>
|
---|
| 312 | </indexterm>
|
---|
| 313 | </listitem>
|
---|
| 314 | </varlistentry>
|
---|
| 315 |
|
---|
| 316 | <varlistentry id="ms_print">
|
---|
| 317 | <term><command>ms_print</command></term>
|
---|
| 318 | <listitem>
|
---|
| 319 | <para>
|
---|
| 320 | takes an output file produced by the <application>Valgrind</application>
|
---|
| 321 | tool Massif and prints the information in an easy-to-read form.
|
---|
| 322 | </para>
|
---|
| 323 | <indexterm zone="valgrind ms_print">
|
---|
| 324 | <primary sortas="b-ms_print">ms_print</primary>
|
---|
| 325 | </indexterm>
|
---|
| 326 | </listitem>
|
---|
| 327 | </varlistentry>
|
---|
| 328 |
|
---|
| 329 | <varlistentry id="valgrind-di-server">
|
---|
| 330 | <term><command>valgrind-di-server</command></term>
|
---|
| 331 | <listitem>
|
---|
| 332 | <para>
|
---|
[f3429309] | 333 | is a server that reads debuginfo from objects stored on a
|
---|
[f1607a4] | 334 | different machine.
|
---|
| 335 | </para>
|
---|
| 336 | <indexterm zone="valgrind valgrind-di-server">
|
---|
| 337 | <primary sortas="b-valgrind-di-server">valgrind-di-server</primary>
|
---|
| 338 | </indexterm>
|
---|
| 339 | </listitem>
|
---|
| 340 | </varlistentry>
|
---|
| 341 |
|
---|
| 342 | <varlistentry id="valgrind-listener">
|
---|
| 343 | <term><command>valgrind-listener</command></term>
|
---|
| 344 | <listitem>
|
---|
| 345 | <para>
|
---|
| 346 | listens on a socket for Valgrind commentary.
|
---|
| 347 | </para>
|
---|
| 348 | <indexterm zone="valgrind valgrind-listener">
|
---|
| 349 | <primary sortas="b-valgrind-listener">valgrind-listener</primary>
|
---|
| 350 | </indexterm>
|
---|
| 351 | </listitem>
|
---|
| 352 | </varlistentry>
|
---|
| 353 |
|
---|
| 354 | <varlistentry id="vgdb">
|
---|
| 355 | <term><command>vgdb</command></term>
|
---|
| 356 | <listitem>
|
---|
| 357 | <para>
|
---|
| 358 | is an intermediary between Valgrind and GDB or a shell.
|
---|
| 359 | </para>
|
---|
| 360 | <indexterm zone="valgrind vgdb">
|
---|
| 361 | <primary sortas="b-vgdb">vgdb</primary>
|
---|
| 362 | </indexterm>
|
---|
| 363 | </listitem>
|
---|
| 364 | </varlistentry>
|
---|
| 365 |
|
---|
| 366 | </variablelist>
|
---|
| 367 |
|
---|
| 368 | </sect2>
|
---|
| 369 |
|
---|
| 370 | </sect1>
|
---|