Intel XENIX 286 Programmers Guide (86) - Tenox.tc
Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc
CHAPTER 6 adb: PROGRAM DEBUGGER adb is a debugging tool for C and assembly language programs. It controls program execution and provides commands to examine and modify a program's data and text areas. This chapter explains how to use adb. In particular, it explains how to • Start the debugger. • Display program instructions and data. • Run, set breakpoints, or single-step a program. • Patch program files and memory. It also illustrates techniques for debugging C programs and explains how to display information in non-ASCII data files. Starting and Stopping adb adb provides a powerful set of commands to examine, debug, and repair executable binary files as well as examine non-ASCII data files. To use these commands you must invoke adb from a shell command line and specify the file or files you wish to debug. The following sections explain how to start adb and describe the types of files available for debugging. Starting with a Program File You can debug any executable C or assembly language program file by typing a command line of the form adb [filename 1 where filename is the name of the program file to be debugged. adb opens the file and prepares its text (instructions) and data for subsequent debugging. For example, the command adb sample prepares the program sample for examination and execution. 6-1
adb: Program Debugger XENIX Programming Once started, adb normally prompts with an asterisk (*) and waits for you to type commands. If you have given the name of a file that does not exist or is in the wrong format, adb will display an error message first, then wait for commands. For example, if you invoke adb with the command adb sample and the file sample does not exist, adb displays the message "adb: cannot open 'sample' " · You may also start adb without a file name. In this case, adb searches for the default file a.out in your current working directory and prepares it for debugging. Thus, the command a db is the same as typing adb a.out adb displays an error message and waits for a com mand if the a.out file does not exist. Sta rting with a Core Image File adb can also examine the core image files of programs that caused fatal system errors. Core image files contain the contents of the CPU registers, stack, and memory areas of the program at the time of the error and provide a way to determine the cause of an error. To examine a core image file with its corresponding program, you must give the name of both the core file and the program file. The command line has the form adb programfile corefile where programfile is the program that caused the error, and corefile is the core image file generated by the system. adb then uses information from both files to provide responses to your commands. If you do not give a core image file, adb searches for the default core file, named core, in your current working directory. If it is found, adb uses it regardless of whether or not the file belongs to the given program. You can prevent adb from opening this file by using the hyphen (-) in place of the core file name. For example, the command adb sample - prevents adb from searching your current working directory for a core file. 6-2
- Page 47 and 48: lint: C Program Checker XENIX Progr
- Page 49 and 50: lint: C Program Checker XENIX Progr
- Page 51 and 52: lint: C Program Checker XENIX Progr
- Page 53 and 54: make: Program Maintainer XENIX Prog
- Page 55 and 56: make: Program Maintainer XENIX Prog
- Page 57 and 58: make: Program Maintainer XENIX Prog
- 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 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 110 and 111: 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
CHAPTER 6<br />
adb: PROGRAM DEBUGGER<br />
adb is a debugging tool for C and assembly language programs. It controls program<br />
execution and provides commands to examine and modify a program's data and text<br />
areas.<br />
This chapter explains how to use adb. In particular, it explains how to<br />
• Start the debugger.<br />
• Display program instructions and data.<br />
• Run, set breakpoints, or single-step a program.<br />
• Pa<strong>tc</strong>h program files and memory.<br />
It also illustrates techniques for debugging C programs and explains how to display<br />
information in non-ASCII data files.<br />
Starting and Stopping adb<br />
adb provides a powerful set of commands to examine, debug, and repair executable<br />
binary files as well as examine non-ASCII data files. To use these commands you must<br />
invoke adb from a shell command line and specify the file or files you wish to debug.<br />
The following sections explain how to start adb and describe the types of files available<br />
for debugging.<br />
Starting with a Program File<br />
You can debug any executable C or assembly language program file by typing a<br />
command line of the form<br />
adb [filename 1<br />
where filename is the name of the program file to be debugged. adb opens the file and<br />
prepares its text (instructions) and data for subsequent debugging. For example, the<br />
command<br />
adb sample<br />
prepares the program sample for examination and execution.<br />
6-1