Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc Intel XENIX 286 Programmers Guide (86) - Tenox.tc

09.06.2013 Views

XENIX Programming Programming Commands ad b (continued) Variables adb provides a number of variables. Named variables are set initially by adb but are not used subsequently. Numbered variables are reserved for communication as follows. 0 The last value printed. 1 The last offset part of an instruction source. 2 The previous value of variable 1. On entry, the following are set from the system header in the core file. If corefile does not appear to be a core file then these values are set from objfil: d The data segment size. e The entry point. m The execution type. n The number of segments. t The text segment size. Addresses Addresses in adb refer to either a location in a file or in actual memory. When there is no current process in memory, adb addresses are computed as file locations, and requested text and data are read from the objfil and corefile files. When there is a process, such as after a :r command, addresses are computed as actual memory locations. All text and data segments in a program have associated memory map entries. Each entry has a unique segment number. In addition, each entry has the file position of that segment's first byte and the physical size of the segment in the file. When a process is running, a segment's entry has a virtual size that defines the size of the segment in memory at the current time. This size can change during execution. When an address is given and no process is running, the file location corresponding to the address is calculated as effective-file-address = file-position + offset If a process is running, the memory location is simply the offset in the given segment. These addresses are valid if and only if 0 < = offset < = size where size is physical size for file locations and virtual size for memory locations. Otherwise, the requested address is not legal. 8-9

Programming Commands XENIX Programming ad b (continued) The initial setting of both mappings is suitable for normal a.out and core files. If either file is not of the kind expected then, for that file, file position is set to 0, and size is set to the maximum file size. In this way, the whole file can be examined with no address translation. So that adb may be used on large files, all appropriate values are kept as signed 32-bit integers. Files /dev/mem /dev/swap a. out core See Also ptrace in "System Functions" in the XENIX 286 C Library Guide a.out, core in "File Formats" in the XENIX 286 C Library Guide Diagnostics The message "adb" appears when there is no current command or format. Comments about inaccessible files, syntax errors, abnormal termination of commands, etc. may appear. Exit status is zero unless last command failed or returned nonzero status. Notes A breakpoint set at the entry point is not effective on initial entry to the program. System calls cannot be single-stepped. Local variables whose names are the same as an external variable may foul up the accessing of the external variable. B-10

<strong>XENIX</strong> Programming Programming Commands<br />

ad b (continued)<br />

Variables<br />

adb provides a number of variables. Named variables are set initially by adb but are not<br />

used subsequently. Numbered variables are reserved for communication as follows.<br />

0 The last value printed.<br />

1 The last offset part of an instruction source.<br />

2 The previous value of variable 1.<br />

On entry, the following are set from the system header in the core file. If corefile does<br />

not appear to be a core file then these values are set from objfil:<br />

d The data segment size.<br />

e The entry point.<br />

m The execution type.<br />

n The number of segments.<br />

t The text segment size.<br />

Addresses<br />

Addresses in adb refer to either a location in a file or in actual memory. When there is<br />

no current process in memory, adb addresses are computed as file locations, and<br />

requested text and data are read from the objfil and corefile files. When there is a<br />

process, such as after a :r command, addresses are computed as actual memory<br />

locations.<br />

All text and data segments in a program have associated memory map entries. Each<br />

entry has a unique segment number. In addition, each entry has the file position of that<br />

segment's first byte and the physical size of the segment in the file. When a process is<br />

running, a segment's entry has a virtual size that defines the size of the segment in<br />

memory at the current time. This size can change during execution.<br />

When an address is given and no process is running, the file location corresponding to the<br />

address is calculated as<br />

effective-file-address = file-position + offset<br />

If a process is running, the memory location is simply the offset in the given segment.<br />

These addresses are valid if and only if<br />

0 < = offset < = size<br />

where size is physical size for file locations and virtual size for memory locations.<br />

Otherwise, the requested address is not legal.<br />

8-9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!