"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "platform/freebsd/freebsd_ptrace.c" between
reptyr-reptyr-0.7.0.tar.gz and reptyr-reptyr-0.8.0.tar.gz

About: reptyr is a utility for taking an existing running program and attaching it to a new terminal.

freebsd_ptrace.c  (reptyr-reptyr-0.7.0):freebsd_ptrace.c  (reptyr-reptyr-0.8.0)
skipping to change at line 220 skipping to change at line 220
if (err < 0) if (err < 0)
return err; return err;
return arch_restore_syscall(child); return arch_restore_syscall(child);
} }
unsigned long ptrace_remote_syscall(struct ptrace_child *child, unsigned long ptrace_remote_syscall(struct ptrace_child *child,
unsigned long sysno, unsigned long sysno,
unsigned long p0, unsigned long p1, unsigned long p0, unsigned long p1,
unsigned long p2, unsigned long p3, unsigned long p2, unsigned long p3,
unsigned long p4, unsigned long p5) { unsigned long p4, unsigned long p5) {
#ifdef PT_GET_SC_RET
struct ptrace_sc_ret psr;
#endif
unsigned long rv; unsigned long rv;
if (ptrace_advance_to_state(child, ptrace_at_syscall) < 0) if (ptrace_advance_to_state(child, ptrace_at_syscall) < 0)
return -1; return -1;
#define setreg(r, v) arch_set_register(child,personality(child)->r,v) #define setreg(r, v) arch_set_register(child,personality(child)->r,v)
//if (arch_set_syscall(child, sysno) < 0) //if (arch_set_syscall(child, sysno) < 0)
//return -1; //return -1;
setreg(syscall_rv, sysno); setreg(syscall_rv, sysno);
setreg(syscall_arg0, p0); setreg(syscall_arg0, p0);
setreg(syscall_arg1, p1); setreg(syscall_arg1, p1);
setreg(syscall_arg2, p2); setreg(syscall_arg2, p2);
setreg(syscall_arg3, p3); setreg(syscall_arg3, p3);
setreg(syscall_arg4, p4); setreg(syscall_arg4, p4);
setreg(syscall_arg5, p5); setreg(syscall_arg5, p5);
if (ptrace_advance_to_state(child, ptrace_after_syscall) < 0) if (ptrace_advance_to_state(child, ptrace_after_syscall) < 0)
return -1; return -1;
#ifndef PT_GET_SC_RET
/*
* In case of an error, this is technically incorrect. FreeBSD, on most
* architectures, stores the return value in this register as expected and
* sets a separate bit to indicate if this an error or not -- contrary to
* the Linux convention of negative values indicating an error, positive
* values otherwise. This should switch to PT_GET_SC_RET unconditionally
* as it makes its way into all supported releases.
*/
rv = arch_get_register(child, personality(child)->syscall_rv); rv = arch_get_register(child, personality(child)->syscall_rv);
if (child->error) if (child->error)
return -1; return -1;
#else
if (ptrace_command(child, PT_GET_SC_RET, &psr, sizeof(psr)) < 0)
return -1;
if (psr.sr_error != 0)
rv = -psr.sr_error;
else
rv = psr.sr_retval[0];
#endif
setreg(reg_ip, *(unsigned long*)((void*)&child->regs + setreg(reg_ip, *(unsigned long*)((void*)&child->regs +
personality(child)->reg_ip)); personality(child)->reg_ip));
#undef setreg #undef setreg
return rv; return rv;
} }
int ptrace_memcpy_to_child(struct ptrace_child *child, child_addr_t dst, const v oid *src, size_t n) { int ptrace_memcpy_to_child(struct ptrace_child *child, child_addr_t dst, const v oid *src, size_t n) {
int scratch; int scratch;
 End of changes. 5 change blocks. 
0 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)