mach.3 (2277B)
1 .TH MACH 3 2 .SH NAME 3 machbytype, machbyname \- machine-independent access to executables and programs 4 .SH SYNOPSIS 5 .B #include <u.h> 6 .br 7 .B #include <libc.h> 8 .br 9 .B #include <mach.h> 10 .PP 11 .PP 12 .B 13 void machbytype(int type) 14 .PP 15 .B 16 int machbyname(char *name) 17 .PP 18 .B 19 extern Mach *mach; 20 .SH DESCRIPTION 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. 31 .PP 32 An architecture is described primarily by a 33 .B Mach 34 structure, which contains 35 data structures and parameters describing the 36 particular architecture. 37 Most library functions assume that the global variable 38 .I mach 39 points at the structure for the architecture being debugged. 40 It is set implicitly by 41 .I crackhdr 42 (see 43 .MR mach-file (3) ) 44 and can be set explicitly by calling 45 .I machbyname 46 or 47 .IR machbytype . 48 .PP 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. 56 .PP 57 The supported architectures are 58 .B 386 59 (Intel 32-bit x86) 60 386 and later) 61 and 62 .B power 63 (IBM PowerPC, typically running 64 Mac OS X). 65 .PP 66 Other manual pages 67 describe the library functions in detail. 68 .PP 69 .MR Mach-cmd (3) 70 describes some convenience routines for attaching to 71 processes and core files. 72 .PP 73 .MR Mach-file (3) 74 describes the manipulation of binary files. 75 .PP 76 .MR Mach-map (3) 77 describes the interface to address spaces and register sets 78 in executable files and executing programs. 79 .PP 80 .MR Mach-stack (3) 81 describes support for unwinding the stack. 82 .PP 83 .MR Mach-swap (3) 84 describes helper functions for accessing data 85 in a particular byte order. 86 .PP 87 .MR Mach-symbol (3) 88 describes the interface to debugging symbol information. 89 .SH SOURCE 90 .B \*9/src/libmach 91 .SH "SEE ALSO 92 .MR mach-file (3) , 93 .MR mach-map (3) , 94 .MR mach-stack (3) , 95 .MR mach-swap (3) , 96 .MR mach-symbol (3)