Locations sizes


Locations & sizes

adb keeps track of the "current location," the address it last used to start a display command. This is known as "dot," since you can use a dot or period ( . ) to reference it when building up an address expression. To redisplay something, you can use dot as the address for the command. If you need to back up, you can subtract something from the value of dot. For example,

  ./X   .-4/X  

will display the contents of the current location as a hex value and set dot to the current location again, the same address. The second command says to back up four bytes and start the display there, effectively showing the value of the previous word. The value of dot will now be changed to the new starting address, or four back from where it used to be.

If you don't provide a new address, adb will continue to use the old one, the value of dot. This means you can redisplay the same data you did before, but using different formats, as shown below.

  ./XxxD   /D2X  

These commands will use the same address for each display, since no new address was provided for the second one. This will show a long hex, two short integers in hex, and a long in decimal: a total of three full words. The next command displays exactly the same three words, but as a long decimal value and two full words in hexadecimal.

If you want to advance to the next sequential location, you need to provide a specific address or use an address consisting of just a plus sign ( + ).

Along with the current address, dot, adb also keeps a record of how much data was displayed last time or the number of bytes your format commands took up. This allows the + address to work correctly. adb knows how far to advance the current address, since it knows how much data got displayed. So, to output a bunch of data and then move on, you might use a command sequence like this:

  ./4Xxx20c4DX   +/5Xxxs  

The use of + as the address allows you to keep from counting up all those sizes and calculating the correct offset from dot. Let adb do it for you!

Another adb shortcut concerns the format command string. If you don't provide one, adb uses what it had last time. To move through memory and repeat the last command, just type +/ followed by a Return. adb will move the value of dot forward and reuse the old format string. Even easier, a simple return, with no address or format, means "move forward and reuse the last display command," so you can move through memory easily, repeating the last command, just by pressing Return.

You can also use a repeat count with the command, which acts just like retyping it or pressing Return that number of times. It does move the dot forward to the last set of data displayed. For example:

  .,10/Xdd  

would advance through the core file displaying 10 sets of data in Xdd format. Here is an example that demonstrates this feature of adb .

Figure 8-1 Viewing a file via adb
 Hi, Kim...  adb my-file   0?4X  0:                  44726573        73616765        2c207768        656e2076  (Hit return here)  0x10:               69657765        64206279        20612070        6572736f  (Hit return here)  0x20:               6e207769        7468206c        6974746c        6520746f  +,5?4X  0x30:               206e6f20        6b6e6f77        6c656467        65206162                      6f75740a        74686973        20657175        65737472                      69616e20        61637469        76697479        2c207368                      6f756c64        206c6561        76652074        68652076                      69657765        72207769        74682061        2073656e  (Hit return here)  0x80:               73652074        68617420        7468650a        686f7273  (Hit return here)  0x90:               65206973        20686170        70792069        6e206869  $quit  Hi, Kim... 

Note, as shown in the above example, when Return is pressed, only the format command string is repeated and not the command count.



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net