Blob


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 .IR 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 Other manual pages
58 describe the library functions in detail.
59 .PP
60 .I Mach-file (3)
61 describes the manipulation of binary files.
62 .PP
63 .I Mach-map (3)
64 describes the interface to address spaces and register sets
65 in executable files and executing programs.
66 .PP
67 .I Mach-stack (3)
68 describes support for unwinding the stack.
69 .PP
70 .I Mach-swap (3)
71 describes helper functions for accessing data
72 in a particular byte order.
73 .PP
74 .I Mach-symbol (3)
75 describes the interface to debugging symbol information.
76 .SH SOURCE
77 .B /usr/local/plan9/src/libmach
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)