codeview(CP) 6 January 1993 codeview(CP) Name codeview - visual debugger Syntax cv [options] [executablefile [arguments]] Description Codeview is a screen-oriented debugger which operates in ``window mode'' on either serial lines or the system console. Codeview's pull-down menus and simple keystrokes offer fast access to most common commands. In addition to numerous standard debugging functions, Codeview permits you to browse source or assembly code, indicates which line will be exe- cuted next, highlights breakpoints, switches screens to display program output, watches the value of variables (local or global), offers fast breakpoints using hardware debug registers, and provides a variety of convenient ways for examining and modifying process text and data. Code- view can debug programs written in C, FORTRAN, BASIC, or Pascal as well as assembly language. Codeview can debug both COFF and x.out executable files. Codeview provides support for interpreting core files and extends full control of process signals to the user. To full take advantage of Codeview's debugging features, the executable file should be compiled and linked with the correct options for generat- ing symbolic debug and line number records (use the -g or -Zd and -Zi options when compiling with cc). The executable should at least have a standard symbol table (the executable should not be stripped). Other- wise, Codeview can only provide assembly level debugging, without symbol names. It is possible for only a portion (a single module) of the exe- cutable to be compiled with symbolic debug support. The correct options for compiling and linking for use with Codeview are described in the vol- ume titled Debugging Tools Guide. Codeview looks for default files named a.out and core in the current directory, and uses them as the executable and core files. Due to implementation changes, CodeView now starts up the child process under a vt100 emulator. As a consequence, Curses-based programs do not always behave in the same way when run under CodeView as when run independently of the debugger. Any command line parameters following the executable file name will be passed as command line arguments to the process. Once Codeview is run- ning, arguments can be reset using l (restart). Codeview takes the fol- lowing options: -c command-list Execute command-list on startup. -C corefile | - Load corefile instead of the default core in the current direc- tory. Use -C - to ignore core. -I dir Include dir in the default list of directories to be searched while looking for a source file. -r Use 80386 hardware debug registers for breakpoints set in data. -tsf Ignore statefile. Command syntax Dialog commands use the following syntax: command[arguments][;command] Dialog commands are not case sensitive. Symbol names may be case sensi- tive. Many Codeview commands take addresses or address ranges as arguments. For most commands, the following address constructs are valid: Address Constructs _________________________________________________________________________ symbol symbolname register [@]register address [segment:]offset range startaddress endaddress startaddress L count startaddress (uses a default count, usually 128) line number .[filename:]linenumber Several Codeview commands take expressions as arguments. Expressions can be complex C expressions using constants, symbols, operators, casts and function calls. Expression evaluation corresponds to that of the C com- piler including precedence and type conversions. Constants use the following syntax: Constant Syntax _________________________________________________________________________ digits default radix 0digits octal 0xdigits hexadecimal 0ndigits decimal "chars" null terminated string Registers may also be referred to directly for reference, addressing and assignment using standard names (such as ``ds,'' ``ebp,'' and ``ah''). If a symbol uses the same name as a register, the symbol name overrides the register name. In this case, the register can be specified using the ``@'' symbol (for example: @ds). The following assembly style directives can be used with register names for addressing instead of brackets: BY byte pointer (pointer to 8 bits) WO word pointer (pointer to 16 bits) DW double word pointer (pointer to 32 bits) For example, DW esi+ebp+6 is equivalent to DWORD PTR [esi][ebp+6]. If CodeView is running on the system console, these keys, in conjunction with other keys, provide access to CodeView functions. To access the <Alt>, <Shift>, and <Ctrl> key functions while running CodeView on a serial line, pseudo tty, Xterm, or scoterm, use the following equivalent combinations: _________________________________________________________________________ For Use _________________________________________________________________________ <Alt>Key <Ctrl>A followed by Key <Shift>Key <Ctrl>Z followed by Key <Ctrl>Key <Ctrl>B followed by Key <Ctrl><Shift>Key <Ctrl>B<Ctrl>Z followed by Key Pull Down Menus _________________________________________________________________________ File Open Source... Opens a source file Open Module... Opens a module from a module group Print... Prints a file Unix Shell Forks a child shell Exit Returns to operating system Edit Undo <Alt>+<Bksp> Undoes most recent edit Copy <Ctrl>+<Ins> Copies selected text to Clipboard Paste <Shift>+<Ins> Inserts text from Clipboard View Source Opens a new source window Memory Opens a new memory window Register <F2> Toggles register window 8087 Toggles 8087 window Local Toggles local window Watch Toggles watch window Command Toggles command window Help Toggles help window Output <F4> Displays program output Maximize <Ctrl>+<F10> Toggles current window to full size Size <Ctrl>+<F8> Resizes current window Close <Ctrl>+<F4> Closes current window Search Find... Searches for expression Selected Text <Ctrl>+ Searches for selected text Repeat Last Find <Alt>+/ Repeats last Find command Label/Function... Searches for label or function Run Restart Reloads program into memory Animate Traces code, highlighting lines Set Runtime Arguments... Sets command-line arguments Watch Add Watch... <Ctrl>+W Sets watch expression Delete Watch... <Ctrl>+U Removes watch expression Set Breakpoint... <F9> Sets breakpoints Edit Breakpoints... Edits/removes breakpoints Quick Watch... <Shift>+<F9> Evaluates expression Options Source Window... Source-window display Memory Window... Memory-window display Trace Speed... Program-animation speed Language... Expression evaluation language Screen Swap Screen flipping/swapping Ignore Signals Ignore signals from the child Emulator Scroll VT100 emulator for child scrolls Case Sensitivity Case sensitivity of symbols Calls Stack Backtrace Misc Next Window <F6> Next window Previous Window <Shift>+<F6> Previous window Execute to Cursor <F7> Execute to cursor Memory Mode <Shift>+<F3> Memory-window display mode Help Index Alphabetic index of topics Contents <Shift>+<F1> Table of contents Topic <F1> Help on specific topic Help On Help Help on using the help system In full screen mode, function keys perform the following operations: <F1> Help <F2> Toggle register window <F3> Switch between source, assembly and mixed mode <F4> Toggle between Codeview screen and application output <F5> Go <F6> Switch to next window <F7> Go to cursored line <F8> Trace (for example, into functions) <F9> Toggle breakpoint at cursored line <F10> Step (for example, over functions) Code display The following table lists the commands that are used to view code: Code Display _________________________________________________________________________ set source mode s [+|-|&] + C source - assembly & mixed with no operand, displays current mode view source v [address] search for regular expression /regular expression Move in the current window <PgUp>, <PgDn> arrow keys <Home>, <End> unassemble code U [address | range] Data display The following commands display data: ?expression[,format] This table lists the valid format specifiers: Format Specifiers _________________________________________________________________________ d,i signed decimal integer (16 bit) u unsigned decimal integer (16 bit) o unsigned octal integer (16 bit) x,X unsigned hexadecimal integer (16 bit) f floating point e,E scientific notation floating point g,G scientific notation floating point c character s null terminated string h used with d,o,u,x and X. Example: ,hd (short) (16 bit) l used with d,o,u,x and X. Example: ,ld (long) (32 bit) ??expression The following special keystrokes are recognized: <Return> de-reference current object <Esc> return to dialog line r [register] This causes a register dump; without a register name, it shows all registers and disassembles the current instruction at cs:ip. 7 Math co-processor register dump. Variable and memory assignment Use the following commands to assign values to variables or registers: ?expression = expression Left expression must evaluate to an value. r register [value] Assign value to indicated register. If value is omitted, prompt for a new value. Special commands The D (Dump) command displays memory contents, and uses this syntax: D[type] [address|range] The following types are recognized: A ASCII characters B bytes D four-byte words, hexadecimal I two-byte integers J four-byte integers L eight-byte long reals S four-byte short reals T ten-byte reals U unsigned two-byte integers V unsigned four-byte integers W two-byte words, hexadecimal The C (Compare) command compares two memory regions and lists the differ- ences. Use this syntax: C range1 address2 The S (Search) command searches a memory range for a pattern, and lists the occurrences of the pattern. Use this syntax: S range list The E (Enter) command modifies memory contents, and uses this syntax: E [type] address [list] The F (Fill) command sets memory contents to and iterated pattern, and uses this syntax: F range list The M (Move) command copies memory contents from one region to another, and uses this syntax: M range1 address2 The A (Assemble) modifies a text range using a dynamic assembler. This is the syntax: A [address] Execution control The following commands control program execution: g [address] Resume execution (go). If provided, go to address. t [count] Trace; single-step; step into function on function call. p [count] Program; single-step; step over function calls (for example, atomic). e ``Slow motion'' execute. l [args] Restart (load). Uses command line arguments if specified. Obeys sh(C) quoting conventions. sig [signo] Set pending signal; signal will take effect when execution is resumed with g, t or p. Without signo, display currently pending signal. k Stack trace. bp [address [,passcount] [,commands]] set a breakpoint bc [list | * ] clear breakpoint(s) bl list breakpoints be [list | * ] enable breakpoint(s) bd [list | * ] disable breakpoint(s) Watch Expressions _________________________________________________________________________ w? expression[,format] watch expression w watch list y [list | *] watch delete Redirection commands < filename Re-direct Codeview input from filename. [T] filename Re-direct Codeview output to filename. Optional argument T echoes output to Codeview screen as well as filename. = filename Re-direct input and output. *comment Echo comment text to Codeview screen. : Delay execution of commands by approximately 1/2 second. '' Pause until keystroke. Miscellaneous commands q exit Codeview ![shell command(s)] shell escape @ redraw Codeview screen h help <Esc> clear command line; cancel menu command n[radix] set default input/output radix (8, 10 or 16) with no argu- ment, shows current default radix o[b|c|f][+|-] turn on or off or display current status of the following: b - bytes coded c - case sensitivity f - flip/swap (for example, save output) \ screen exchange; switch to output screen #number tab set; specify width for tab to space expansion Key bindings by key Keys Function _________________________________________________________________________ ! Shell escape " Pause # Tab set * Comment . Current location / Search 7 Display 8087 registers : Delay < Command window input redirection = Command window redirection reset > Command window output redirection ? Display expression ?? Quick watch @ Redraw A Assemble <Alt>-* Show menu corresponding to first letter <Alt>-/ Repeat last find <Alt>-<Bksp> Undo last edit operation <Alt>-<Ctrl>-F* Virtual screen switch <Alt>-<F1> Previous help screen BC Breakpoint clear BD Breakpoint disable BE Breakpoint enable <Bksp> Delete character to left of cursor BL Breakpoint list BP Breakpoint set C Compare memory <Ctrl>-A Cursor word left <Ctrl>-D Cursor character right <Ctrl>-<DOWN> Scroll line down <Ctrl>-<End> Cursor EOF <Ctrl>-F Cursor word right <Ctrl>-<F1> Next help topic <Ctrl>-<F10> Maximize window <Ctrl>-<F4> Close window <Ctrl>-<F8> Resize window <Ctrl>-G Delete character at cursor <Ctrl>-H Delete character to left of cursor <Ctrl>-<Home> Cursor BOF <Ctrl>-<Ins> Copy to clipboard <Ctrl>-<LEFT> Cursor word left <Ctrl>-<PgDn> Scroll page right <Ctrl>-<PgUp> Scroll page left <Ctrl>-<RIGHT> Cursor word right <Ctrl>-<Shift>-<End> Select to EOF <Ctrl>-<Shift>-<F1> Previous help topic <Ctrl>-<Shift>-<Home> Select to BOF <Ctrl>-<Shift>-<LEFT> Select word to left <Ctrl>-<Shift>-<RIGHT> Select word to right <Ctrl>-T Delete rest of word on cursor <Ctrl>-U Delete watch expression <Ctrl>-<UP> Scroll line up <Ctrl>-V Toggle keyboard insertion mode <Ctrl>-W Add watch expression <Ctrl>-X Cursor line down <Ctrl>-\ Find selected text D Dump memory <Del> Delete character at cursor <DOWN> Cursor line down E Enter memory E Execute <End> Cursor EOL F Fill memory <F1> Help <F2> Toggle register window <F3> Toggle source window display modes <F4> Toggle output and CV screen <F5> Run <F6> Next window <F7> Execute to cursor <F8> Trace into <F9> Toggle breakpoint <F10> Step over G Go H Help <Home> Cursor BOL I Port input <Ins> Toggle keyboard insertion mode K Stack trace L Load <LEFT> Cursor character left M Move memory N Radix O Option set/display O Port output P Program step <PgDn> Scroll page down <PgUp> Scroll page up Q Quit R Register <RIGHT> Cursor character right S Search memory S Source display mode <Shift>-<DOWN> Select current line <Shift>-<F1> Contents <Shift>-<F10> Next history <Shift>-<F3> Toggle memory window display modes <Shift>-<F6> Previous window <Shift>-<F8> Previous history <Shift>-<F9> Open QuickWatch window for a variable <Shift>-<Ins> Insert from clipboard <Shift>-<LEFT> Select character to left <Shift>-<PgDn> Select screen following <Shift>-<PgUp> Select screen previous <Shift>-<RIGHT> Select character to right <Shift>-<Tab> Move to previous command <Shift>-<UP> Select previous line T Command window tee redirection T Trace <Tab> Move to next command U Unassemble <UP> Cursor line up V View source lines W List watch W? Add watch Key bindings by function Function Keys _________________________________________________________________________ Add watch expression <Ctrl>-W Add watch W? Assemble A Breakpoint clear BC Breakpoint disable BD Breakpoint enable BE Breakpoint list BL Breakpoint set BP Close window <Ctrl>-<F4> Command window input redirection < Command window redirection reset = Command window output redirection > Command window tee redirection T Comment * Compare memory C Contents <Shift>-<F1> Copy to clipboard <Ctrl>-<Ins> Current location . Cursor word left <Ctrl>-A Cursor character right <Ctrl>-D Cursor EOF <Ctrl>-<End> Cursor word right <Ctrl>-F Cursor BOF <Ctrl>-<Home> Cursor word left <Ctrl>-<LEFT> Cursor word right <Ctrl>-<RIGHT> Cursor line down <Ctrl>-X Cursor line down <DOWN> Cursor EOL <End> Cursor BOL <Home> Cursor character left <LEFT> Cursor character right <RIGHT> Cursor line up <UP> Delay : Delete character to left of cursor <Bksp> Delete character at cursor <Ctrl>-G Delete character to left of cursor <Ctrl>-H Delete rest of word on cursor <Ctrl>-T Delete watch expression <Ctrl>-U Delete character at cursor <Del> Display 8087 registers 7 Display expression ? Dump memory D Enter memory E Examine symbols X Execute E Execute to cursor <F7> Fill memory F Find selected text <Ctrl>-\ Go G Help <F1> Help H Insert from clipboard <Shift>-<Ins> List watch W Load L Maximize window <Ctrl>-<F10> Move memory M Move to previous command <Shift>-<Tab> Move to next command <Tab> Next help topic <Ctrl>-<F1> Next window <F6> Next history <Shift>-<F10> Open QuickWatch window for a variable <Shift>-<F9> Option set/display O Pause " Port input I Port output O Previous help screen <Alt>-<F1> Previous help topic <Ctrl>-<Shift>-<F1> Previous window <Shift>-<F6> Previous history <Shift>-<F8> Program step P Quick watch ?? Quit Q Radix N Redraw @ Register R Repeat last find <Alt>-/ Resize window <Ctrl>-<F8> Run <F5> Screen exchange \ Scroll line down <Ctrl>-<DOWN> Scroll page right <Ctrl>-<PgDn> Scroll page left <Ctrl>-<PgUp> Scroll line up <Ctrl>-<UP> Scroll page down <PgDn> Scroll page up <PgUp> Search / Search memory S Select to EOF <Ctrl>-<Shift>-<End> Select to BOF <Ctrl>-<Shift>-<Home> Select word to left <Ctrl>-<Shift>-<LEFT> Select word to right <Ctrl>-<Shift>-<RIGHT> Select current line <Shift>-<DOWN> Select character to left <Shift>-<LEFT> Select screen following <Shift>-<PgDn> Select screen previous <Shift>-<PgUp> Select character to right <Shift>-<RIGHT> Select previous line <Shift>-<UP> Shell escape ! Show menu corresponding to first letter <Alt>-* Source display mode S Stack trace K Step over <F10> Tab set # Toggle keyboard insertion mode <Ctrl>-V Toggle register window <F2> Toggle source window display modes <F3> Toggle output and CV screen <F4> Toggle breakpoint <F9> Toggle keyboard insertion mode <Ins> Toggle memory window display modes <Shift>-<F3> Trace into <F8> Trace T Unassemble U Undo last edit operation <Alt>-<Bksp> View source lines V Virtual screen switch <Alt>-<Ctrl>-F* Yank watch Y Files a.out core /usr/bin/cvtcoff /usr/lib/codeview/cv.hlp /usr/lib/codeview/pwb.hlp Notes Codeview executes transparently on either COFF or x.out binaries. The symbolic debug records from COFF binaries are translated to corresponding x.out format at startup using cvtcoff. This converter must be installed for debugging COFF binaries. Standards conformance Codeview is an extension of AT&T System V provided by the Santa Cruz Operation. See also a.out(FP), adb(CP), cc(CP), core(F), ld(CP), sdb(CP), sh(C), syms(FP)