cei@ipvvis.unipv.it (Ugo Cei) (04/19/91)
I am having problems with the ptrace(2) syscall under SunOS 4.0.3. What I am trying to do is to read the address space of a program that is run under a debugger (gdb) from a program that is the parent of the debugger. My program runs the debugger, then queries it to get the pid of the debugged program and the address of a variable. At some point it calls ptrace(PTRACE_ATTACH, pid, 0, 0, 0); to start tracing the "grandchild" process. This calls exits with an error of "not owner". I have also tried to call ptrace(PTRACE_READDATA, pid, address, size, dest); without trying to attach the grandchild process, but I get a "no such process" error. TFM says that "... process does not have to be a child of the requestor ...", but maybe there is some problem when the process to be traced is already being traced by another process (gdb in my case). Is there any way to circumvent these problems ? If not, how could I accomplish the same thing (reading the address space of a program being run under a debugger) without hacking the debugger source ? Since I need this fairly quickly, even an ugly hack would do for the moment. Please, don't suggest to instruct gdb to print out the data then to read it from a pipe: I need to read very large arrays and this method, although working, is far too slow. aTdHvAaNnKcSe -- Ugo Cei - Dipartimento Informatica e Sistemistica Via Abbiategrasso 209 - 27100 Pavia - ITALY +39 382 391.372 Internet: cei@ipvvis.unipv.it --