|
NAMEattachargs, attachcore, attachdynamic, attachproc, proctextfile - debugging processes and core filesSYNOPSIS#include <u.h>#include <libc.h> #include <mach.h> int attachcore(Fhdr *hdr) int attachproc(int pid) int attachdynamic(void) char* proctextfile(int pid) int attachargs(int argc, char **argv, int omode) extern Fhdr* symhdr; extern char* symfil; extern Map* symmap; extern Fhdr* fhdrlist; extern Fhdr* corhdr; extern char* corfil; extern Map* cormap; extern int corpid; extern Regs* correg; DESCRIPTIONThese routines provide access to the objects a typical debugger manipulates: an executable binary, some number of shared libraries, a memory image in the form of a core dump or active process, and a register set.The maintained state is:
Attachcore and attachproc attach to an opened core file or an executing process. They set corhdr, corfil, cormap, corpid, and correg. Proctextfile returns the name of the main binary for the process with id pid. Attachdynamic requires that the memory image already be attached. It reads the dynamic linker's internal run-time data structures and then opens all the dynamic objects that are currently loaded. Attachargs uses all of these functions while parsing an argument vector as would be passed to a debugger like or It expects a list of executable files, core dump files, or process ids, given in any order. If extra arguments are given (for example, more than one executable, or both a core dump and a process id), they are ignored and diagnostics are printed to standard error. If arguments are missing (for example, the process id is given without an executable file), attachargs fills them in as best it can. SOURCE/src/libmachSEE ALSOBUGSThe interface needs to be changed to support multiple threads, each with its own register set. Visit the GSP FreeBSD Man Page Interface. |