rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 1 | .TH MACH 3 |
| 2 | .SH NAME |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 3 | machbytype, machbyname \- machine-independent access to executables and programs |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 4 | .SH SYNOPSIS |
| 5 | .B #include <u.h> |
| 6 | .br |
| 7 | .B #include <libc.h> |
| 8 | .br |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 9 | .B #include <mach.h> |
| 10 | .PP |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 11 | .PP |
| 12 | .B |
| 13 | void machbytype(int type) |
| 14 | .PP |
| 15 | .B |
| 16 | int machbyname(char *name) |
| 17 | .PP |
| 18 | .B |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 19 | extern Mach *mach; |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 20 | .SH DESCRIPTION |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 21 | .I Libmach |
| 22 | provides an interface for accessing |
| 23 | the executable files and executing images of various architectures |
| 24 | and operating systems. |
| 25 | The interface is machine-independent, meaning that, for example, |
| 26 | Mac OS X core dumps may be inspected using an x86 Linux machine |
| 27 | and vice versa. |
| 28 | In its current form, |
| 29 | the library is mainly useful for writing debuggers |
| 30 | of one sort or another. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 31 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 32 | An architecture is described primarily by a |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 33 | .B Mach |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 34 | structure, which contains |
| 35 | data structures and parameters describing the |
| 36 | particular architecture. |
| 37 | Most library functions assume that the global variable |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 38 | .I mach |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 39 | points at the structure for the architecture being debugged. |
| 40 | It is set implicitly by |
| 41 | .I crackhdr |
| 42 | (see |
| 43 | .IR mach-file (3)) |
| 44 | and can be set explicitly by calling |
| 45 | .I machbyname |
| 46 | or |
| 47 | .IR machbytype . |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 48 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 49 | There is no operating system-specific structure akin to |
| 50 | .IR mach . |
| 51 | Typically the choice of operating system on a particular |
| 52 | architecture affects only the executable and core dump formats; |
| 53 | the various file parsers deduce the operating system from |
| 54 | information in the binary files themselves and adjust |
| 55 | accordingly. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 56 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 57 | Other manual pages |
| 58 | describe the library functions in detail. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 59 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 60 | .I Mach-file (3) |
| 61 | describes the manipulation of binary files. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 62 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 63 | .I Mach-map (3) |
| 64 | describes the interface to address spaces and register sets |
| 65 | in executable files and executing programs. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 66 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 67 | .I Mach-stack (3) |
| 68 | describes support for unwinding the stack. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 69 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 70 | .I Mach-swap (3) |
| 71 | describes helper functions for accessing data |
| 72 | in a particular byte order. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 73 | .PP |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 74 | .I Mach-symbol (3) |
| 75 | describes the interface to debugging symbol information. |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 76 | .SH SOURCE |
rsc | b5fdffe | 2004-04-19 19:22:56 +0000 | [diff] [blame] | 77 | .B /usr/local/plan9/src/libmach |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 78 | .SH "SEE ALSO |
| 79 | .IR mach-file (3), |
| 80 | .IR mach-map (3), |
| 81 | .IR mach-stack (3), |
| 82 | .IR mach-swap (3), |
| 83 | .IR mach-symbol (3) |