Home | History | Annotate | Download | only in html
      1 <html>
      2 <head>
      3 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      4 <title>5.README_DEVELOPERS</title>
      5 <link rel="stylesheet" href="vg_basic.css" type="text/css">
      6 <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
      7 <link rel="home" href="index.html" title="Valgrind Documentation">
      8 <link rel="up" href="dist.html" title="Valgrind Distribution Documents">
      9 <link rel="prev" href="dist.readme-missing.html" title="4.README_MISSING_SYSCALL_OR_IOCTL">
     10 <link rel="next" href="dist.readme-packagers.html" title="6.README_PACKAGERS">
     11 </head>
     12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
     13 <div><table class="nav" width="100%" cellspacing="3" cellpadding="3" border="0" summary="Navigation header"><tr>
     14 <td width="22px" align="center" valign="middle"><a accesskey="p" href="dist.readme-missing.html"><img src="images/prev.png" width="18" height="21" border="0" alt="Prev"></a></td>
     15 <td width="25px" align="center" valign="middle"><a accesskey="u" href="dist.html"><img src="images/up.png" width="21" height="18" border="0" alt="Up"></a></td>
     16 <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>
     17 <th align="center" valign="middle">Valgrind Distribution Documents</th>
     18 <td width="22px" align="center" valign="middle"><a accesskey="n" href="dist.readme-packagers.html"><img src="images/next.png" width="18" height="21" border="0" alt="Next"></a></td>
     19 </tr></table></div>
     20 <div class="chapter" title="5.README_DEVELOPERS">
     21 <div class="titlepage"><div><div><h2 class="title">
     22 <a name="dist.readme-developers"></a>5.README_DEVELOPERS</h2></div></div></div>
     23 <div class="literallayout"><p><br>
     24 <br>
     25 Buildingandnotinstallingit<br>
     26 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
     27 TorunValgrindwithouthavingtoinstallit,runcoregrind/valgrind<br>
     28 withtheVALGRIND_LIBenvironmentvariableset,where&lt;dir&gt;istheroot<br>
     29 ofthesourcetree(andmustbeanabsolutepath).Eg:<br>
     30 <br>
     31 VALGRIND_LIB=~/grind/head4/.in_place~/grind/head4/coregrind/valgrind<br>
     32 <br>
     33 Thisallowsyoutocompileandrunwith"make"insteadof"makeinstall",<br>
     34 savingyoutime.<br>
     35 <br>
     36 Or,youcanusethe'vg-in-place'scriptwhichdoesthatforyou.<br>
     37 <br>
     38 Irecommendcompilingwith"make--quiet"tofurtherreducetheamountof<br>
     39 outputspewedoutduringcompilation,lettingyouactuallyseeanyerrors,<br>
     40 warnings,etc.<br>
     41 <br>
     42 <br>
     43 Runningtheregressiontests<br>
     44 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
     45 Tobuildandrunalltheregressiontests,run"make[--quiet]regtest".<br>
     46 <br>
     47 Torunasubsetoftheregressiontests,execute:<br>
     48 <br>
     49 perltests/vg_regtest&lt;name&gt;<br>
     50 <br>
     51 where&lt;name&gt;isadirectory(alltestswithinwillberun)orasingle<br>
     52 .vgtesttestfile,orthenameofaprogramwhichhasalike-named.vgtest<br>
     53 file.Eg:<br>
     54 <br>
     55 perltests/vg_regtestmemcheck<br>
     56 perltests/vg_regtestmemcheck/tests/badfree.vgtest<br>
     57 perltests/vg_regtestmemcheck/tests/badfree<br>
     58 <br>
     59 <br>
     60 Runningtheperformancetests<br>
     61 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
     62 Tobuildandrunalltheperformancetests,run"make[--quiet]perf".<br>
     63 <br>
     64 Torunasubsetoftheperformancesuite,execute:<br>
     65 <br>
     66 perlperf/vg_perf&lt;name&gt;<br>
     67 <br>
     68 where&lt;name&gt;isadirectory(alltestswithinwillberun)orasingle<br>
     69 .vgperftestfile,orthenameofaprogramwhichhasalike-named.vgperf<br>
     70 file.Eg:<br>
     71 <br>
     72 perlperf/vg_perfperf/<br>
     73 perlperf/vg_perfperf/bz2.vgperf<br>
     74 perlperf/vg_perfperf/bz2<br>
     75 <br>
     76 TocomparemultipleversionsofValgrind,usethe--vg=optionmultiple<br>
     77 times.Forexample,ifyouhavetwoValgrindsnexttoeachother,onein<br>
     78 trunk1/andoneintrunk2/,fromwithineithertrunk1/ortrunk2/dothisto<br>
     79 comparethemonalltheperformancetests:<br>
     80 <br>
     81 perlperf/vg_perf--vg=../trunk1--vg=../trunk2perf/<br>
     82 <br>
     83 <br>
     84 DebuggingValgrindwithGDB<br>
     85 ~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
     86 Todebugthevalgrindlauncherprogram(&lt;prefix&gt;/bin/valgrind)just<br>
     87 runitundergdbinthenormalway.<br>
     88 <br>
     89 Debuggingthemainbodyofthevalgrindcode(and/orthecodefor<br>
     90 aparticulartool)requiresabitmoretrickerybutcanbeachieved<br>
     91 withouttoomuchproblembyfollowingthesesteps:<br>
     92 <br>
     93 (1)SetVALGRIND_LAUNCHERtopointtothevalgrindexecutable.Eg:<br>
     94 <br>
     95 exportVALGRIND_LAUNCHER=/usr/local/bin/valgrind<br>
     96 <br>
     97 orforanuninstalledversioninasourcedirectory$DIR:<br>
     98 <br>
     99 exportVALGRIND_LAUNCHER=$DIR/coregrind/valgrind<br>
    100 <br>
    101 (2)Rungdbonthetoolexecutable.Eg:<br>
    102 <br>
    103 gdb/usr/local/lib/valgrind/ppc32-linux/lackey<br>
    104 <br>
    105 or<br>
    106 <br>
    107 gdb$DIR/.in_place/x86-linux/memcheck<br>
    108 <br>
    109 (3)Do"handleSIGSEGVSIGILLnostopnoprint"inGDBtopreventGDBfrom<br>
    110 stoppingonaSIGSEGVorSIGILL:<br>
    111 <br>
    112 (gdb)handleSIGILLSIGSEGVnostopnoprint<br>
    113 <br>
    114 (4)Setanybreakpointsyouwantandproceedasnormalforgdb.The<br>
    115 macroVG_(FUNC)isexpandedtovgPlain_FUNC,soIfyouwanttoset<br>
    116 abreakpointVG_(do_exec),youcoulddolikethisinGDB:<br>
    117 <br>
    118 (gdb)bvgPlain_do_exec<br>
    119 <br>
    120 (5)Runthetoolwithrequiredoptions:<br>
    121 <br>
    122 (gdb)runpwd<br>
    123 <br>
    124 Steps(1)--(3)canbeputina.gdbinitfile,butanydirectorynamesmust<br>
    125 befullyexpanded(ie.notanenvironmentvariable).<br>
    126 <br>
    127 Adifferentandpossiblyeasierwayisasfollows:<br>
    128 <br>
    129 (1)RunValgrindasnormal,butaddtheflag--wait-for-gdb=yes.This<br>
    130 putsthetoolexecutableintoawaitloopsoonafteritgains<br>
    131 control.Thisdelaysstartupforafewseconds.<br>
    132 <br>
    133 (2)Inadifferentshell,do"gdb/proc/&lt;pid&gt;/exe&lt;pid&gt;",where<br>
    134 &lt;pid&gt;youreadfromtheoutputprintedby(1).Thisattaches<br>
    135 GDBtothetoolexecutable,whichshouldbeintheabovementioned<br>
    136 waitloop.<br>
    137 <br>
    138 (3)Do"cont"tocontinue.Aftertheloopfinishesspinning,startup<br>
    139 willcontinueasnormal.Notethatcomment(3)aboverepassing<br>
    140 signalsappliesheretoo.<br>
    141 <br>
    142 <br>
    143 Self-hosting<br>
    144 ~~~~~~~~~~~~<br>
    145 TorunValgrindunderValgrind:<br>
    146 <br>
    147 (1)Checkout2trees,"Inner"and"Outer".Innerrunstheapp<br>
    148 directly.OuterrunsInner.<br>
    149 <br>
    150 (2)Configureinnerwith--enable-innerandbuild/installas<br>
    151 usual.<br>
    152 <br>
    153 (3)ConfigureOuternormallyandbuild/installasusual.<br>
    154 <br>
    155 (4)Chooseaverysimpleprogram(date)andtry<br>
    156 <br>
    157 outer/.../bin/valgrind--sim-hints=enable-outer--trace-children=yes\<br>
    158 --tool=cachegrind-vinner/.../bin/valgrind--tool=none-vprog<br>
    159 <br>
    160 Ifyouomitthe--trace-children=yes,you'llonlymonitorInner'slauncher<br>
    161 program,notitsstage2.<br>
    162 <br>
    163 Thewholethingisfragile,confusingandslow,butitdoesworkwellenough<br>
    164 foryoutogetsomeusefulperformancedata.Innerhasmostof<br>
    165 itsoutput(ie.thoselinesbeginningwith"==&lt;pid&gt;==")prefixedwitha'&gt;',<br>
    166 whichhelpsalot.<br>
    167 <br>
    168 Atthetimeofwritingtheallocatorisnotannotatedwithclientrequests<br>
    169 soMemcheckisnotasusefulasitcouldbe.Italsohasnotbeentested<br>
    170 much,sodon'tbesurprisedifyouhitproblems.<br>
    171 <br>
    172 Whenusingself-hostingwithanouterCallgrindtool,use'--pop-on-jump'<br>
    173 (ontheouter).Otherwise,Callgrindhasmuchhighermemoryrequirements.<br>
    174 <br>
    175 <br>
    176 Printingoutproblematicblocks<br>
    177 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
    178 Ifyouwanttoprintoutadisassemblyofaparticularblockthat<br>
    179 causesacrash,dothefollowing.<br>
    180 <br>
    181 Tryrunningwith"--vex-guest-chase-thresh=0--trace-flags=10000000<br>
    182 --trace-notbelow=999999".Thisshouldprintonelineforeachblock<br>
    183 translated,andthatincludestheaddress.<br>
    184 <br>
    185 Thenre-runwith999999changedtothehighestbbnumbershown.<br>
    186 Thiswillprinttheonelineperblock,andalsowillprinta<br>
    187 disassemblyoftheblockinwhichthefaultoccurred.<br>
    188 <br>
    189 </p></div>
    190 </div>
    191 <div>
    192 <br><table class="nav" width="100%" cellspacing="3" cellpadding="2" border="0" summary="Navigation footer">
    193 <tr>
    194 <td rowspan="2" width="40%" align="left">
    195 <a accesskey="p" href="dist.readme-missing.html">&lt;&lt;4.README_MISSING_SYSCALL_OR_IOCTL</a></td>
    196 <td width="20%" align="center"><a accesskey="u" href="dist.html">Up</a></td>
    197 <td rowspan="2" width="40%" align="right"><a accesskey="n" href="dist.readme-packagers.html">6.README_PACKAGERS&gt;&gt;</a>
    198 </td>
    199 </tr>
    200 <tr><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td></tr>
    201 </table>
    202 </div>
    203 </body>
    204 </html>
    205