blob: 389185232ad404634e4a4ff0cc05e8d457743783 [file] [log] [blame]
rsccfa37a72004-04-10 18:53:55 +00001.TH MACH 3
2.SH NAME
rscbf8a59f2004-04-11 03:42:27 +00003machbytype, machbyname \- machine-independent access to executables and programs
rsccfa37a72004-04-10 18:53:55 +00004.SH SYNOPSIS
5.B #include <u.h>
6.br
7.B #include <libc.h>
8.br
rsccfa37a72004-04-10 18:53:55 +00009.B #include <mach.h>
10.PP
rsccfa37a72004-04-10 18:53:55 +000011.PP
12.B
13void machbytype(int type)
14.PP
15.B
16int machbyname(char *name)
17.PP
18.B
rscbf8a59f2004-04-11 03:42:27 +000019extern Mach *mach;
rsccfa37a72004-04-10 18:53:55 +000020.SH DESCRIPTION
rscbf8a59f2004-04-11 03:42:27 +000021.I Libmach
22provides an interface for accessing
23the executable files and executing images of various architectures
24and operating systems.
25The interface is machine-independent, meaning that, for example,
26Mac OS X core dumps may be inspected using an x86 Linux machine
27and vice versa.
28In its current form,
29the library is mainly useful for writing debuggers
30of one sort or another.
rsccfa37a72004-04-10 18:53:55 +000031.PP
rscbf8a59f2004-04-11 03:42:27 +000032An architecture is described primarily by a
rsccfa37a72004-04-10 18:53:55 +000033.B Mach
rscbf8a59f2004-04-11 03:42:27 +000034structure, which contains
35data structures and parameters describing the
36particular architecture.
37Most library functions assume that the global variable
rsccfa37a72004-04-10 18:53:55 +000038.I mach
rscbf8a59f2004-04-11 03:42:27 +000039points at the structure for the architecture being debugged.
40It is set implicitly by
41.I crackhdr
42(see
43.IR mach-file (3))
44and can be set explicitly by calling
45.I machbyname
46or
47.IR machbytype .
rsccfa37a72004-04-10 18:53:55 +000048.PP
rscbf8a59f2004-04-11 03:42:27 +000049There is no operating system-specific structure akin to
50.IR mach .
51Typically the choice of operating system on a particular
52architecture affects only the executable and core dump formats;
53the various file parsers deduce the operating system from
54information in the binary files themselves and adjust
55accordingly.
rsccfa37a72004-04-10 18:53:55 +000056.PP
rscbf8a59f2004-04-11 03:42:27 +000057Other manual pages
58describe the library functions in detail.
rsccfa37a72004-04-10 18:53:55 +000059.PP
rscbf8a59f2004-04-11 03:42:27 +000060.I Mach-file (3)
61describes the manipulation of binary files.
rsccfa37a72004-04-10 18:53:55 +000062.PP
rscbf8a59f2004-04-11 03:42:27 +000063.I Mach-map (3)
64describes the interface to address spaces and register sets
65in executable files and executing programs.
rsccfa37a72004-04-10 18:53:55 +000066.PP
rscbf8a59f2004-04-11 03:42:27 +000067.I Mach-stack (3)
68describes support for unwinding the stack.
rsccfa37a72004-04-10 18:53:55 +000069.PP
rscbf8a59f2004-04-11 03:42:27 +000070.I Mach-swap (3)
71describes helper functions for accessing data
72in a particular byte order.
rsccfa37a72004-04-10 18:53:55 +000073.PP
rscbf8a59f2004-04-11 03:42:27 +000074.I Mach-symbol (3)
75describes the interface to debugging symbol information.
rsccfa37a72004-04-10 18:53:55 +000076.SH SOURCE
rscb5fdffe2004-04-19 19:22:56 +000077.B /usr/local/plan9/src/libmach
rscbf8a59f2004-04-11 03:42:27 +000078.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)