Annotation of researchv10no/cmd/adb/comm/diffs, revision 1.1.1.1

1.1       root        1: The most important difference is that adb now uses /proc to control programs,
                      2: rather than ptrace.  The most noticeable one is that local variables work.
                      3: 
                      4: Process control:
                      5: adb uses /proc.  One thing goes away: you can't send a specific signal any
                      6: more (:s and :c).  `:c 0' still continues the process being debugged without
                      7: sending a signal; `:c' still sends the signal with which the process stopped.
                      8: `:c n' where n is nonzero does the same as `:c'.
                      9: 
                     10: If the right-hand file is a process file (/proc/something), adb recognizes
                     11: the fact, sets up mapping sensibly, and in particular figures out where the
                     12: registers are.  If the process in question is still running, of course, the
                     13: registers may change underneath you.  This will be made less severe
                     14: eventually.  It will also eventually be possible to take over such a process
                     15: (stop it, set breakpoints, &c).
                     16: 
                     17: Local variables:
                     18: When debugging programs compiled with the -g option, adb can examine local
                     19: variables, roughly as it could on the PDP-11.  For example, main.argc/X
                     20: prints 4 bytes of argc in hex from the outermost stack frame associated
                     21: with main.  $C (traceback with locals) works too.  Register variables work,
                     22: even if they're in registers; they appear to have funny addresses with a
                     23: % in front (which means they live in a funny `register' address space;
                     24: you can type the % addresses if you want, but you can't store them in a
                     25: variable and expect them to work).
                     26: 
                     27: Mapping:
                     28: No longer are there just two maps for each file; there are several, and
                     29: each is tagged with the type of thing mapped (instruction space, data
                     30: space, user block).  ? tries for instruction space; / tries for data
                     31: space; ?* (/*) tries data (instruction).  Even on the VAX, these are
                     32: different kinds of space; however, if a desired instruction space address
                     33: isn't found, data space is checked too, so things still work naturally.
                     34: If a process isn't using separate ID space (always true on the VAX),
                     35: its text segment is considered to be data space.
                     36: 
                     37: a.outs on the left-hand side, and cores and process files on the right-
                     38: hand side, are recognized and mapped accordingly.  Other kinds of files
                     39: are mapped in the time-honoured way (a single large, direct map of data).
                     40: The ?m and /m commands affect the first map; ?*m and /*m affect the
                     41: second map; what that means depends on the kind of file; in no case is
                     42: the already-set type of thing changed.  This is a foggy (and probably
                     43: buggy) area.
                     44: 
                     45: Kernel debugging:
                     46: The -k option is gone.  In its place are two commands:
                     47: address$k sets adb's idea of the system base register;
                     48:        address is a physical address, usually Sysmap
                     49: address$u sets the address of a pcb; address may be either a physical pcb
                     50:        address (as found in PCBB and masterpcbb) or the kernel virtual
                     51:        address of the page table entry for the pcb.  (The latter curious
                     52:        quantity is stored in the p_addr.)
                     53: 0$k turns off virtual address mapping; 0$u turns off mapping for user space.
                     54: $<crash will set up the registers and mapping from a standard crash dump.
                     55: 
                     56: Miscellaneous appearances:
                     57: Some attempt has been made to print things in forms that can be reused
                     58: as input.  Addresses are printed as `main+0d/' or `main+0d?' rather than
                     59: `main+d:'.  0$d turns on magic variable radix mode, like the old default
                     60: on the PDP-11: numbers are read in in hex, octal, or decimal if they begin
                     61: with #, 0, or something else; octal and hex numbers are printed with leading
                     62: 0 and # to match.
                     63: 
                     64: If you have a very old kernel, it will take adb up to 10 seconds to learn
                     65: that the process you're watching has terminated.  The recent kernel change
                     66: that broke pi doesn't affect adb, though.  I don't know why it hurts pi.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.