Intel XENIX 286 Programmers Guide (86) - Tenox.tc
Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc
XENIX Programming adb: Program Debugger You can also examine all variables as a whole. For example, if you wish to see them all in hexadecimal, type str1,5/8x This command displays eight hexadecimal values on a line and continues for five lines. Since the data contains a combination of numeric and string values, it is worthwhile to display each value as both a number and a character to see where the actual strings are located. You can do this with one command by typing str1,5/4x4"' 8Cn In this case, the command displays four values in hexadecimal, then the same values as eight ASCII characters. The caret ("') is used four times just before displaying the characters to set the current address back to the starting address for that line. To make the display easier to read, you can insert a tab between the values and characters and give an address for each line by typing str1,5/4x4"'8t8Cna Debugging Program Execution adb provides a variety of commands to control the execution of programs being debugged. The following sections explain how to use these commands as well as how to display the contents of memory and registers. Note that C does not generate statement labels for programs. Thus it is not possible to refer to individual C statements when using the debugger. To use execution commands effectively, you must be familiar with the instructions generated by the C compiler and how they relate to individual C statements. One useful technique is to create an assembly language listing of your C program before using adb, then refer to the listing as you use the debugger. To create an assembly language listing, use the -S option of the cc command (see Chapter 2, "cc: C Compiler"). Executing a Program You can execute a program by using the :r or :R commands. The commands have the form address ] [,count ] : r [ arguments ] address ] [,count ] : R [ arguments ] where address gives the address at which to start execution, count is the number of breakpoints you wish to skip before one is taken, and arguments are the command line arguments, such as file names and options, you wish to pass to the program. 6-13
adb: Program Debugger XENIX Programming If no address is given, then the start of the program is used. Thus, to execute the program from the beginning, type : r If a count is given, adb will ignore all breakpoints until the given number have been encountered. For example, the command ,S:r causes adb to skip the first five breakpoints. If arguments are given, they must be separated by at least one space each. The arguments are passed to the program in the same way the system shell passes command line arguments to a program. You may use the shell redirection symbols if you wish. The :R command passes the command arguments through the shell before starting program execution. This means you can use shell metacharacters in the arguments to refer to multiple files or other input values. The shell expands arguments containing metacharacters before passing them on to the program. The command is especially useful if the program expects multiple file names. For example, the command :R [a-z]*.s passes the argument "[a-z]* .s" to the shell, where it is expanded to a list of the corresponding file names before being passed to the program. The :r and :R commands remove the contents of all registers and destroy the current stack before starting the program. This kills any previous copy of the program you may have been running. Setting Breakpoints You can set a breakpoint in a program by using the :br com mand. Breakpoints cause execution of the program to stop when it reaches the specified address. Control then returns to adb. The command has the form address [, count ] :br command where address is a valid instruction address, count is a count of the number of times you wish the breakpoint to be skipped before it causes the program to stop, and command is the adb command you wish to execute when the breakpoint is taken. 6-14
- Page 59 and 60: make: Program Maintainer XENIX Prog
- Page 61 and 62: make: Program Maintainer XENIX Prog
- Page 63 and 64: make: Program Maintainer XENIX Prog
- Page 65 and 66: make: Program Maintainer print: $(F
- Page 67 and 68: SCCS: Source Code Control System XE
- Page 69 and 70: SCCS: Source Code Control System XE
- Page 71 and 72: SCCS: Source Code Control System XE
- Page 73 and 74: SCCS: Source Code Control System XE
- Page 75 and 76: SCCS: Source Code Control System XE
- Page 77 and 78: SCCS: Source Code Control System XE
- Page 79 and 80: SCCS: Source Code Control System XE
- Page 81 and 82: SCCS: Source Code Control System XE
- Page 83 and 84: SCCS: Source Code Control System XE
- Page 85 and 86: SCCS: Source Code Control System XE
- Page 87 and 88: SCCS: Source Code Control System XE
- Page 89 and 90: SCCS: Source Code Control System XE
- Page 91 and 92: SCCS: Source Code Control System XE
- Page 93 and 94: SCCS: Source Code Control System XE
- Page 95 and 96: SCCS: Source Code Control System XE
- Page 98 and 99: CHAPTER 6 adb: PROGRAM DEBUGGER adb
- Page 100 and 101: XENIX Programming adb: Program Debu
- Page 102 and 103: XENIX Programming adb: Program Debu
- Page 104 and 105: XENIX Programming adb: Program Debu
- Page 106 and 107: XENIX Programming adb: Program Debu
- Page 108 and 109: XENIX Programming adb: Program Debu
- Page 112 and 113: XENIX Programming adb: Program Debu
- Page 114 and 115: XENIX Programming adb: Program Debu
- Page 116 and 117: XENIX Programming int fcnt,gcnt,hcn
- Page 118 and 119: XENIX Programming adb: Program Debu
- Page 120 and 121: XENIX Programming adb: Program Debu
- Page 122 and 123: XENIX Programming adb: Program Debu
- Page 124 and 125: XENIX Programming adb: Program Debu
- Page 126 and 127: XENIX Programming adb: Program Debu
- Page 128: XENIX Programming adb: Program Debu
- Page 131 and 132: as: A sse m bier XENIX Programming
- Page 133 and 134: as: Assembler XENIX Programming The
- Page 135 and 136: as: Assembler XENIX Programming Key
- Page 137 and 138: as: Assembler The combination rules
- Page 139 and 140: as: Assembler XENIX Programming Ins
- Page 141 and 142: as: Assembler Initial Value Directi
- Page 143 and 144: as: Assembler XENIX Programming int
- Page 145 and 146: as: A sse m bier sub subb test test
- Page 147 and 148: as: Assembler XENIX Programming lnt
- Page 149 and 150: as: Assembler XENIX Programming lnt
- Page 151 and 152: as: Assembler XENIX Programming Imm
- Page 153 and 154: as: A sse m bier XENIX Programming
- Page 156 and 157: CHAPTER 8 csh : C SHEll The C shell
- Page 158 and 159: XENIX Programming csh: C Shell Some
adb: Program Debugger <strong>XENIX</strong> Programming<br />
If no address is given, then the start of the program is used. Thus, to execute the<br />
program from the beginning, type<br />
: r<br />
If a count is given, adb will ignore all breakpoints until the given number have been<br />
encountered. For example, the command<br />
,S:r<br />
causes adb to skip the first five breakpoints.<br />
If arguments are given, they must be separated by at least one space each. The<br />
arguments are passed to the program in the same way the system shell passes command<br />
line arguments to a program. You may use the shell redirection symbols if you wish.<br />
The :R command passes the command arguments through the shell before starting<br />
program execution. This means you can use shell metacharacters in the arguments to<br />
refer to multiple files or other input values. The shell expands arguments containing<br />
metacharacters before passing them on to the program.<br />
The command is especially useful if the program expects multiple file names. For<br />
example, the command<br />
:R [a-z]*.s<br />
passes the argument "[a-z]* .s" to the shell, where it is expanded to a list of the<br />
corresponding file names before being passed to the program.<br />
The :r and :R commands remove the contents of all registers and destroy the current<br />
stack before starting the program. This kills any previous copy of the program you may<br />
have been running.<br />
Setting Breakpoints<br />
You can set a breakpoint in a program by using the :br com mand. Breakpoints cause<br />
execution of the program to stop when it reaches the specified address. Control then<br />
returns to adb. The command has the form<br />
address [, count ] :br command<br />
where address is a valid instruction address, count is a count of the number of times you<br />
wish the breakpoint to be skipped before it causes the program to stop, and command is<br />
the adb command you wish to execute when the breakpoint is taken.<br />
6-14