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