blob: 9c065d00280aea84ae24f1d3df2e289e33f4b554 [file] [log] [blame]
machbytype, machbyname \- machine-independent access to executables and programs
.B #include <u.h>
.B #include <libc.h>
.B #include <mach.h>
void machbytype(int type)
int machbyname(char *name)
extern Mach *mach;
.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.
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
.IR mach-file (3))
and can be set explicitly by calling
.I machbyname
.IR machbytype .
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
The supported architectures are
.B 386
(Intel 32-bit x86)
386 and later)
.B power
(IBM PowerPC, typically running
Mac OS X).
Other manual pages
describe the library functions in detail.
.IR Mach-cmd (3)
describes some convenience routines for attaching to
processes and core files.
.IR Mach-file (3)
describes the manipulation of binary files.
.IR Mach-map (3)
describes the interface to address spaces and register sets
in executable files and executing programs.
.IR Mach-stack (3)
describes support for unwinding the stack.
.IR Mach-swap (3)
describes helper functions for accessing data
in a particular byte order.
.IR Mach-symbol (3)
describes the interface to debugging symbol information.
.B \*9/src/libmach
.IR mach-file (3),
.IR mach-map (3),
.IR mach-stack (3),
.IR mach-swap (3),
.IR mach-symbol (3)