adb checks each address to ensure it is valid. To validate the address, adb uses the segment number, file position, and size values in each map entry. If an address is correct, adb carries out the command; otherwise, it displays an error message.
The first step adb takes when validating an address is to check the segment value to make sure it belongs to the appropriate map. Segments used with the ? command must appear in the text segments map; segments used with the / command must appear in the data segments map. If the value does not belong to the map, adb displays a bad segment error.
The next step is to check the offset to see if it is in range. The offset must be within the following range:
0 <= offset <= segment-sizeIf it is not in this range, adb displays a bad address error.
If adb is currently accessing memory, the validating segment and offset are used to access a memory location and no other processing takes place. If adb is accessing files, it computes an effective file address like the following, then uses this effective address to read from the corresponding file:
effective-file-address = offset + file-position