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 adb: Program Debugger The command displays the maps for all segments in the program using information taken from either the program and core files or directly from memory. If you have started adb but have not executed the program, the $m command display has the form Text Segments Seg # File Pos 63. 32. 71. 2080. Data Segments Seg # File Pos 39. 2736. Phys Size 2048. 656. Phys Size 242. 'sample' -File 'core' -File Each entry gives the segment num ber, file position, and physical size of a segment. The segment number is the starting address of the segment. The file position is the offset from the start of the file to the contents of the segment. The physical size is the nu mber of bytes the segment occupies in the program or core file. The file names to the right of the display are the program and core file names. If you have executed the program, the command display has the form Text Segments Seg # File Pos 63. 32. 71. 2080. Data Segments Seg # File Pos 39. 2736. Vir Size 2048. 656. Vir Size 456. 'sample' - Memory 'sample' - Memory where virtual size is the number of bytes the segment occupies in memory. This size is sometimes different than the size of the segment in the file and will often change as you execute the program. This is due to expansion of the stack or allocation of additional memory during program execution. The file names to the right always name the program file. The file position value is ignored. If you give a segment number with the command, adb displays information only about that segment. For example, the command $m 63 displays a map for segment 63 only. The display has the form Segment #= 63. Type = Text File position = 32. Physical Size = 2048. 6-23

adb: Program Debugger XENIX Programming Changing the Memory Map You can change the values of a memory map by using the ?m and /m commands. These commands assign specified values to the corresponding map entries. The commands have the form and ?m segment-number file-position size /m segment-number file-position size where segment-number gives the number of the segment map you wish to change, fileposition gives the offset in the file to the beginning of the given address, and size gives the segment size in bytes. ?m assigns values to a text segment entry and /m to a data segment entry. For example, the following command changes the file position for segment 63 in the text map to Ox2000: ?m 63 Ox2000 The command /m 39 OxO changes the file position for segment 39 in the data map to 0. Creating New Map Entries You can create new segment maps and add them to your memory map by using the ?M and /M commands. Unlike ?m and /m, these commands create a new map instead of changing an existing one. These commands have the form and ?M segment-number file-position size /M segment-number file-position size where segment-number gives the number of the segment map you wish to create, fileposition gives the offset in the file to the beginning of the given address, and size gives the segment size in bytes. ?M creates a text segment entry and /M creates a data segment entry. The segment number must be unique. You cannot create a new map entry that has the same number as an existing one. The ?M and /M commands are especially useful if you wish to access segments otherwise allocated to your program. For example, the command ?M 71 0 2504 creates a text segment entry for segment 71 with size 2504 bytes. 6-24

<strong>XENIX</strong> Programming adb: Program Debugger<br />

The command displays the maps for all segments in the program using information taken<br />

from either the program and core files or directly from memory.<br />

If you have started adb but have not executed the program, the $m command display has<br />

the form<br />

Text Segments<br />

Seg # File Pos<br />

63. 32.<br />

71. 2080.<br />

Data Segments<br />

Seg # File Pos<br />

39. 2736.<br />

Phys Size<br />

2048.<br />

656.<br />

Phys Size<br />

242.<br />

'sample' -File<br />

'core' -File<br />

Each entry gives the segment num ber, file position, and physical size of a segment. The<br />

segment number is the starting address of the segment. The file position is the offset<br />

from the start of the file to the contents of the segment. The physical size is the<br />

nu mber of bytes the segment occupies in the program or core file. The file names to<br />

the right of the display are the program and core file names.<br />

If you have executed the program, the command display has the form<br />

Text Segments<br />

Seg # File Pos<br />

63. 32.<br />

71. 2080.<br />

Data Segments<br />

Seg # File Pos<br />

39. 2736.<br />

Vir Size<br />

2048.<br />

656.<br />

Vir Size<br />

456.<br />

'sample' - Memory<br />

'sample' - Memory<br />

where virtual size is the number of bytes the segment occupies in memory. This size is<br />

sometimes different than the size of the segment in the file and will often change as<br />

you execute the program. This is due to expansion of the stack or allocation of<br />

additional memory during program execution. The file names to the right always name<br />

the program file. The file position value is ignored.<br />

If you give a segment number with the command, adb displays information only about<br />

that segment. For example, the command<br />

$m 63<br />

displays a map for segment 63 only. The display has the form<br />

Segment #= 63.<br />

Type = Text<br />

File position = 32.<br />

Physical Size = 2048.<br />

6-23

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

Saved successfully!

Ooh no, something went wrong!