%!PS %%Version: 3.3.2 %%DocumentFonts: (atend) %%Pages: (atend) %%EndComments % % Version 3.3.2 prologue for troff files. % /#copies 1 store /aspectratio 1 def /formsperpage 1 def /landscape false def /linewidth .3 def /magnification 1 def /margin 0 def /orientation 0 def /resolution 720 def /rotation 1 def /xoffset 0 def /yoffset 0 def /roundpage true def /useclippath true def /pagebbox [0 0 612 792] def /R /Times-Roman def /I /Times-Italic def /B /Times-Bold def /BI /Times-BoldItalic def /H /Helvetica def /HI /Helvetica-Oblique def /HB /Helvetica-Bold def /HX /Helvetica-BoldOblique def /CW /Courier def /CO /Courier def /CI /Courier-Oblique def /CB /Courier-Bold def /CX /Courier-BoldOblique def /PA /Palatino-Roman def /PI /Palatino-Italic def /PB /Palatino-Bold def /PX /Palatino-BoldItalic def /Hr /Helvetica-Narrow def /Hi /Helvetica-Narrow-Oblique def /Hb /Helvetica-Narrow-Bold def /Hx /Helvetica-Narrow-BoldOblique def /KR /Bookman-Light def /KI /Bookman-LightItalic def /KB /Bookman-Demi def /KX /Bookman-DemiItalic def /AR /AvantGarde-Book def /AI /AvantGarde-BookOblique def /AB /AvantGarde-Demi def /AX /AvantGarde-DemiOblique def /NR /NewCenturySchlbk-Roman def /NI /NewCenturySchlbk-Italic def /NB /NewCenturySchlbk-Bold def /NX /NewCenturySchlbk-BoldItalic def /ZD /ZapfDingbats def /ZI /ZapfChancery-MediumItalic def /S /S def /S1 /S1 def /GR /Symbol def /inch {72 mul} bind def /min {2 copy gt {exch} if pop} bind def /show {{//show} 0 get exec} bind def % so later references don't bind /widthshow {{//widthshow} 0 get exec} bind def /stringwidth {{//stringwidth} 0 get exec} bind def /setup { counttomark 2 idiv {def} repeat pop landscape {/orientation 90 orientation add def} if /scaling 72 resolution div def linewidth setlinewidth 1 setlinecap pagedimensions xcenter ycenter translate orientation rotation mul rotate width 2 div neg height 2 div translate xoffset inch yoffset inch neg translate margin 2 div dup neg translate magnification dup aspectratio mul scale scaling scaling scale addmetrics 0 0 moveto } def /pagedimensions { useclippath userdict /gotpagebbox known not and { /pagebbox [clippath pathbbox newpath] def roundpage currentdict /roundpagebbox known and {roundpagebbox} if } if pagebbox aload pop 4 -1 roll exch 4 1 roll 4 copy landscape {4 2 roll} if sub /width exch def sub /height exch def add 2 div /xcenter exch def add 2 div /ycenter exch def userdict /gotpagebbox true put } def /addmetrics { /Symbol /S null Sdefs cf /Times-Roman /S1 StandardEncoding dup length array copy S1defs cf } def /pagesetup { /page exch def currentdict /pagedict known currentdict page known and { page load pagedict exch get cvx exec } if } def /decodingdefs [ {counttomark 2 idiv {y moveto show} repeat} {neg /y exch def counttomark 2 idiv {y moveto show} repeat} {neg moveto {2 index stringwidth pop sub exch div 0 32 4 -1 roll widthshow} repeat} {neg moveto {spacewidth sub 0.0 32 4 -1 roll widthshow} repeat} {counttomark 2 idiv {y moveto show} repeat} {neg setfunnytext} ] def /setdecoding {/t decodingdefs 3 -1 roll get bind def} bind def /w {neg moveto show} bind def /m {neg dup /y exch def moveto} bind def /done {/lastpage where {pop lastpage} if} def /f { dup /font exch def findfont exch dup /ptsize exch def scaling div dup /size exch def scalefont setfont linewidth ptsize mul scaling 10 mul div setlinewidth /spacewidth ( ) stringwidth pop def } bind def /changefont { /fontheight exch def /fontslant exch def currentfont [ 1 0 fontheight ptsize div fontslant sin mul fontslant cos div fontheight ptsize div 0 0 ] makefont setfont } bind def /sf {f} bind def /cf { dup length 2 idiv /entries exch def /chtab exch def /newencoding exch def /newfont exch def findfont dup length 1 add dict /newdict exch def {1 index /FID ne {newdict 3 1 roll put}{pop pop} ifelse} forall newencoding type /arraytype eq {newdict /Encoding newencoding put} if newdict /Metrics entries dict put newdict /Metrics get begin chtab aload pop 1 1 entries {pop def} for newfont newdict definefont pop end } bind def % % A few arrays used to adjust reference points and character widths in some % of the printer resident fonts. If square roots are too high try changing % the lines describing /radical and /radicalex to, % % /radical [0 -75 550 0] % /radicalex [-50 -75 500 0] % % Move braceleftbt a bit - default PostScript character is off a bit. % /Sdefs [ /bracketlefttp [201 500] /bracketleftbt [201 500] /bracketrighttp [-81 380] /bracketrightbt [-83 380] /braceleftbt [203 490] /bracketrightex [220 -125 500 0] /radical [0 0 550 0] /radicalex [-50 0 500 0] /parenleftex [-20 -170 0 0] /integral [100 -50 500 0] /infinity [10 -75 730 0] ] def /S1defs [ /underscore [0 80 500 0] /endash [7 90 650 0] ] def % % Tries to round clipping path dimensions, as stored in array pagebbox, so they % match one of the known sizes in the papersizes array. Lower left coordinates % are always set to 0. % /roundpagebbox { 7 dict begin /papersizes [8.5 inch 11 inch 14 inch 17 inch] def /mappapersize { /val exch def /slop .5 inch def /diff slop def /j 0 def 0 1 papersizes length 1 sub { /i exch def papersizes i get val sub abs dup diff le {/diff exch def /j i def} {pop} ifelse } for diff slop lt {papersizes j get} {val} ifelse } def pagebbox 0 0 put pagebbox 1 0 put pagebbox dup 2 get mappapersize 2 exch put pagebbox dup 3 get mappapersize 3 exch put end } bind def %%EndProlog %%BeginSetup mark /linewidth 0.5 def /#copies 1 store /landscape false def /resolution 720 def % % Encoding vector and redefinition of findfont for the ISO Latin1 standard. % The 18 characters missing from ROM based fonts on older printers are noted % below. % /ISOLatin1Encoding [ /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright /parenleft /parenright /asterisk /plus /comma /minus /period /slash /zero /one /two /three /four /five /six /seven /eight /nine /colon /semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright /asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron /space /exclamdown /cent /sterling /currency /yen /brokenbar % missing /section /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron /degree % missing /plusminus % missing /twosuperior % missing /threesuperior % missing /acute /mu % missing /paragraph /periodcentered /cedilla /onesuperior % missing /ordmasculine /guillemotright /onequarter % missing /onehalf % missing /threequarters % missing /questiondown /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth % missing /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply % missing /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute % missing /Thorn % missing /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth % missing /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide % missing /oslash /ugrave /uacute /ucircumflex /udieresis /yacute % missing /thorn % missing /ydieresis ] def /NewFontDirectory FontDirectory maxlength dict def % % Apparently no guarantee findfont is defined in systemdict so the obvious % % systemdict /findfont get exec % % can generate an error. So far the only exception is a VT600 (version 48.0). % userdict /@RealFindfont known not { userdict begin /@RealFindfont systemdict begin /findfont load end def end } if /findfont { dup NewFontDirectory exch known not { dup %dup systemdict /findfont get exec % not always in systemdict dup userdict /@RealFindfont get exec dup /Encoding get StandardEncoding eq { dup length dict begin {1 index /FID ne {def}{pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /DummyFontName exch definefont } if NewFontDirectory 3 1 roll put } if NewFontDirectory exch get } bind def setup 2 setdecoding %%EndSetup %%Page: 1 1 /saveobj save def mark 1 pagesetup 14 B f (ACID: A Debugger Built From A Language)6 2620 1 1750 1230 t 12 I f (Phil Winterbottom)1 893 1 2613 1470 t 12 R f (AT&T Bell Laboratories)2 1194 1 2463 1650 t (Murray Hill, New Jersey 07974)4 1523 1 2298 1770 t 12 I f (ABSTRACT)2777 2150 w 10 R f ( as a lan\255)3 366(ACID is an unusual source\255level symbolic debugger for Plan 9. It is implemented)12 3284 2 1360 2410 t ( written in)2 415( Programs)1 435( primitives that provide debugger support.)5 1692(guage interpreter with specialized)3 1358 4 1110 2530 t ( the language represent the)4 1125(the language manipulate one or more target processes; variables in)9 2775 2 1110 2650 t ( of those processes. This structure allows complex interaction)8 2660(symbols, state, and resources)3 1240 2 1110 2770 t ( and the target program and provides a convenient method of parameteriz\255)11 3017(between the debugger)2 883 2 1110 2890 t ( some effort is required to learn the)7 1517( Although)1 444( between machine architectures.)3 1327(ing differences)1 612 4 1110 3010 t ( flexibility of the debugging environment encourages new)7 2372(debugging language, the richness and)4 1528 2 1110 3130 t (ways of reasoning about the way programs run and the conditions under which they fail.)14 3530 1 1110 3250 t 10 B f (1. Introduction)1 670 1 720 3610 t 10 R f ( programs have increased in proportion to processor speed and memory but the)12 3299(The size and complexity of)4 1131 2 970 3766 t ( some of the)3 518( user interfaces have eased)4 1102( Graphical)1 453(interface between debugger and programmer has changed little.)7 2607 4 720 3886 t ( means for navigating through source and data)7 1856(tedious aspects of the interaction. A graphical interface is a convenient)10 2824 2 720 4006 t ( language, ALEF)2 715( introduction of a new concurrent)5 1413( The)1 221(structures but provides little benefit for process control.)7 2331 4 720 4126 t ( existing Plan 9 [Pike90] debugger)5 1440([Win93], emphasized the inadequacies of the)5 1851 2 720 4246 t 10 I f (db)4047 4246 w 10 R f (, a distant relative of)4 862 1 4147 4246 t 10 I f (adb)5045 4246 w 10 R f (, and)1 205 1 5195 4246 t (made it clear that a new debugger was required.)8 1908 1 720 4366 t (Current debuggers like)2 929 1 970 4522 t 10 I f (dbx)1931 4522 w 10 R f (,)2075 4522 w 10 I f (sdb)2132 4522 w 10 R f (, and)1 201 1 2271 4522 t 10 I f (gdb)2504 4522 w 10 R f ( questions their authors envisage.)4 1361(are limited to answering only the)5 1353 2 2686 4522 t ( result, they supply a plethora of specialized commands, each attempting to anticipate a specific question a user)17 4496(As a)1 184 2 720 4642 t ( Fur\255)1 228( tool is useless.)3 624( a debugging situation arises that is beyond the scope of the command set, the)14 3175( When)1 293(may ask.)1 360 5 720 4762 t ( state is)2 314(ther, it is often tedious or impossible to reproduce an anomalous state of the program, especially when the)17 4366 2 720 4882 t (embedded in the program's data structures.)5 1724 1 720 5002 t ( is based on the)4 656( It)1 121( test and simulation.)3 836(ACID applies some ideas found in CAD software used for hardware)10 2817 4 970 5158 t ( of a program are best represented and manipulated by a language. The state and)14 3289(notion that the state and resources)5 1391 2 720 5278 t ( as memory, registers, variables, type information and source code are represented by variables in the)15 4070(resources, such)1 610 2 720 5398 t ( or selective inter\255)3 735( provide a computation mechanism and control statements allow repetitive)9 3022(language. Expressions)1 923 3 720 5518 t ( heart of the ACID debugger is an interpreter for a small)11 2291( The)1 209(pretation based on the result of expression evaluation.)7 2180 3 720 5638 t ( mirror the operations of C and ALEF, which in turn correspond well to the basic)15 3285(typeless language whose operators)3 1395 2 720 5758 t ( pro\255)1 202(operations of the machine. The interpreter itself knows nothing of the underlying hardware; it deals with the)16 4478 2 720 5878 t ( and interface to the)4 816( routines to control processes, read files,)6 1650( Fundamental)1 579(gram state and resources in the abstract.)6 1635 4 720 5998 t ( is coded)2 365( actual debugger functionality)3 1207( The)1 209(system are implemented as builtin functions available to the interpreter.)9 2899 4 720 6118 t (in ACID; commands are implemented as ACID functions.)7 2325 1 720 6238 t ( importantly, programs written in ACID, includ\255)6 1968( Most)1 262( approach has several advantages.)4 1372(This language\255based)1 828 4 970 6394 t ( ACID avoids the limitations other debuggers)6 1863( Furthermore)1 556( debugger itself, are inherently portable.)5 1634(ing most of the)3 627 4 720 6514 t ( in the debugger, ACID)4 996( of embedding a fixed process model)6 1553( Instead)1 351(impose when debugging parallel programs.)4 1780 4 720 6634 t ( an arbitrary process partitioning or program structure. The)8 2409(allows the programmer to adapt the debugger to handle)8 2271 2 720 6754 t ( dynamically interact with an executing process provides clear advantages over debuggers constrained to)13 4312(ability to)1 368 2 720 6874 t ( the ACID language is a powerful vehicle for expressing assertions about logic, process)13 3493( Finally,)1 359( image.)1 294(probe a static)2 534 4 720 6994 t ( with dynamic interaction it allows a limited form of auto\255)10 2346( combined)1 420( When)1 289(state, and the contents of data structures.)6 1625 4 720 7114 t ( language is)2 503( The)1 218(mated program verification without requiring modification or recompilation of the source code.)11 3959 3 720 7234 t cleartomark showpage saveobj restore %%EndPage: 1 1 %%Page: 2 2 /saveobj save def mark 2 pagesetup 10 R f (also an excellent vehicle for preserving a test suite for later regression testing.)12 3107 1 720 840 t ( be modified or extended to suit a par\255)8 1573(The debugger may be customized by its users; standard functions may)10 2857 2 970 996 t ( the kernel developers in our group require a command set supporting)11 2792( example,)1 390( For)1 191(ticular application or preference.)3 1307 4 720 1116 t ( the)1 175( Although)1 456( application programmers prefer source\255level functionality.)5 2501(assembler\255level debugging while the)3 1548 4 720 1236 t ( it is easily modified to provide a convenient source\255level)9 2303(default library is biased toward assembler\255level debugging,)6 2377 2 720 1356 t ( differ\255)1 283( debugger itself does not change; the user combines primitives and existing ACID functions in)14 3816(interface. The)1 581 3 720 1476 t (ent ways to implement the desired interface.)6 1766 1 720 1596 t 10 B f ( Work)1 275(2. Related)1 452 2 720 1836 t 10 R f (DUEL [Gol93], an extension to)4 1282 1 970 1992 t 10 I f (gdb)2282 1992 w 10 R f ( expression evaluator to solve some)5 1453([Stal91], proposes using a high level)5 1485 2 2462 1992 t ( problems. The evaluator provides iterators to loop over data structures and conditionals to control evaluation)15 4366(of these)1 314 2 720 2112 t ( author shows that complex state queries can be formulated by combining concise expressions)13 3862( The)1 212(of expressions.)1 606 3 720 2232 t ( program is in)3 564( program is a dynamic entity; questions asked when the)9 2244( A)1 125(but this only addresses part of the problem.)7 1747 4 720 2352 t ( state are meaningful only after the program has been `caught' in that state. The framework for manipulating)17 4397(a static)1 283 2 720 2472 t ( still as primitive as the underlying debugger. While DUEL provides a means to probe data structures)16 4095(the program is)2 585 2 720 2592 t ( control processes. ACID is)4 1165(it entirely neglects the most beneficial aspect of debugging languages: the ability to)12 3515 2 720 2712 t (structured around a thread of control that passes between the interpreter and the target program.)14 3815 1 720 2832 t ( TCL [Ous90] that provide debugging primitives. The)7 2238(The NeD debugger [May92] is a set of extensions to)9 2192 2 970 2988 t ( implement a portable interface between a conventional debugger, pdb)9 3044(resulting language, NeDtcl, is used to)5 1636 2 720 3108 t ( of the NeDtcl)3 589( Execution)1 462( NeDtcl programs that operate on the target program.)8 2176([May90], and a server that executes)5 1453 4 720 3228 t ( at multi\255process debugging across)4 1391( is targeted)2 442( NeD)1 240(programs implements the debugging primitives that pdb expects.)7 2607 4 720 3348 t ( tools. Whereas)2 624(a network, and proves the flexibility of a language as a means of communication between debugging)15 4056 2 720 3468 t ( process it debugs, ACID is the debugger itself.)8 1916(NeD provides an interface between a conventional debugger and the)9 2764 2 720 3588 t ( seeks to integrate)3 736(While NeD has some of the ideas found in ACID it is targeted toward a different purpose. ACID)17 3944 2 720 3708 t ( programs resources into the debugger while NeD provides a flexible interconnect between)12 3786(the manipulation of a)3 894 2 720 3828 t ( the debugging environment. The choice of TCL is appropriate for its use in NeD but is not suitable)18 4084(components of)1 596 2 720 3948 t ( are the root of its)5 772(for ACID. ACID relies on the coupling of the type system with expression evaluation, which)14 3908 2 720 4068 t (design, to provide the debugging primitives.)5 1769 1 720 4188 t ( target program cause events)4 1145(Dalek [Ols90] is an event based language extension to gdb. State transitions in the)13 3285 2 970 4344 t (to be queued for processing by the debugging language.)8 2232 1 720 4464 t ( advantages of same process or)5 1243(ACID has many of the)4 904 2 970 4620 t 10 I f (local agent)1 448 1 3143 4620 t 10 R f (debuggers, like Parasight [Aral], without the)5 1783 1 3617 4620 t ( other systems by completely)4 1210( improves on the ideas of these)6 1309( ACID)1 306(need for dynamic linking or shared memory.)6 1855 4 720 4740 t ( into the language environment. Of particular importance is the rela\255)10 2765(integrating all aspects of the debugging process)6 1915 2 720 4860 t ( source code, registers and type information. This integration is)9 2554(tionship between ACID variables, program symbols,)5 2126 2 720 4980 t (made possible by the design of the ACID language.)8 2061 1 720 5100 t ( Smalltalk are able to provide richer debugging environments through)9 2851(Interpreted languages such as Lisp and)5 1579 2 970 5256 t ( means to gather and represent similar infor\255)7 1785(more complete information than their compiled counterparts. ACID is a)9 2895 2 720 5376 t (mation about compiled programs through cooperation with the compilation tools and library implementers.)12 4283 1 720 5496 t 10 B f ( the Language)2 606(3. ACID)1 380 2 720 5736 t 10 R f ( state)1 213( focuses on representing program)4 1346( It)1 115(ACID is a small interpreted language targeted to its debugging task.)10 2756 4 970 5892 t ( is)1 95(and addressing data rather than expressing complex computations. Program state)9 3264 2 720 6012 t 10 I f (addressable)4107 6012 w 10 R f (from an ACID pro\255)3 782 1 4618 6012 t ( to the)2 270( addition to parsing and executing expressions and providing an architecture\255independent interface)11 4038(gram. In)1 372 3 720 6132 t (target process, the interpreter supplies a mark\255and\255scan garbage collector to manage storage.)11 3692 1 720 6252 t ( libraries contain functions, written)4 1417( These)1 292( begins with the loading of the ACID libraries.)8 1894(Every ACID session)2 827 4 970 6408 t ( by instruction)2 582(in ACID, that provide a standard debugging environment including breakpoint management, stepping)11 4098 2 720 6528 t ( ACID)1 275( library contains 600 lines of)5 1171( The)1 210(or statement, stack tracing, and access to variables, memory, and registers.)10 3024 4 720 6648 t (code and provides functionality similar to)5 1758 1 720 6768 t 10 I f (dbx)2521 6768 w 10 R f ( of the system library, ACID loads user\255)7 1722( the loading)2 508(. Following)1 505 3 2665 6768 t ( to augment or override the standard commands to customize)9 2510(specified libraries; this load sequence allows the user)7 2170 2 720 6888 t ( loaded, ACID issues an interactive prompt and begins evaluating)9 2633( all libraries are)3 629( When)1 290(the debugging environment.)2 1128 4 720 7008 t ( ACID `commands' are actually invocations of builtin primitives or previously)10 3187( The)1 209(expressions entered by the user.)4 1284 3 720 7128 t (defined ACID functions. ACID evaluates each expression as it is entered and prints the result.)14 3754 1 720 7248 t cleartomark showpage saveobj restore %%EndPage: 2 2 %%Page: 3 3 /saveobj save def mark 3 pagesetup 10 B f ( and Variables)2 623(4. Types)1 381 2 720 840 t 10 R f (Acid variables are of four basic types:)6 1542 1 970 996 t 10 I f (integer)2541 996 w 10 R f (,)2824 996 w 10 I f (string)2878 996 w 10 R f (,)3112 996 w 10 I f (float)3166 996 w 10 R f (, and)1 198 1 3350 996 t 10 I f (list)3578 996 w 10 R f ( type of a variable is inferred by the)8 1464(. The)1 235 2 3701 996 t ( of the operators can be applied to more than one)10 2061( Many)1 294( of an assignment expression.)4 1223(type of the right\255hand side)4 1102 4 720 1116 t ( example, the)2 557( For)1 199(type; for these operators the action of the operator is determined by the type of its operands.)16 3828 3 720 1236 t 10 CW f (+)5340 1236 w 10 R f (operator adds)1 543 1 720 1356 t 10 I f (integer)1291 1356 w 10 R f (and)1602 1356 w 10 I f (float)1774 1356 w 10 R f (operands, and concatenates)2 1094 1 1986 1356 t 10 I f (string)3108 1356 w 10 R f (and)3370 1356 w 10 I f (list)3542 1356 w 10 R f ( only complex type)3 775( are the)2 299(operands. Lists)1 633 3 3693 1356 t ( are no arrays, structures or pointers. Operators provide)8 2245(in ACID; there)2 607 2 720 1476 t 10 CW f (head)3602 1476 w 10 R f (,)3842 1476 w 10 CW f (tail)3897 1476 w 10 R f (,)4137 1476 w 10 CW f (append)4192 1476 w 10 R f (and)4582 1476 w 10 CW f (delete)4756 1476 w 10 R f (opera\255)5146 1476 w ( can also be indexed like arrays.)6 1277(tions. Lists)1 465 2 720 1596 t ( parameters and variables declared in a function)7 1999( Function)1 419( of scope: global and local.)5 1141(ACID has two levels)3 871 4 970 1752 t (body using the)2 601 1 720 1872 t 10 CW f (local)1352 1872 w 10 R f ( Global)1 327( function and exist for the lifetime of a function.)9 1970(keyword are created at entry to the)6 1420 3 1683 1872 t ( variables and functions in the program being)7 1909( All)1 192( not be declared.)3 701(variables are created by assignment and need)6 1878 4 720 1992 t ( variable)1 348( Conflicting)1 508( variables during ACID initialization.)4 1504(debugged are entered in the ACID symbol table as global)9 2320 4 720 2112 t ( ACID variables and tar\255)4 998( Syntactically,)1 600( unique.)1 325(names are resolved by prefixing enough `$' characters to make them)10 2757 4 720 2232 t ( the variables are managed differently in the ACID sym\255)9 2298( However,)1 446(get program symbols are referenced identically.)5 1936 3 720 2352 t ( ACID variable is stored in the symbol table;)8 1801( value of an)3 468( The)1 205(bol table and the user must be aware of this distinction.)10 2206 4 720 2472 t ( a variable or function in the target program contains the)10 2331( symbol table entry for)4 946( The)1 214(a reference returns the value.)4 1189 4 720 2592 t ( a program variable is accessed by indirect)7 1754( the value of)3 517( Thus,)1 282(address of that symbol in the image of the program.)9 2127 4 720 2712 t ( the ACID variable that has the same name; the value of an ACID variable is the address of the cor\255)20 3974(reference through)1 706 2 720 2832 t (responding program variable.)2 1178 1 720 2952 t 10 B f ( Flow)1 236(5. Control)1 458 2 720 3192 t 10 R f (The)970 3348 w 10 CW f (while)1153 3348 w 10 R f (and)1481 3348 w 10 CW f (loop)1653 3348 w 10 R f ( The)1 208( former is similar to the same statement in C.)9 1826( The)1 208(statements implement looping.)2 1237 4 1921 3348 t ( incrementing loop index is)4 1134(latter evaluates starting and ending expressions yielding integers and iterates while an)11 3546 2 720 3468 t (within the bounds of those expressions.)5 1577 1 720 3588 t 9 CW f (acid: i = 0; loop 1,5 do print\(i++\))7 1890 1 1008 3758 t (0x00000000)1008 3868 w (0x00000004)1008 3978 w (0x00000008)1008 4088 w (0x0000000c)1008 4198 w (0x00000010)1008 4308 w (acid:)1008 4418 w 10 R f (The traditional)1 591 1 720 4598 t 10 CW f (if)1336 4598 w 10 R f (\255\255)1456 4598 w 10 CW f (then)1547 4598 w 10 R f (\255\255)1787 4598 w 10 CW f (else)1878 4598 w 10 R f (statement implements conditional execution.)3 1788 1 2143 4598 t 10 B f (6. Addressing)1 609 1 720 4838 t 10 R f ( The)1 223(Two indirection operators allow ACID to access values in the program being debugged.)12 3729 2 970 4994 t 10 CW f (*)4965 4994 w 10 R f (operator)5068 4994 w ( of an executing process; the)5 1159(fetches a value from the memory image)6 1615 2 720 5114 t 10 CW f (@)3523 5114 w 10 R f (operator fetches a value from the text file of)8 1788 1 3612 5114 t ( either operator appears on the left side of an assignment, the value is written rather than read.)17 3744( When)1 288(the process.)1 471 3 720 5234 t ( Plan 9 compilers)3 739( The)1 219( the object referenced by a variable.)6 1509(The indirection operator must know the size of)7 1963 4 970 5390 t ( symbol table, so ACID cannot derive this information implicitly.)9 2655(neglect to include this information in the program)7 2025 2 720 5510 t ( format is a code letter specifying the printing style and the effect of some)14 2964( The)1 206(Instead ACID variables have formats.)4 1510 3 720 5630 t ( indirection operators look at the format code to determine the number of bytes)13 3166( The)1 207(of the operators on that variable.)5 1307 3 720 5750 t ( format letters used by)4 929( format codes are derived from the)6 1427( The)1 213(to read or write.)3 661 4 720 5870 t 10 I f (db)3984 5870 w 10 R f ( default, symbol table vari\255)4 1115(. By)1 201 2 4084 5870 t (ables and numeric constants are assigned the format code)8 2329 1 720 5990 t 10 CW f ('X')3079 5990 w 10 R f ( such a)2 285( Printing)1 377( 32\255bit hexadecimal.)2 826(which specifies)1 623 4 3289 5990 t ( form)1 223(variable yields output of the)4 1133 2 720 6110 t 10 CW f (0x00123456)2105 6110 w 10 R f ( indirect reference through the variable fetches 32 bits of data)10 2494(. An)1 201 2 2705 6110 t ( formats specify various data types, for example)7 1946( Other)1 281(at the address indicated by the variable.)6 1601 3 720 6230 t 10 CW f (i)4577 6230 w 10 R f (an instruction,)1 575 1 4665 6230 t 10 CW f (D)5268 6230 w 10 R f (a)5356 6230 w (signed 32 bit decimal,)3 895 1 720 6350 t 10 CW f (s)1644 6350 w 10 R f ( The)1 210( string.)1 283(a null\255terminated)1 689 3 1733 6350 t 10 CW f (fmt)2945 6350 w 10 R f (function allows the user to change the format code of a)10 2245 1 3155 6350 t ( function evaluates the expression supplied as)6 1855( This)1 233( effects.)1 320(variable to control the printing format and operator side)8 2272 4 720 6470 t ( If)1 122( and returns that value.)4 936(the first argument, attaches the format code supplied as the second argument to the result)14 3622 3 720 6590 t ( convenience, ACID provides)3 1207( For)1 196( new format code applies to that variable.)7 1701(the result is assigned to a variable, the)7 1576 4 720 6710 t (the)720 6830 w 10 CW f (\\)867 6830 w 10 R f (operator as a shorthand infix form of)6 1469 1 952 6830 t 10 CW f (fmt)2446 6830 w 10 R f ( example:)1 391(. For)1 214 2 2626 6830 t cleartomark showpage saveobj restore %%EndPage: 3 3 %%Page: 4 4 /saveobj save def mark 4 pagesetup 9 CW f (acid: x=10)1 540 1 1008 830 t ( print x in hex)4 810( //)1 1512(acid: x)1 378 3 1008 940 t (0x0000000a)1008 1050 w ( make x type decimal)4 1080( //)1 756(acid: x = fmt\(x, 'D'\))4 1134 3 1008 1160 t (acid: print\(x, fmt\(x, 'X'\), x\\X\) // print x in decimal & hex)11 3240 1 1008 1270 t (10 0x0000000a 0x0000000a)2 1296 1 1008 1380 t ( print x in decimal)4 1026( //)1 1512(acid: x)1 378 3 1008 1490 t (10)1008 1600 w ( print x in octal)4 918( //)1 1404(acid: x\\o)1 486 3 1008 1710 t (000000000012)1008 1820 w 10 R f (The)720 2000 w 10 CW f (++)900 2000 w 10 R f (and)1045 2000 w 10 CW f (\255\255)1214 2000 w 10 R f ( for\255)1 175( Some)1 279( or decrement a variable by an amount determined by its format code.)12 2792(operators increment)1 795 4 1359 2000 t ( the)1 149( example,)1 391( For)1 192(mats imply a non\255fixed size.)4 1147 4 720 2120 t 10 CW f (i)2626 2120 w 10 R f ( a 68020,)2 373( On)1 174(format code disassembles an instruction into a string.)7 2140 3 2713 2120 t (which has variable length instructions:)4 1543 1 720 2240 t 9 CW f ( p = addr\(main\), type INST)5 1404( //)1 1512(acid: p=main\\i)1 756 3 1008 2410 t ( disassemble 5 instructions)3 1458( //)1 432(acid: loop 1,5 do print\(p\\X, @p++\))5 1836 3 1008 2520 t ( 0xffffe948\(A7\),A7)1 1026(0x0000222e LEA)1 756 2 1008 2630 t (0x00002232 MOVL s+0x4\(A7\),A2)2 1512 1 1008 2740 t ( 0x2f\($0\))1 540(0x00002236 PEA)1 756 2 1008 2850 t (0x0000223a MOVL A2,\255\(A7\))2 1296 1 1008 2960 t ( utfrrune)1 540(0x0000223c BSR)1 756 2 1008 3070 t (acid:)1008 3180 w 10 R f (Here,)720 3360 w 10 CW f (main)969 3360 w 10 R f ( loop retrieves the five)4 926( The)1 212( same name in the program under test.)7 1574(is the address of the function of the)7 1448 4 1240 3360 t ( the assembly language representation of each.)6 1883(instructions beginning at that address and then prints the address and)10 2797 2 720 3480 t ( of the increment operator varies with the size of the instruction: the)12 2748(Notice that the stride)3 841 2 720 3600 t 10 CW f (MOVL)4337 3600 w 10 R f (at)4605 3600 w 10 CW f (0x0000223a)4705 3600 w 10 R f (is)5333 3600 w (a two byte instruction while all others are four bytes long.)10 2311 1 720 3720 t (Registers are treated as normal program variables referenced by their symbolic assembler language names.)13 4430 1 970 3876 t ( is saved by the kernel at a known virtual address in the process memory map.)15 3162(When a process stops, the register set)6 1518 2 720 3996 t ( the registers point to the saved values and the)9 1848(The ACID variables associated with)4 1447 2 720 4116 t 10 CW f (*)4041 4116 w 10 R f (indirection operator can then be)4 1273 1 4127 4116 t ( the registers are accessed via ACID variables they may be used in arbi\255)13 2880( Since)1 273(used to read and write the register set.)7 1527 3 720 4236 t (trary expressions.)1 704 1 720 4356 t 9 CW f ( addr of saved PC)4 918( //)1 2268(acid: PC)1 432 3 1008 4526 t (0xc0000f60)1008 4636 w (acid: *PC)1 486 1 1008 4746 t ( contents of PC)3 810(0x0000623c //)1 2700 2 1008 4856 t (acid: *PC\\a)1 594 1 1008 4966 t (main)1008 5076 w ( modify R1)2 540( //)1 2052(acid: *R1=10)1 648 3 1008 5186 t ( disassemble @ PC+4)3 1026( //)1 1836(acid: asm\(*PC+4\))1 864 3 1008 5296 t ( R31,0x0\(R29\))1 864( MOVW)1 486(main+0x4 0x00006240)1 1026 3 1008 5406 t ( $setR30\(SB\),R30)1 1026( MOVW)1 486(main+0x8 0x00006244)1 1026 3 1008 5516 t ( MOVW R1,_clock\(SB\))2 1350(main+0x10 0x0000624c)1 1080 2 1008 5626 t 10 R f (Here, the saved)2 639 1 720 5806 t 10 CW f (PC)1395 5806 w 10 R f (is stored at address)3 793 1 1552 5806 t 10 CW f (0xc0000f60)2382 5806 w 10 R f (; its current content is)4 914 1 2982 5806 t 10 CW f (0x0000623c)3933 5806 w 10 R f (. The)1 242 1 4533 5806 t 10 CW f (a)4812 5806 w 10 R f (format code)1 491 1 4909 5806 t ( setting the value)3 689( After)1 263(converts this value to a string specifying the address as an offset beyond the nearest symbol.)15 3728 3 720 5926 t (of register 1, the example uses the)6 1427 1 720 6046 t 10 CW f (asm)2183 6046 w 10 R f ( at four bytes)3 560(command to disassemble a short section of code beginning)8 2441 2 2399 6046 t (beyond the current value of the)5 1244 1 720 6166 t 10 CW f (PC)1989 6166 w 10 R f (.)2109 6166 w 10 B f ( Interface)1 412(7. Process)1 446 2 720 6406 t 10 R f (A program executing under ACID is monitored through the)8 2476 1 970 6562 t 10 I f (proc)3484 6562 w 10 R f (file system interface provided by Plan 9.)6 1695 1 3705 6562 t (Textual messages written to the)4 1293 1 720 6682 t 10 CW f (ctl)2044 6682 w 10 R f ( example writing)2 689( For)1 195(file control the execution of the process.)6 1641 3 2255 6682 t 10 CW f (waitstop)4811 6682 w 10 R f (to)5322 6682 w ( to block until the target process enters the kernel and is stopped. When the process is)16 3430(the control file causes the write)5 1250 2 720 6802 t (stopped the write completes. The)4 1331 1 720 6922 t 10 CW f (startstop)2078 6922 w 10 R f ( does a)2 279(message starts the target process and then)6 1675 2 2645 6922 t 10 CW f (waitstop)4625 6922 w 10 R f (action.)5131 6922 w ( the actions of the various messages.)6 1492(Synchronization between the debugger and the target process is determined by)10 3188 2 720 7042 t ( the action)2 428(Some operate asynchronously to the target process and always complete immediately, others block until)13 4252 2 720 7162 t (completes. The asynchronous messages allow ACID to control several processes simultaneously.)10 3883 1 720 7282 t cleartomark showpage saveobj restore %%EndPage: 4 4 %%Page: 5 5 /saveobj save def mark 5 pagesetup 10 R f (The interpreter has builtin functions named after each of the control messages. The functions take a process id)17 4430 1 970 840 t ( instructions the interpreter performs two)5 1679( time a control message causes the program to execute)9 2251( Any)1 231(as argument.)1 519 4 720 960 t ( set are fixed up to)5 785( ACID variables pointing at the register)6 1629( The)1 213(actions when the control operation has completed.)6 2053 4 720 1080 t ( user defined function)3 882(point at the saved registers, and then the)7 1631 2 720 1200 t 10 CW f (stopped)3261 1200 w 10 R f ( The)1 208(is executed.)1 474 2 3709 1200 t 10 CW f (stopped)4419 1200 w 10 R f (function may)1 533 1 4867 1200 t ( source or instruction and return to interactive mode. Alternatively it may traverse a)13 3390(print the current address, line of)5 1290 2 720 1320 t (complex data structure, gather statistics and then set the program running again.)11 3192 1 720 1440 t ( variables allow)2 652( These)1 298( programmer.)1 553(Several ACID variables are maintained by the debugger rather than the)10 2927 4 970 1596 t ( variable)1 349( The)1 209(generic ACID code to deal with the current process, architecture specifics or the symbol table.)14 3819 3 720 1716 t 10 CW f (pid)5125 1716 w 10 R f (is)5333 1716 w ( variable)1 350( The)1 209( process ACID is debugging.)4 1173(the process id of the current)5 1126 4 720 1836 t 10 CW f (symbols)3607 1836 w 10 R f (contains a list of lists where each)6 1344 1 4056 1836 t ( variable)1 349( The)1 208(sublist contains the symbol name, its type and the value of the symbol.)12 2863 3 720 1956 t 10 CW f (registers)4168 1956 w 10 R f (contains a list of)3 664 1 4736 1956 t (the machine\255specific register names. Global symbols can be referenced directly by name from an ACID program.)15 4680 1 720 2076 t ( function:variable)1 740(Local variables are referenced using the colon operator as)8 2303 2 720 2196 t 10 B f ( Level Debugging)2 745(8. Source)1 419 2 720 2436 t 10 R f ( The)1 221(ACID provides several builtin functions to manipulate source code.)8 2827 2 970 2592 t 10 CW f (file)4059 2592 w 10 R f ( file,)1 200(function reads a text)3 860 2 4340 2592 t ( The)1 210( a list.)2 252(inserting each line into)3 931 3 720 2712 t 10 CW f (pcfile)2143 2712 w 10 R f (and)2533 2712 w 10 CW f (pcline)2707 2712 w 10 R f ( first)1 191( The)1 210(functions each take an address as an argument.)7 1902 3 3097 2712 t (returns a string containing the name of the source file and the second returns an integer containing the line number of)20 4680 1 720 2832 t (the source line containing the instruction at the address.)8 2222 1 720 2952 t 9 CW f ( file containing main)3 1134( //)1 1296(acid: pcfile\(main\))1 972 3 1008 3122 t (main.c)1008 3232 w ( line # of main in source file)7 1620( //)1 1296(acid: pcline\(main\))1 972 3 1008 3342 t (11)1008 3452 w ( print that line)3 864( //)1 216(acid: file\(pcfile\(main\)\)[pcline\(main\)])1 2052 3 1008 3562 t (main\(int argc, char *argv[]\))3 1512 1 1008 3672 t ( print statements near that line)5 1728( //)1 1512(acid: src\(*PC\))1 756 3 1008 3782 t (9)1062 3892 w (10 void)1 378 1 1062 4002 t (>11 main\(int argc, char *argv[]\))4 1728 1 1008 4112 t (12 {)1 216 1 1062 4222 t ( a;)1 162(13 int)1 540 2 1062 4332 t 10 R f ( combined in an expression to print a line of source code associated with an)14 3073(In this example, the three primitives are)6 1607 2 720 4512 t (address. The)1 537 1 720 4632 t 10 CW f (src)1289 4632 w 10 R f (function prints a few lines of source around the address supplied as its argument. A companion)15 3899 1 1501 4632 t (routine,)720 4752 w 10 CW f (Bsrc)1054 4752 w 10 R f (, communicates with the external editor)5 1591 1 1294 4752 t 10 CW f (sam)2912 4752 w 10 R f ( an address, it loads the corresponding source file)8 1987(. Given)1 321 2 3092 4752 t ( extended to more com\255)4 960( simple interface is easily)4 1031( This)1 232(into the editor and highlights the line containing the address.)9 2457 4 720 4872 t ( example, the)2 539( For)1 191(plex functions.)1 596 3 720 4992 t 10 CW f (step)2073 4992 w 10 R f ( current file and line in the editor each time the target)11 2159(function can select the)3 901 2 2340 4992 t ( allow\255)1 281(program stops, giving the user a visual trace of the execution path of the program. A more complete interface)18 4399 2 720 5112 t (ing two way communication between ACID and the)7 2167 1 720 5232 t 10 CW f (acme)2924 5232 w 10 R f ( construction. A filter)3 899(user interface [Pike93] is under)4 1300 2 3201 5232 t ( both sides of the interface. This)6 1314(between the debugger and the user interface provides interpretation of results from)11 3366 2 720 5352 t ( the)1 160(allows the programming environment to interact with the debugger and vice\255versa, a capability missing from)14 4520 2 720 5472 t 10 CW f (sam)720 5592 w 10 R f (interface. The)1 594 1 941 5592 t 10 CW f (src)1575 5592 w 10 R f (and)1795 5592 w 10 CW f (Bsrc)1979 5592 w 10 R f (functions are both written in ACID code using the file and line primitives.)12 3141 1 2259 5592 t ( library functions to step through source level statements and functions. Furthermore, addresses in)13 4057(ACID provides)1 623 2 720 5712 t ( code is manipulated in the ACID)6 1343( Source)1 327(ACID expressions can be specified by source file and line.)9 2339 3 720 5832 t 10 I f (list)4754 5832 w 10 R f (data type.)1 388 1 4902 5832 t 10 B f ( ACID Library)2 644(9. The)1 292 2 720 6072 t 10 R f ( the interaction of the debugger and the)7 1622(The following examples define some useful commands and illustrate)8 2808 2 970 6228 t (interpreter.)720 6348 w cleartomark showpage saveobj restore %%EndPage: 5 5 %%Page: 6 6 /saveobj save def mark 6 pagesetup 9 CW f ( set a breakpoint)3 918( //)1 1836(defn bpset\(addr\))1 864 3 1008 830 t ({)1008 940 w (if match\(addr, bplist\) >= 0 then)5 1728 1 1440 1050 t (print\("breakpoint already set at ", fmt\(addr, 'a'\), "\\n"\);)7 3132 1 1872 1160 t (else {)1 324 1 1440 1270 t ( plant the breakpoint)3 1134( //)1 378(*fmt\(addr, bpfmt\) = bpinst;)3 1458 3 1872 1380 t ( add to list)3 648( //)1 270(bplist = append bplist, addr;)4 1566 3 1872 1490 t (})1440 1600 w (})1008 1710 w 10 R f (The)720 1890 w 10 CW f (bpset)906 1890 w 10 R f (function plants a break point in memory. The function starts by using the)12 2989 1 1237 1890 t 10 CW f (match)4257 1890 w 10 R f (builtin to search the)3 812 1 4588 1890 t ( indirection operator, controlled by the)5 1562( The)1 210(breakpoint list to determine if a breakpoint is already set at the address.)12 2908 3 720 2010 t (format code returned by the)4 1140 1 720 2130 t 10 CW f (fmt)1893 2130 w 10 R f ( variables)1 394( The)1 214( plant the breakpoint in memory.)5 1355(primitive, is used to)3 819 4 2106 2130 t 10 CW f (bpfmt)4922 2130 w 10 R f (and)5256 2130 w 10 CW f (bpinst)720 2250 w 10 R f ( global variables containing the format code specifying the size of the breakpoint instruction and)14 3897(are ACID)1 394 2 1109 2250 t ( variables are set by architecture\255dependent library code when the debugger)10 3088( These)1 295( instruction itself.)2 717(the breakpoint)1 580 4 720 2370 t ( address of the breakpoint is appended to the breakpoint list,)10 2595( the)1 167( Finally)1 354(first attaches to the executing image.)5 1564 4 720 2490 t 10 CW f (bplist)720 2610 w 10 R f (.)1080 2610 w 9 CW f ( single step)2 648( //)1 1674(defn step\(\))1 594 3 1008 2780 t ({)1008 2890 w (local lst, lpl, addr, bput;)4 1458 1 1440 3000 t ( sitting on a breakpoint)4 1296( //)1 1350(bput = 0;)2 486 3 1440 3220 t (if match\(*PC, bplist\) >= 0 then {)6 1782 1 1440 3330 t (bput = fmt\(*PC, bpfmt\); // save current address)7 2538 1 1872 3440 t ( replace it)2 594( //)1 648(*bput = @bput;)2 756 3 1872 3550 t (})1440 3660 w ( get follow set)3 810( //)1 864(lst = follow\(*PC\);)2 972 3 1440 3880 t (lpl = lst;)2 540 1 1440 4100 t ( place break points)3 1026( //)1 1080(while lpl do {)3 756 3 1440 4210 t (*\(head lpl\) = bpinst;)3 1134 1 1872 4320 t (lpl = tail lpl;)3 810 1 1872 4430 t (})1440 4540 w ( do the step)3 648(startstop\(pid\); //)1 1836 2 1440 4760 t ( remove the breakpoints)3 1242( //)1 1080(while lst do {)3 756 3 1440 4980 t (addr = fmt\(head lst, bpfmt\);)4 1512 1 1872 5090 t ( replace it)2 594( //)1 648(*addr = @addr;)2 756 3 1872 5200 t (lst = tail lst;)3 810 1 1872 5310 t (})1440 5420 w (if bput != 0 then)4 918 1 1440 5530 t ( replace saved breakpoint)3 1350( //)1 594(*bput = bpinst;)2 810 3 1872 5640 t (})1008 5750 w 10 R f (The)720 5930 w 10 CW f (step)901 5930 w 10 R f ( the)1 149( If)1 118( instruction.)1 480(function executes a single assembler)4 1462 4 1167 5930 t 10 CW f (PC)3403 5930 w 10 R f (is sitting on a breakpoint, the address and size)8 1850 1 3550 5930 t ( the)1 151( breakpoint instruction is then removed using)6 1840( The)1 210(of the breakpoint are saved.)4 1125 4 720 6050 t 10 CW f (@)4075 6050 w 10 R f (operator to fetch)2 667 1 4164 6050 t 10 CW f (bpfmt)4860 6050 w 10 R f (bytes)5189 6050 w ( to place it into the memory of the executing process using the)12 2522(from the text file and)4 851 2 720 6170 t 10 CW f (*)4121 6170 w 10 R f (operator. The)1 565 1 4209 6170 t 10 CW f (follow)4802 6170 w 10 R f (func\255)5190 6170 w ( If)1 122( a list of instruction addresses which could be executed next.)10 2481(tion is an ACID builtin which returns a follow\255set:)8 2077 3 720 6290 t (the instruction stored at the)4 1104 1 720 6410 t 10 CW f (PC)1853 6410 w 10 R f ( next instruction and the)4 986(is a branch instruction, the list contains the addresses of the)10 2412 2 2002 6410 t ( then used to)3 541( follow\255set is)2 546( The)1 217(branch destination; otherwise, it contains only the address of the next instruction.)11 3376 4 720 6530 t ( original instructions need not be)5 1403( The)1 223( breakpoint instruction.)2 966(replace each possible following instruction with a)6 2088 4 720 6650 t ( The)1 207(saved; they remain in their unaltered state in the text file.)10 2297 2 720 6770 t 10 CW f (startstop)3251 6770 w 10 R f ( message to)2 468(builtin writes the `startstop')3 1114 2 3818 6770 t (the)720 6890 w 10 I f (proc)870 6890 w 10 R f (control file for the process named)5 1359 1 1081 6890 t 10 CW f (pid)2468 6890 w 10 R f ( causes it to enter)4 709( target process executes until some condition)6 1810(. The)1 233 3 2648 6890 t ( the process blocks, the debugger regains control and)8 2179( When)1 296( the execution of a breakpoint.)5 1254(the kernel, in this case,)4 951 4 720 7010 t (invokes the ACID library function)4 1516 1 720 7130 t 10 CW f (stopped)2296 7130 w 10 R f ( The)1 241( address and cause of the blockage.)6 1620(which reports the)2 763 3 2776 7130 t 10 CW f (startstop)720 7250 w 10 R f (function completes and returns to the)5 1579 1 1304 7250 t 10 CW f (step)2927 7250 w 10 R f ( to replace the)3 616(function where the follow\255set is used)5 1573 2 3211 7250 t cleartomark showpage saveobj restore %%EndPage: 6 6 %%Page: 7 7 /saveobj save def mark 7 pagesetup 10 R f ( if the address of the original)6 1148( Finally,)1 359(breakpoints placed earlier.)2 1055 3 720 840 t 10 CW f (PC)3307 840 w 10 R f (contained a breakpoint, it is replaced.)5 1494 1 3452 840 t ( is inherently portable; the ACID code is shared by the debuggers)11 2670(Notice that this approach to process control)6 1760 2 970 996 t ( variables and builtin functions provide a transparent interface to architecture\255dependent)10 3569( ACID)1 299(for all architectures.)2 812 3 720 1116 t ( and format are referenced through ACID variables and the)9 2365( the breakpoint value)3 840( Here)1 243(values and functions.)2 846 4 720 1236 t 10 CW f (follow)5040 1236 w 10 R f (primitive masks the differences in the underlying instruction set.)8 2578 1 720 1356 t (The)970 1512 w 10 CW f (next)1152 1512 w 10 R f ( the)1 150(function, similar to)2 768 2 1419 1512 t 10 I f (dbx)2365 1512 w 10 R f ( function steps)2 589( This)1 231(command of the same name, is a simpler example.)8 2043 3 2537 1512 t (through a single source statement but steps over function calls.)9 2508 1 720 1632 t 9 CW f (defn next\(\))1 594 1 1008 1802 t ({)1008 1912 w (local sp, bound;)2 864 1 1440 2022 t ( save starting SP)3 918( //)1 1350(sp = *SP;)2 486 3 1440 2242 t ( begin & end of function)5 1296( //)1 702(bound = fnbound\(*PC\);)2 1134 3 1440 2352 t ( step 1 statement)3 918(stmnt\(\); //)1 1836 2 1440 2462 t (pc = *PC;)2 486 1 1440 2572 t (if pc >= bound[0] && pc < bound[1] then)8 2106 1 1440 2682 t (return {};)1 540 1 1872 2792 t (while \(pc < bound[0] || pc > bound[1]\) && sp >= *SP do {)13 3024 1 1440 3012 t (step\(\);)1872 3122 w (pc = *PC;)2 486 1 1872 3232 t (})1440 3342 w (src\(*PC\);)1440 3452 w (})1008 3562 w 10 R f (The)720 3742 w 10 CW f (next)902 3742 w 10 R f ( then uses the ACID library func\255)6 1354( It)1 114( current stack pointer in a local variable.)7 1628(function starts by saving the)4 1135 4 1169 3742 t (tion)720 3862 w 10 CW f (fnbound)907 3862 w 10 R f ( The)1 210( the addresses of the first and last instructions in the current function in a list.)15 3155(to return)1 347 3 1358 3862 t 10 CW f (stmnt)5100 3862 w 10 R f (function executes a single source statement and then uses)8 2322 1 720 3982 t 10 CW f (src)3071 3982 w 10 R f ( lines of source around the new)6 1277(to print a few)3 547 2 3280 3982 t 10 CW f (PC)5134 3982 w 10 R f (. If)1 146 1 5254 3982 t (the new value of the)4 833 1 720 4102 t 10 CW f (PC)1584 4102 w 10 R f (remains in the current function,)4 1280 1 1735 4102 t 10 CW f (next)3046 4102 w 10 R f ( a function)2 437( the executed statement is)4 1050(returns. When)1 596 3 3317 4102 t ( the)1 152(call or a return from a function, the new value of)10 1982 2 720 4222 t 10 CW f (PC)2884 4222 w 10 R f (is outside the bounds calculated by)5 1421 1 3034 4222 t 10 CW f (fnbound)4485 4222 w 10 R f (and the test)2 465 1 4935 4222 t (of the)1 234 1 720 4342 t 10 CW f (while)983 4342 w 10 R f ( the stack pointer is greater than the)7 1443( the statement was a return, the new value of)9 1815( If)1 120(loop is evaluated.)2 710 4 1312 4342 t ( the loop is entered and instructions are continu\255)8 1925( Otherwise,)1 485(original value and the loop completes without execution.)7 2270 3 720 4462 t (ally executed until the value of the)6 1381 1 720 4582 t 10 CW f (PC)2126 4582 w 10 R f ( that point, execution ceases and a)6 1361( At)1 150(is between the bounds calculated earlier.)5 1618 3 2271 4582 t (few lines of source in the vicinity of the)8 1592 1 720 4702 t 10 CW f (PC)2337 4702 w 10 R f (are printed.)1 454 1 2482 4702 t ( control and manipulation of target programs. These exam\255)8 2394(ACID provides concise and elegant expression for)6 2036 2 970 4858 t (ples demonstrate how a few well\255chosen primitives can be combined to create a rich debugging environment.)15 4369 1 720 4978 t 10 B f ( With Multiple Architectures)3 1240(10. Dealing)1 503 2 720 5218 t 10 R f ( running on any of the five processor architectures)8 2054(A single binary of ACID may be used to debug a program)11 2376 2 970 5374 t ( example, Plan 9 allows a user on a MIPS to import the)12 2327( For)1 199(supported by Plan 9.)3 852 3 720 5494 t 10 I f (proc)4133 5494 w 10 R f ( i486\255)1 245(file system from an)3 804 2 4351 5494 t (based PC and remotely debug a program executing on that processor.)10 2770 1 720 5614 t ( the lowest level, a Plan 9 library sup\255)8 1584( On)1 181( provide this architecture independence.)4 1629(Two levels of abstraction)3 1036 4 970 5770 t ( the file header of the program being debugged and select a table of system parameters and)16 3672(plies functions to decode)3 1008 2 720 5890 t ( these functions are byte\255)4 1055( Among)1 363( magic number.)2 650(a jump vector of architecture\255dependent functions based on the)8 2612 4 720 6010 t ( and floating point number)4 1134(order\255independent access to memory and text files, stack manipulation, disassembly,)9 3546 2 720 6130 t ( consists of primitives and approximately 200)6 1833( It)1 112( second level of abstraction is supplied by ACID.)8 1967(interpretation. The)1 768 4 720 6250 t ( the interpreter to the architecture\255dependent library.)6 2103(lines of architecture\255dependent ACID library code that interface)7 2577 2 720 6370 t ( names to memory locations, supplying breakpoint values and)8 2481(This layer performs functions such as mapping register)7 2199 2 720 6490 t ( function)1 358( example of the latter is the stack trace)8 1543( An)1 173(sizes, and converting processor specific data to ACID data types.)9 2606 4 720 6610 t 10 CW f (strace)720 6730 w 10 R f ( in the architecture\255dependent library to construct a list of lists)10 2615(, which uses the stack traversal functions)6 1705 2 1080 6730 t ( first level of list selects each function in the trace; subordinate lists contain)13 3049( The)1 208(describing the context of a process.)5 1423 3 720 6850 t ( commands and library functions that)5 1500( ACID)1 296( the functions.)2 573(the names and values of parameters and local variables of)9 2311 4 720 6970 t ( independent of the under\255)4 1057(manipulate and display process state information operate on the list representation and are)12 3623 2 720 7090 t (lying architecture.)1 726 1 720 7210 t cleartomark showpage saveobj restore %%EndPage: 7 7 %%Page: 8 8 /saveobj save def mark 8 pagesetup 10 B f ( Runtime)1 397(11. ALEF)1 442 2 720 840 t 10 R f ( that supports)2 567(ALEF is a concurrent programming language designed specifically for systems programming)10 3863 2 970 996 t ( the C expression syntax but implements a sub\255)8 1888( borrows)1 353( ALEF)1 301(both shared variable and message passing paradigms.)6 2138 4 720 1116 t ( language provides a rich set of exception handling, process management, and)11 3190( The)1 212(stantially different type system.)3 1278 3 720 1236 t ( program bugs are often deadlocks, synchroniza\255)6 1966( ALEF)1 304( system.)1 332(synchronization primitives which rely on a runtime)6 2078 4 720 1356 t ( the)1 155( such cases, a process stalls deep in)7 1457( In)1 140(tion failures, or non\255termination caused by locks being held incorrectly.)9 2928 4 720 1476 t ( the language to understand the detailed)6 1640(runtime code and it is clearly unreasonable to expect a programmer using)11 3040 2 720 1596 t (internal semantics of the runtime support functions.)6 2062 1 720 1716 t ( to interpret the program)4 980(Instead, there is an ALEF support library, coded in ACID, that allows the programmer)13 3450 2 970 1872 t ( because of improper)3 857( the example of a multi\255process program stalling)7 1988( Consider)1 418(state in terms of ALEF operations.)5 1417 4 720 1992 t ( ALEF run\255)2 482( stack trace of the program indicates that it is waiting for an event in some obscure)16 3406(synchronization. A)1 792 3 720 2112 t ( is irrelevant to the programmer; of greater importance is the iden\255)11 2658( function itself)2 587( The)1 207(time synchronization function.)2 1228 4 720 2232 t ( runtime data structures and program)5 1477( in the ALEF support library decode the)7 1595( Commands)1 506(tity of the unfulfilled event.)4 1102 4 720 2352 t ( in terms of the high\255level operations available to the ALEF programmer.)11 3028(state to report the cause of the blockage)7 1652 2 720 2472 t (Here, the ACID language acts as a communications medium between ALEF implementer and ALEF user.)14 4237 1 720 2592 t 10 B f ( Debugging)1 487(12. Parallel)1 508 2 720 2832 t 10 R f ( debugger is multiplexed between the processes comprising)7 2412(The central issue in parallel debugging is how the)8 2018 2 970 2988 t ( parallel programs share a)4 1066( has no intrinsic model of process partitioning; it only assumes that)11 2790( ACID)1 304(the program.)1 520 4 720 3108 t ( The)1 207(symbol table, though they need not share memory.)7 2030 2 720 3228 t 10 CW f (setproc)2984 3228 w 10 R f (primitive attaches the debugger to a running pro\255)7 1969 1 3431 3228 t ( that value to the global variable)6 1377(cess associated with the process ID supplied as its argument and assigns)11 3058 2 720 3348 t 10 CW f (pid)5195 3348 w 10 R f (,)5375 3348 w ( the stack trace primitive is driven by parame\255)8 1843( Further,)1 370( processes.)1 433(thereby allowing simple rotation among a group of)7 2034 4 720 3468 t ( process context, so it is possible to examine the state of cooperating processes without)14 3681(ters specifying a unique)3 999 2 720 3588 t ( ACID is inherently extensible and capable of)7 1946( Since)1 289( of interest.)2 486(switching the debugger focus from the process)6 1959 4 720 3708 t ( subordinate processes, the programmer can define ACID commands to detect and control)12 3667(dynamic interaction with)2 1013 2 720 3828 t ( short, the programmer is free to specify how the debugger reacts to)12 2870( In)1 147(complex interactions between processes.)3 1663 3 720 3948 t (events generated in specific threads of the program.)7 2061 1 720 4068 t ( segment)1 363(The support for parallel debugging in ACID depends on a crucial kernel modification: when the text)15 4067 2 970 4224 t ( is written \(usually to place a breakpoint\), the segment is cloned to prevent other threads from encoun\255)17 4155(of a program)2 525 2 720 4344 t ( this incurs a slight performance penalty, it is of little importance while debugging.)13 3311( Although)1 428(tering the breakpoint.)2 857 3 720 4464 t 10 B f ( Between Tools)2 644(13. Communication)1 864 2 720 4704 t 10 R f ( information in the symbol)4 1091(Like the other Plan 9 compilers, the ALEF compiler does not embed detailed type)13 3339 2 970 4860 t ( emit descriptions of com\255)4 1069( it does accept a command line option causing it to)10 2086( However,)1 446(table of an executable file.)4 1079 4 720 4980 t ( vehicle for expressing this infor\255)5 1363( The)1 212( abstract data types\) to an auxiliary file.)7 1629(plex data types \(e.g., aggregates and)5 1476 4 720 5100 t ( ACID debugging session is subsequently started, that file is loaded with the)12 3087( an)1 123( When)1 292(mation is ACID source code.)4 1178 4 720 5220 t (other ACID libraries.)2 851 1 720 5340 t ( first is)2 282( The)1 207( object in the ALEF program the compiler generates three pieces of ACID code.)13 3224(For each complex)2 717 4 970 5496 t ( is an ACID function,)4 903( Following)1 472( of the complex data type.)5 1087(a table describing the size and offset of each member)9 2218 4 720 5616 t ( ALEF)1 278( ACID declarations associate the)4 1316( Finally,)1 361(named the same as the object, that formats and prints each member.)11 2725 4 720 5736 t ( three forms of declaration are shown in the follow\255)9 2059( The)1 205( the functions to print them.)5 1111(program variables of a type with)5 1305 4 720 5856 t (ing example:)1 519 1 720 5976 t 9 CW f (struct Bitmap {)2 810 1 1008 6146 t ( r;)1 162(Rectangle 0)1 756 2 1440 6256 t ( clipr;)1 378(Rectangle 16)1 756 2 1440 6366 t ( ldepth;)1 432('D' 32)1 432 2 1440 6476 t ( id;)1 216('D' 36)1 432 2 1440 6586 t ( cache;)1 378('X' 40)1 432 2 1440 6696 t (};)1008 6806 w cleartomark showpage saveobj restore %%EndPage: 8 8 %%Page: 9 9 /saveobj save def mark 9 pagesetup 9 CW f (defn)1008 830 w (Bitmap\(addr\) {)1 756 1 1008 940 t (complex Bitmap addr;)2 1080 1 1440 1050 t (print\("Rectangle r {\\n"\);)2 1350 1 1440 1160 t (Rectangle\(addr.r\);)1440 1270 w (print\("}\\n"\);)1440 1380 w (print\("Rectangle clipr {\\n"\);)2 1566 1 1440 1490 t (Rectangle\(addr.clipr\);)1440 1600 w (print\("}\\n"\);)1440 1710 w ( addr.ldepth, "\\n"\);)2 1080( ",)1 216(print\(" ldepth)1 756 3 1440 1820 t ( addr.id, "\\n"\);)2 864( ",)1 432(print\(" id)1 540 3 1440 1930 t ( addr.cache, "\\n"\);)2 1026( ",)1 270(print\(" cache)1 702 3 1440 2040 t (};)1008 2150 w (complex Bitmap darkgrey;)2 1296 1 1008 2370 t (complex Bitmap Window_settag:b;)2 1674 1 1008 2480 t 10 R f (The)720 2660 w 10 CW f (struct)905 2660 w 10 R f ( the complex type named)4 1028(declaration specifies decoding instructions for)4 1861 2 1295 2660 t 10 CW f (Bitmap.)4215 2660 w 10 R f (Although the syn\255)2 734 1 4666 2660 t ( declaration specifies a)3 929(tax is superficially similar to a C structure declaration, the semantics differ markedly: the C)14 3751 2 720 2780 t ( specifies a type, an offset, and name for)8 1652( declaration)1 472( The)1 209(layout, while the ACID declaration tells how to decode it.)9 2347 4 720 2900 t ( is either the name of another complex declaration, for example,)10 2725(each member of the complex object. The type)7 1955 2 720 3020 t 10 CW f (Rectangle)720 3140 w 10 R f ( bytes from the start of the object to the member and the)12 2265( offset is the number of)5 934( The)1 206(, or a format code.)4 735 4 1260 3140 t ( is)1 93( type description is a close match for C and ALEF, but)11 2203( This)1 230(name is the member's name in the ALEF declaration.)8 2154 4 720 3260 t (simple enough to be language independent.)5 1731 1 720 3380 t (The)970 3536 w 10 CW f (Bitmap)1155 3536 w 10 R f ( of a)2 189(function expects the address)3 1143 2 1545 3536 t 10 CW f (Bitmap)2908 3536 w 10 R f ( uses the decoding informa\255)4 1133( It)1 117(as its only argument.)3 851 3 3299 3536 t (tion contained in the)3 855 1 720 3656 t 10 CW f (Bitmap)1611 3656 w 10 R f (structure declaration to extract, format, and print the value of each member of the)13 3393 1 2007 3656 t ( ALEF compiler emits code to call other ACID functions where a)11 2692( The)1 212(complex object pointed to by the argument.)6 1776 3 720 3776 t (member is another complex type; here,)5 1558 1 720 3896 t 10 CW f (Bitmap)2303 3896 w 10 R f (calls)2688 3896 w 10 CW f (Rectangle)2896 3896 w 10 R f (to print its contents.)3 795 1 3461 3896 t (The)970 4052 w 10 CW f (complex)1152 4052 w 10 R f ( the example,)2 541( In)1 135(declarations associate ALEF variables with complex types.)6 2372 3 1599 4052 t 10 CW f (darkgrey)4675 4052 w 10 R f (is the)1 217 1 5183 4052 t (name of a global variable of type)6 1337 1 720 4172 t 10 CW f (Bitmap)2085 4172 w 10 R f ( the name)2 394( Whenever)1 462(in the ALEF program being debugged.)5 1563 3 2473 4172 t 10 CW f (darkgrey)4920 4172 w 10 R f (is evaluated by ACID, it automatically calls the)7 1926 1 720 4292 t 10 CW f (Bitmap)2675 4292 w 10 R f (function with the address of)4 1131 1 3064 4292 t 10 CW f (darkgrey)4224 4292 w 10 R f (as the argument.)2 667 1 4733 4292 t (The second)1 463 1 720 4412 t 10 CW f (complex)1214 4412 w 10 R f ( named)1 296(declaration associates a local variable or parameter)6 2068 2 1665 4412 t 10 CW f (b)4059 4412 w 10 R f (in function)1 441 1 4149 4412 t 10 CW f (Window_settag)4620 4412 w 10 R f (with the)1 325 1 720 4532 t 10 CW f (Bitmap)1070 4532 w 10 R f (complex data type.)2 757 1 1455 4532 t (ACID borrows the C operators)4 1255 1 970 4688 t 10 CW f (.)2256 4688 w 10 R f (and)2347 4688 w 10 CW f (\255>)2522 4688 w 10 R f ( of a member of a complex type.)7 1346(to access the decoding parameters)4 1381 2 2673 4688 t ( ALEF complex data)3 856(Although this representation is sufficiently general for describing the decoding of both C and)13 3824 2 720 4808 t ( the assumption)2 630( Further,)1 370( too restrictive for target languages with more complicated type systems.)10 2914(types, it may prove)3 766 4 720 4928 t ( the language is somewhat naive.)5 1365(that the compiler can select the proper ACID format code for each basic type in)14 3315 2 720 5048 t ( of a complex type is a pointer, it is assigned a hexadecimal type code; integer mem\255)16 3471(For example, when a member)4 1209 2 720 5168 t ( heuristic proves inaccurate when an integer field is a bit mask or)12 2612( This)1 229( decimal type code.)3 779(bers are always assigned a)4 1060 4 720 5288 t (set of bit flags which are more appropriately displayed in hexadecimal or octal.)12 3163 1 720 5408 t 10 B f ( Verification)1 535(14. Code)1 397 2 720 5648 t 10 R f ( passive test and verification of the)6 1440(ACID's ability to dynamically interact with an executing program allows)9 2990 2 970 5804 t ( programs using)2 652( example, a common concern is leak detection in)8 1989( For)1 194(target program.)1 620 4 720 5924 t 10 CW f (malloc)4204 5924 w 10 R f ( interest are two)3 652(. Of)1 184 2 4564 5924 t ( that was allocated but never freed and detecting bad pointers passed to)12 2898(items: finding memory)2 925 2 720 6044 t 10 CW f (free)4573 6044 w 10 R f ( auxiliary)1 385(. An)1 202 2 4813 6044 t ( these faults, either as they)5 1079(ACID library contains ACID functions to monitor the execution of a program and detect)13 3601 2 720 6164 t ( the following example, the)4 1124( In)1 139(happen or in the automated post\255mortem analysis of the memory arena.)10 2908 3 720 6284 t 10 CW f (sort)4923 6284 w 10 R f (com\255)5195 6284 w (mand is run under the control of the ACID memory leak library.)11 2568 1 720 6404 t cleartomark showpage saveobj restore %%EndPage: 9 9 %%Page: 10 10 /saveobj save def mark 10 pagesetup 9 CW f (helix% acid \255l malloc /bin/sort)4 1674 1 1008 830 t (/bin/sort: mips plan 9 executable)4 1782 1 1008 940 t (/lib/acid/port)1008 1050 w (/lib/acid/mips)1008 1160 w (/lib/acid/malloc)1008 1270 w (acid: go\(\))1 540 1 1008 1380 t (now)1008 1490 w (is)1008 1600 w (the)1008 1710 w (time)1008 1820 w ()1008 1930 w (is)1008 2040 w (now)1008 2150 w (the)1008 2260 w (time)1008 2370 w ( $0x8,R1)1 594( _exits+0x4 MOVW)2 1404(27680 : breakpoint)2 972 3 1008 2480 t (acid:)1008 2590 w 10 R f (The)720 2770 w 10 CW f (go)903 2770 w 10 R f ( to)1 107(command creates a process and plants breakpoints at the entry)9 2513 2 1051 2770 t 10 CW f (malloc)3700 2770 w 10 R f (and)4089 2770 w 10 CW f (free)4262 2770 w 10 R f ( program is then)3 664(. The)1 234 2 4502 2770 t ( reason for stopping is anything other than the breakpoints in)10 2571( the)1 162( If)1 131(started and continues until it exits or stops.)7 1816 4 720 2890 t 10 CW f (malloc)720 3010 w 10 R f (and)1105 3010 w 10 CW f (free)1274 3010 w 10 R f (, ACID prints the usual status information and returns to the interactive prompt.)12 3186 1 1514 3010 t (When the process stops on entering)5 1452 1 970 3166 t 10 CW f (malloc)2454 3166 w 10 R f ( must capture and save the address that)7 1611(, the debugger)2 582 2 2814 3166 t 10 CW f (malloc)5040 3166 w 10 R f ( routine can be identified, it places a breakpoint at the return)11 2516( saving a stack trace so the calling)7 1438( After)1 271(will return.)1 455 4 720 3286 t ( When)1 293(address and restarts the program.)4 1336 2 720 3406 t 10 CW f (malloc)2379 3406 w 10 R f ( stops the program, allowing the debugger)6 1720(returns, the breakpoint)2 911 2 2769 3406 t ( address and stack trace are added to the)8 1632( The)1 209( register.)1 353(to grab the address of the new memory block from the return)11 2486 4 720 3526 t (list of outstanding memory blocks, the breakpoint is removed from the return point, and the process is restarted.)17 4467 1 720 3646 t ( beginning of)2 541(When the process stops at the)5 1199 2 970 3802 t 10 CW f (free)2739 3802 w 10 R f (, the memory address supplied as the argument is compared)9 2421 1 2979 3802 t ( it is not found an error message and a stack trace of the call is reported;)16 2903( If)1 118( blocks.)1 313(to the list of outstanding memory)5 1346 4 720 3922 t (otherwise, the address is deleted from the list.)7 1828 1 720 4042 t ( of outstanding memory blocks contains the addresses of all blocks that were)12 3128(When the program exits, the list)5 1302 2 970 4198 t ( The)1 214(allocated but never freed.)3 1040 2 720 4318 t 10 CW f (leak)2008 4318 w 10 R f ( a report describing the allocated)5 1345(library function traverses the list producing)5 1773 2 2282 4318 t (blocks.)720 4438 w 9 CW f (acid: leak\(\))1 648 1 1008 4608 t (Lost a total of 524288 bytes from:)6 1836 1 1008 4718 t (malloc\(\) malloc.c:32 called from dofile+0xe8 sort.c:217)5 2970 1 1440 4828 t (dofile\(\) sort.c:190 called from main+0xac sort.c:161)5 2808 1 1440 4938 t (main\(\) sort.c:128 called from _main+0x20 main9.s:10)5 2754 1 1440 5048 t (Lost a total of 64 bytes from:)6 1620 1 1008 5158 t (malloc\(\) malloc.c:32 called from newline+0xfc sort.c:280)5 3024 1 1440 5268 t (newline\(\) sort.c:248 called from dofile+0x110 sort.c:222)5 3024 1 1440 5378 t (dofile\(\) sort.c:190 called from main+0xac sort.c:161)5 2808 1 1440 5488 t (main\(\) sort.c:128 called from _main+0x20 main9.s:10)5 2754 1 1440 5598 t (Lost a total of 64 bytes from:)6 1620 1 1008 5708 t (malloc\(\) malloc.c:32 called from realloc+0x14 malloc.c:129)5 3132 1 1440 5818 t (realloc\(\) malloc.c:123 called from buildkey+0x358 sort.c:1388)5 3294 1 1440 5928 t (buildkey\(\) sort.c:1345 called from newline+0x150 sort.c:285)5 3186 1 1440 6038 t (newline\(\) sort.c:248 called from dofile+0x110 sort.c:222)5 3024 1 1440 6148 t (dofile\(\) sort.c:190 called from main+0xac sort.c:161)5 2808 1 1440 6258 t (main\(\) sort.c:128 called from _main+0x20 main9.s:10)5 2754 1 1440 6368 t (acid: refs\(\))1 648 1 1008 6478 t (data...bss...stack...)1008 6588 w (acid: leak\(\))1 648 1 1008 6698 t (acid:)1008 6808 w 10 R f ( is there because of a leak; for instance, it may have)11 2138(The presence of a block in the allocation list does not imply it)12 2542 2 720 6988 t ( The)1 209(been in use when the program terminated.)6 1701 2 720 7108 t 10 CW f (refs\(\))2659 7108 w 10 R f (library function scans the)3 1024 1 3048 7108 t 10 I f (data)4100 7108 w 10 R f (,)4278 7108 w 10 I f (bss)4331 7108 w 10 R f (, and)1 197 1 4459 7108 t 10 I f (stack)4684 7108 w 10 R f (segments of)1 483 1 4917 7108 t ( one is found, the block is deleted from the)9 1907( When)1 310( for pointers into the allocated blocks.)6 1644(the process looking)2 819 4 720 7228 t cleartomark showpage saveobj restore %%EndPage: 10 10 %%Page: 11 11 /saveobj save def mark 11 pagesetup 10 R f ( The)1 210(outstanding block list.)2 897 2 720 840 t 10 CW f (leak)1857 840 w 10 R f ( to report the blocks remaining allocated and unreferenced.)8 2384(function is used again)3 889 2 2127 840 t (This strategy proves effective in detecting disconnected \(but non\255circular\) data structures.)10 3583 1 720 960 t ( and the source code is)5 941( program is not specially compiled)5 1415( The)1 211(The leak detection process is entirely passive.)6 1863 4 970 1116 t ( of the library rou\255)4 745( with the ACID support functions for the ALEF runtime environment, the author)12 3258( As)1 164(not required.)1 513 4 720 1236 t ( check a)2 342( programmer may then)3 933( Any)1 229(tines has encapsulated the functionality of the library interface in ACID code.)11 3176 4 720 1356 t ( of run\255)2 305( performance impact)2 833( The)1 209(program's use of the library routines without knowledge of either implementation.)10 3333 4 720 1476 t ( great \(about 10 times slower\), however it has not prevented interactive programs like)13 3447(ning leak detection is)3 855 2 720 1596 t 10 CW f (sam)5049 1596 w 10 R f (and)5256 1596 w (the)720 1716 w 10 CW f (8\275)867 1716 w 10 R f (window system from being tested.)4 1374 1 1012 1716 t 10 B f ( Coverage)1 429(15. Code)1 397 2 720 1956 t 10 R f ( test uses)2 371(Another common component of software)4 1663 2 970 2112 t 10 I f (coverage)3034 2112 w 10 R f ( purpose of the test is to determine)7 1414(analysis. The)1 557 2 3429 2112 t ( is usually performed by a)5 1075( This)1 235( suite.)1 246(which paths through the code have not been executed while running the test)12 3124 4 720 2232 t ( the)1 156(combination of compiler support and a reporting tool run on the output generated by statements compiled into)16 4524 2 720 2352 t ( program as it executes basic blocks and writes the)9 2075( compiler emits code that logs the progress of the)9 2030(program. The)1 575 3 720 2472 t ( have not been exe\255)4 795(results to a file. The file is then processed by the reporting tool to determine which basic blocks)17 3885 2 720 2592 t (cuted.)720 2712 w ( modifying the source, object)4 1184(ACID can perform the same function in a language independent manner without)11 3246 2 970 2868 t ( shows)1 290(or binary of the program. The following example)7 2075 2 720 2988 t 10 CW f (ls)3125 2988 w 10 R f (being run under the control of the ACID coverage)8 2115 1 3285 2988 t (library.)720 3108 w 9 CW f (philw\255helix% acid \255l coverage /bin/ls)4 1998 1 1008 3278 t (/bin/ls: mips plan 9 executable)4 1674 1 1008 3388 t (/lib/acid/port)1008 3498 w (/lib/acid/mips)1008 3608 w (/lib/acid/coverage)1008 3718 w (acid: coverage\(\))1 864 1 1008 3828 t (acid)1008 3938 w (newstime)1008 4048 w (profile)1008 4158 w (tel)1008 4268 w (wintool)1008 4378 w (2: \(error\) msg: pid=11419 startstop: process exited)6 2754 1 1008 4488 t (acid: analyse\(ls\))1 918 1 1008 4598 t (ls.c:102,105)1008 4708 w ( 1;)1 162(102: return)1 1188 2 1440 4818 t (103: })1 486 1 1440 4928 t ( && dflag==0\){)2 756(104: if\(db[0].qid.path&CHDIR)1 1674 2 1440 5038 t (105: output\(\);)1 1350 1 1440 5148 t (ls.c:122,126)1008 5258 w ( db, sizeof\(Dir\)\);)2 972(122: memmove\(dirbuf+ndir,)1 1944 2 1440 5368 t ( = 0;)2 270(123: dirbuf[ndir].prefix)1 1890 2 1440 5478 t ( = utfrrune\(s, '/'\);)3 1080(124: p)1 918 2 1440 5588 t (125: if\(p\){)1 1188 1 1440 5698 t ( = s;)2 270(126: dirbuf[ndir].prefix)1 2322 2 1440 5808 t 10 R f (The)720 5988 w 10 CW f (coverage)904 5988 w 10 R f ( through the text segment placing breakpoints at the entry to each basic)12 2900(function begins by looping)3 1087 2 1413 5988 t ( is found using the ACID builtin function)7 1744(block. The start of each basic block)6 1500 2 720 6108 t 10 CW f (follow)4002 6108 w 10 R f ( the list generated by)4 884(. If)1 154 2 4362 6108 t 10 CW f (follow)720 6228 w 10 R f ( is placed at)3 477(contains more than one element, then the addresses mark the start of basic blocks. A breakpoint)15 3818 2 1105 6228 t ( to detect entry into the block. If the result of)10 1849(each address)1 513 2 720 6348 t 10 CW f (follow)3113 6348 w 10 R f (is a single address then no action is taken, and)9 1896 1 3504 6348 t ( placing duplicates)2 763(the next address is considered. ACID maintains a list of breakpoints already in place and avoids)15 3917 2 720 6468 t (\(an address may be the destination of several branches\).)8 2230 1 720 6588 t ( time a breakpoint is encountered ACID deletes)7 1906( Each)1 250(After placing the breakpoints the program is set running.)8 2274 3 970 6744 t ( any)1 179( At)1 160( from the breakpoint list, removes the breakpoint from memory and then restarts the program.)14 3884(the address)1 457 4 720 6864 t (instant the breakpoint list contains the addresses of basic blocks which have not been executed. The)15 3997 1 720 6984 t 10 CW f (analyse)4743 6984 w 10 R f (func\255)5190 6984 w ( lines of source code bounded by basic blocks whose addresses are have not been deleted from the)17 4057(tion reports the)2 623 2 720 7104 t ( performance is almost)3 999( Program)1 423( executed.)1 433( are the basic blocks which have not been)8 1881( These)1 316(breakpoint list.)1 628 6 720 7224 t cleartomark showpage saveobj restore %%EndPage: 11 11 %%Page: 12 12 /saveobj save def mark 12 pagesetup 10 R f (unaffected since each breakpoint is executed only once and then removed.)10 2961 1 720 840 t ( obvious extension of this algorithm could be used)8 2040( An)1 175( total of 128 lines of ACID code.)7 1336(The library contains a)3 879 4 970 996 t (to provide basic block profiling.)4 1285 1 720 1116 t 10 B f (16. Conclusion)1 654 1 720 1356 t 10 R f (ACID has two areas of weakness. As with other language\255based tools like)11 3010 1 970 1512 t 10 I f (awk)4010 1512 w 10 R f ( yet)1 153(, a programmer must learn)4 1076 2 4171 1512 t ( Second,)1 376( of the debugger.)3 697(another language to step beyond the normal debugging functions and use the full power)13 3607 3 720 1632 t (the command line interface supplied by the)6 1761 1 720 1752 t 10 I f (yacc)2512 1752 w 10 R f ( of the problem relates directly)5 1258( Part)1 217(parser is inordinately clumsy.)3 1200 3 2725 1752 t (to the use of)3 521 1 720 1872 t 10 I f (yacc)1275 1872 w 10 R f ( structural problems would remain:)4 1440( However,)1 449(and could be circumvented with a custom parser.)7 2020 3 1491 1872 t ( debugger should prostitute itself to its users,)7 1808( A)1 124(ACID often requires too much typing to execute a simple command.)10 2748 3 720 1992 t ( lan\255)1 186(doing whatever is wanted with a minimum of encouragement; commands should be concise and obvious. The)15 4494 2 720 2112 t ( of these problems)3 750( Most)1 261( an ad hoc command interface but is clumsy to use.)10 2094(guage interface is more consistent than)5 1575 4 720 2232 t ( under construction. This should provide the best of both worlds: graph\255)11 2886(are addressed by an Acme interface which is)7 1794 2 720 2352 t (ical debugging and access to the underlying acid language when required.)10 2946 1 720 2472 t ( variables, keywords, program variables, and functions is unavoidable.)8 2913(The namespace clash between ACID)4 1517 2 970 2628 t ( debugging session, it is annoying when it happens and is sometimes difficult to circum\255)14 3585(Although it rarely affects a)4 1095 2 720 2748 t ( current renaming scheme is too crude; the new names are too hard to remember.)14 3228(vent. The)1 402 2 720 2868 t ( its strengths,)2 563( Of)1 171( to be a powerful tool whose applications have exceeded expectations.)10 2962(ACID has proved)2 734 4 970 3024 t ( retro\255)1 254( In)1 141( the expected utility.)3 840(portability, extensibility and parallel debugging support were by design and provide)10 3445 4 720 3144 t ( and encap\255)2 461(spect, its use as a tool for code test and verification and as a medium for communicating type information)18 4219 2 720 3264 t (sulating interfaces has provided unanticipated benefits and altered our view of the debugging process.)13 4064 1 720 3384 t ( or by anonymous FTP from)5 1291(Manuals for both ACID and ALEF are available in the Plan 9 manual)12 3139 2 970 3540 t 10 CW f (research.att.com)720 3660 w 10 R f (in the directory)2 610 1 1705 3660 t 10 CW f (dist/plan9man)2340 3660 w 10 R f (.)3120 3660 w 10 B f (17. Acknowledgments)1 958 1 720 3900 t 10 R f ( Pike endured three buggy ALEF compil\255)6 1683( Rob)1 221(Bob Flandrena was the first user and helped prepare the paper.)10 2526 3 970 4056 t (ers and a new debugger in a single sitting.)8 1678 1 720 4176 t 10 B f (18. References)1 639 1 720 4416 t 10 R f ( ``Plan 9 from Bell Labs'',)5 1100([Pike90] R. Pike, D. Presotto, K. Thompson, H. Trickey,)8 2319 2 720 4572 t 10 I f (UKUUG Proc. of the Summer)4 1229 1 4171 4572 t (1990 Conf. , London, England, 1990)5 1465 1 720 4692 t 10 R f ( D. Hanson, ``DUEL \255\255 A Very High\255Level Debugging Language'',)9 2745([Gol93] M. Golan,)2 755 2 720 4848 t 10 I f (USENIX Proc. of the Winter)4 1151 1 4249 4848 t (1993 Conf. , San Diego, CA, 1993)6 1367 1 720 4968 t 10 R f ([Lin90] M. A. Linton, ``The Evolution of DBX'',)7 1984 1 720 5124 t 10 I f (USENIX Proc. of the Summer 1990 Conf. , Anaheim, CA, 1990)10 2518 1 2729 5124 t 10 R f ( Pesch, ``Using GDB: A guide to the GNU source level debugger'',)11 2714([Stal91] R. M. Stallman, R. H.)5 1223 2 720 5280 t 10 I f (Technical Report,)1 717 1 4683 5280 t (Free Software Foundation, Cambridge, MA, 1991)5 2005 1 720 5400 t 10 R f ([Win93] P. Winterbottom, ``ALEF reference Manual'',)5 2236 1 720 5556 t 10 I f ( Laboratories, Murray Hill,)3 1127(The Plan 9 Manual, AT&T Bell)5 1287 2 2986 5556 t (NJ, 1993)1 361 1 720 5676 t 10 R f ([Pike93] Rob Pike, ``Acme: A User Interface for Programmers'',)8 2708 1 720 5832 t 10 I f (USENIX Proc. of the Winter 1994 Conf. , San)8 1934 1 3466 5832 t (Francisco, CA)1 583 1 720 5952 t 10 R f ( A GNU, improved programmable)4 1414([Ols90] Ronald A. Olsson, Richard H. Crawford, and W. Wilson Ho. , ``Dalek:)12 3266 2 720 6108 t (debugger'',)720 6228 w 10 I f (USENIX Proc. of the Summer 1990 Conf. , Anaheim, CA)9 2268 1 1207 6228 t 10 R f ([May92] Paul Maybee, ``NeD: The Network Extensible Debugger'')7 2736 1 720 6384 t 10 I f ( of the Summer 1992 Conf. , San)7 1325(USENIX Proc.)1 591 2 3484 6384 t (Antonio, TX)1 484 1 720 6504 t 10 R f ([Aral] Ziya Aral, Ilya Gertner, and Greg Schaffer. , ``Efficient debugging primitives for multiprocessors'',)13 4549 1 720 6660 t 10 I f (In)5317 6660 w ( the Third International Conference on Architectural Support for Programming Languages and)11 4056(Proceedings of)1 624 2 720 6780 t (Operating Systems. , SIGPLAN notices Nr. 22, May 1989.)8 2318 1 720 6900 t 10 B f (Phil Winterbottom)1 810 1 720 7056 t 10 R f ( works in the areas of languages,)6 1323( He)1 169(is a member of technical staff at AT&T Bell Laboratories.)9 2350 3 1558 7056 t (operating systems and networks for distributed computing. He is one of the authors of Plan 9.)15 3738 1 720 7176 t cleartomark showpage saveobj restore %%EndPage: 12 12 %%Trailer done %%Pages: 12 %%DocumentFonts: Times-Bold Times-Italic Times-Roman Courier