3 crackhdr, uncrackhdr, mapfile, unmapfile, mapproc, unmapproc, 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(Fhdr *hdr, ulong base, Map *map, Regs **regs)
21 void unmapfile(Fhdr *hdr, Map *map)
23 int mapproc(int pid, Map *map, Regs **regs)
25 void unmapproc(Map *map)
27 int detachproc(int pid)
29 int ctlproc(int pid, char *msg)
31 int procnotes(int pid, char ***notes)
33 These functions parse executable files and
34 provide access to those files and to running processes.
37 opens and parses the named executable file.
38 The returned data structure
40 is initialized with a machine-independent description
41 of the header information. The following fields are the
47 structure for the target architecture
50 the name of the target architecture
53 a description of the kind of file
54 (e.g., executable, core dump)
57 a description of the application binary interface
58 this file uses; typically it is the name of an operating system
60 If the global variable
69 adds the segments found in
75 is an executable file, there are typically three segments:
82 is a dynamic shared library, its segments are relocated by
88 is a core file, there is one segment named
90 for each contiguous section of memory recorded in the core file.
91 There are often quite a few of these, as most operating systems
92 omit clean memory pages when writing core files
93 (Mac OS X is the only exception among the supported systems).
94 Because core files have such holes, it is typically necessary to
95 construct the core map by calling
97 on the executable and then calling it again on the core file.
98 Newly-added segments are mapped on top of existing segments,
99 so this arrangement will use the core file for the segments it contains
100 but fall back to the executable for the rest.
103 removes the mappings in
109 attaches to a running program and adds its segments to the given map.
110 It adds one segment for each contiguous section of
112 On systems where this information cannot be determined, it adds
113 a single segment covering the entire address space.
114 Accessing areas of this segment that are actually not mapped
115 in the process address space will cause the get/put routines to return errors.
118 removes the mappings in
123 detaches from all previously attached processes.
126 manipulates the process with id
128 according to the message
130 Valid messages include:
133 terminate the process
136 start the process and wait for it to stop
139 arrange for the process to stop at its next system call,
140 start the process, and then wait for it to stop
143 wait for the process to stop
152 with a pointer to an array of strings
153 representing pending notes waiting
155 (On Unix, these notes are textual descriptions
156 of any pending signals.)
158 returns the number of pending notes.
165 when no longer needed.