Date: Thu, 10 Aug 2006 01:35:55 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 103544 for review Message-ID: <200608100135.k7A1ZtSc037436@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=103544 Change 103544 by marcel@marcel_nfs on 2006/08/10 01:35:24 Use defaults when sv_reg, sv_fpreg and/or sv_dbreg are NULL pointers. This allows most struct sysentvec definitions to leave these undefined. Affected files ... .. //depot/projects/gdb/sys/kern/sys_process.c#12 edit Differences ... ==== //depot/projects/gdb/sys/kern/sys_process.c#12 (text+ko) ==== @@ -61,10 +61,6 @@ #include <vm/vm_page.h> #ifdef COMPAT_IA32 -#include <sys/procfs.h> -#include <machine/fpu.h> -#include <compat/ia32/ia32_reg.h> - extern struct sysentvec ia32_freebsd_sysvec; struct ptrace_io_desc32 { @@ -300,15 +296,18 @@ switch (uap->req) { case PT_GETREGS: case PT_SETREGS: - bufsz = sv->sv_reg->rs_size; + bufsz = (sv->sv_reg != NULL) ? sv->sv_reg->rs_size : + sizeof(struct reg); break; case PT_GETFPREGS: case PT_SETFPREGS: - bufsz = sv->sv_fpreg->rs_size; + bufsz = (sv->sv_fpreg != NULL) ? sv->sv_fpreg->rs_size : + sizeof(struct fpreg); break; case PT_GETDBREGS: case PT_SETDBREGS: - bufsz = sv->sv_dbreg->rs_size; + bufsz = (sv->sv_dbreg != NULL) ? sv->sv_dbreg->rs_size : + sizeof(struct dbreg); break; case PT_GETXREGSIZE: bufsz = sizeof(size_t); @@ -396,6 +395,8 @@ struct thread *td2 = NULL; struct ptrace_io_desc *piod = NULL; struct ptrace_lwpinfo *pl; + ptregset_readf fread; + ptregset_writef fwrite; int error, write, tmp, num; int proctree_locked = 0; lwpid_t *buf; @@ -790,33 +791,45 @@ goto sendsig; /* in PT_CONTINUE above */ case PT_SETREGS: - error = ptrace_write_regf(td2, addr, sv->sv_reg->rs_write); + fwrite = (sv->sv_reg != NULL) ? sv->sv_reg->rs_write : + (ptregset_writef)set_regs; + error = ptrace_write_regf(td2, addr, fwrite); break; case PT_GETREGS: - error = ptrace_read_regf(td2, addr, sv->sv_reg->rs_read); + fread = (sv->sv_reg != NULL) ? sv->sv_reg->rs_read : + (ptregset_readf)fill_regs; + error = ptrace_read_regf(td2, addr, fread); break; case PT_SETFPREGS: - error = ptrace_write_regf(td2, addr, sv->sv_fpreg->rs_write); + fwrite = (sv->sv_fpreg != NULL) ? sv->sv_fpreg->rs_write : + (ptregset_writef)set_fpregs; + error = ptrace_write_regf(td2, addr, fwrite); break; case PT_GETFPREGS: - error = ptrace_read_regf(td2, addr, sv->sv_fpreg->rs_read); + fread = (sv->sv_fpreg != NULL) ? sv->sv_fpreg->rs_read : + (ptregset_readf)fill_fpregs; + error = ptrace_read_regf(td2, addr, fread); break; case PT_SETDBREGS: - error = ptrace_write_regf(td2, addr, sv->sv_dbreg->rs_write); + fwrite = (sv->sv_dbreg != NULL) ? sv->sv_dbreg->rs_write : + (ptregset_writef)set_dbregs; + error = ptrace_write_regf(td2, addr, fwrite); break; case PT_GETDBREGS: - error = ptrace_read_regf(td2, addr, sv->sv_dbreg->rs_read); + fread = (sv->sv_dbreg != NULL) ? sv->sv_dbreg->rs_read : + (ptregset_readf)fill_dbregs; + error = ptrace_read_regf(td2, addr, fread); break; case PT_SETXREGS: if (data >= 0 && data < sv->sv_nxregs) { - error = ptrace_write_regf(td2, addr, - sv->sv_xregs[data].rs_write); + fwrite = sv->sv_xregs[data].rs_write; + error = ptrace_write_regf(td2, addr, fwrite); } else error = EINVAL; break; @@ -832,8 +845,8 @@ case PT_GETXREGS: if (data >= 0 && data < sv->sv_nxregs) { - error = ptrace_read_regf(td2, addr, - sv->sv_xregs[data].rs_read); + fread = sv->sv_xregs[data].rs_read; + error = ptrace_read_regf(td2, addr, fread); } else error = EINVAL; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608100135.k7A1ZtSc037436>