3 crackhdr, uncrackhdr, mapfile, mapproc, detachproc, ctlproc,
4 procnotes \- machine-independent access to exectuable files and running processes
13 .ta \w'\fBxxxxxx'u +\w'xxxxxx'u
14 int crackhdr(int fd, Fhdr *hdr)
16 void uncrackhdr(Fhdr *hdr)
19 int mapfile(Map *map, ulong base, Fhdr *hdr)
21 int mapproc(Map *map, int pid)
23 int detachproc(int pid)
25 int ctlproc(int pid, char *msg)
27 int procnotes(int pid, char ***notes)
29 These functions parse executable files and
30 provide access to those files and to running processes.
33 opens and parses the named executable file.
34 The returned data structure
36 is initialized with a machine-independent description
37 of the header information. The following fields are the
43 structure for the target architecture
46 the name of the target architecture
49 a description of the kind of file
50 (e.g., executable, core dump)
53 a description of the application binary interface
54 this file uses; typically it is the name of an operating system
56 If the global variable
65 adds the segments found in
71 is an executable file, there are typically three segments:
78 is a dynamic shared library, its segments are relocated by
84 is a core file, there is one segment named
86 for each contiguous section of memory recorded in the core file.
87 There are often quite a few of these, as most operating systems
88 omit clean memory pages when writing core files
89 (Mac OS X is the only exception among the supported systems).
90 Because core files have such holes, it is typically necessary to
91 construct the core map by calling
93 on the executable and then calling it again on the core file.
94 Newly-added segments are mapped on top of existing segments,
95 so this arrangement will use the core file for the segments it contains
96 but fall back to the executable for the rest.
99 attaches to a running program and adds its segments to the given map.
100 It adds one segment for each contiguous section of
102 On systems where this information cannot be determined, it adds
103 a single segment covering the entire address space.
104 Accessing areas of this segment that are actually not mapped
105 in the process address space will cause the get/put routines to return errors.
107 detaches from a previously-attached program.
110 manipulates the process with id
112 according to the message
114 Valid messages include:
117 terminate the process
120 start the process and wait for it to stop
123 arrange for the process to stop at its next system call,
124 start the process, and then wait for it to stop
127 wait for the process to stop
136 with a pointer to an array of strings
137 representing pending notes waiting
139 (On Unix, these notes are textual descriptions
140 of any pending signals.)
142 returns the number of pending notes.
147 when no longer needed.
149 .B /usr/local/plan9/src/libmach