MACH(3) MACH(3) NAME machbytype, machbyname - machine-independent access to executables and programs SYNOPSIS #include <u.h> #include <libc.h> #include <mach.h> void machbytype(int type) int machbyname(char *name) extern Mach *mach; DESCRIPTION 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 Mach structure, which contains data structures and parameters describing the particular architecture. Most library functions assume that the global variable mach points at the structure for the architecture being debugged. It is set implicitly by crackhdr (see mach-file(3)) and can be set explicitly by calling machbyname or machbytype. There is no operating system-specific structure akin to mach. Typically the choice of operating system on a particu- lar architecture affects only the executable and core dump formats; the various file parsers deduce the operating sys- tem from information in the binary files themselves and adjust accordingly. The supported architectures are 386 (Intel 32-bit x86) 386 and later) and power (IBM PowerPC, typically running Mac OS X). Other manual pages describe the library functions in detail. Mach-cmd(3) describes some convenience routines for attach- ing to processes and core files. Mach-file(3) describes the manipulation of binary files. Page 1 Plan 9 (printed 11/18/24) MACH(3) MACH(3) Mach-map(3) describes the interface to address spaces and register sets in executable files and executing programs. Mach-stack(3) describes support for unwinding the stack. Mach-swap(3) describes helper functions for accessing data in a particular byte order. Mach-symbol(3) describes the interface to debugging symbol information. SOURCE /usr/local/plan9/src/libmach SEE ALSO mach-file(3), mach-map(3), mach-stack(3), mach-swap(3), mach-symbol(3) Page 2 Plan 9 (printed 11/18/24)