Date: Fri, 13 Nov 2015 00:50:35 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r290734 - in stable: 10/sys/amd64/amd64 10/sys/i386/i386 10/sys/i386/include 9/sys/amd64/amd64 9/sys/i386/i386 9/sys/i386/include Message-ID: <201511130050.tAD0oZuX053082@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Fri Nov 13 00:50:34 2015 New Revision: 290734 URL: https://svnweb.freebsd.org/changeset/base/290734 Log: MFC 284325: Report the values of x86 segment registers to remote debuggers. While here, also report %eflags from the i386 trapframe. Modified: stable/10/sys/amd64/amd64/gdb_machdep.c stable/10/sys/i386/i386/gdb_machdep.c stable/10/sys/i386/i386/machdep.c stable/10/sys/i386/include/gdb_machdep.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/sys/amd64/amd64/gdb_machdep.c stable/9/sys/i386/i386/gdb_machdep.c stable/9/sys/i386/i386/machdep.c stable/9/sys/i386/include/gdb_machdep.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/10/sys/amd64/amd64/gdb_machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/gdb_machdep.c Fri Nov 13 00:47:44 2015 (r290733) +++ stable/10/sys/amd64/amd64/gdb_machdep.c Fri Nov 13 00:50:34 2015 (r290734) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); void * gdb_cpu_getreg(int regnum, size_t *regsz) { + static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL); + static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL); *regsz = gdb_cpu_regsz(regnum); @@ -76,6 +78,8 @@ gdb_cpu_getreg(int regnum, size_t *regsz case 14: return (&kdb_thrctx->pcb_r14); case 15: return (&kdb_thrctx->pcb_r15); case 16: return (&kdb_thrctx->pcb_rip); + case 18: return (&_kcodesel); + case 19: return (&_kdatasel); } return (NULL); } Modified: stable/10/sys/i386/i386/gdb_machdep.c ============================================================================== --- stable/10/sys/i386/i386/gdb_machdep.c Fri Nov 13 00:47:44 2015 (r290733) +++ stable/10/sys/i386/i386/gdb_machdep.c Fri Nov 13 00:50:34 2015 (r290734) @@ -45,14 +45,22 @@ __FBSDID("$FreeBSD$"); void * gdb_cpu_getreg(int regnum, size_t *regsz) { + static uint32_t _kcodesel = GSEL(GCODE_SEL, SEL_KPL); + static uint32_t _kdatasel = GSEL(GDATA_SEL, SEL_KPL); + static uint32_t _kprivsel = GSEL(GPRIV_SEL, SEL_KPL); *regsz = gdb_cpu_regsz(regnum); - if (kdb_thread == curthread) { + if (kdb_thread == curthread) { switch (regnum) { case 0: return (&kdb_frame->tf_eax); case 1: return (&kdb_frame->tf_ecx); case 2: return (&kdb_frame->tf_edx); + case 9: return (&kdb_frame->tf_eflags); + case 10: return (&kdb_frame->tf_cs); + case 12: return (&kdb_frame->tf_ds); + case 13: return (&kdb_frame->tf_es); + case 14: return (&kdb_frame->tf_fs); } } switch (regnum) { @@ -62,6 +70,12 @@ gdb_cpu_getreg(int regnum, size_t *regsz case 6: return (&kdb_thrctx->pcb_esi); case 7: return (&kdb_thrctx->pcb_edi); case 8: return (&kdb_thrctx->pcb_eip); + case 10: return (&_kcodesel); + case 11: return (&_kdatasel); + case 12: return (&_kdatasel); + case 13: return (&_kdatasel); + case 14: return (&_kprivsel); + case 15: return (&kdb_thrctx->pcb_gs); } return (NULL); } Modified: stable/10/sys/i386/i386/machdep.c ============================================================================== --- stable/10/sys/i386/i386/machdep.c Fri Nov 13 00:47:44 2015 (r290733) +++ stable/10/sys/i386/i386/machdep.c Fri Nov 13 00:50:34 2015 (r290734) @@ -3616,6 +3616,7 @@ makectx(struct trapframe *tf, struct pcb pcb->pcb_ebx = tf->tf_ebx; pcb->pcb_eip = tf->tf_eip; pcb->pcb_esp = (ISPL(tf->tf_cs)) ? tf->tf_esp : (int)(tf + 1) - 8; + pcb->pcb_gs = rgs(); } int Modified: stable/10/sys/i386/include/gdb_machdep.h ============================================================================== --- stable/10/sys/i386/include/gdb_machdep.h Fri Nov 13 00:47:44 2015 (r290733) +++ stable/10/sys/i386/include/gdb_machdep.h Fri Nov 13 00:50:34 2015 (r290734) @@ -30,7 +30,7 @@ #define _MACHINE_GDB_MACHDEP_H_ #define GDB_BUFSZ 400 -#define GDB_NREGS 14 +#define GDB_NREGS 16 #define GDB_REG_PC 8 static __inline size_t
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511130050.tAD0oZuX053082>