Fix breakpoint handling for i386.
not sure yet about 5.x... MFC if needed. Also fixes small problems with examining some registers and some specific gdb transfer problems. As the patch says: This is not a pretty patch and only meant as a temporary fix until a better solution is committed. PR: i386/71715 Submitted by: Stephan Uphoff <ups@tree.com> MFC after: 1 week
This commit is contained in:
parent
fad9d21472
commit
def46d58a6
@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
|
||||
#include <machine/gdb_machdep.h>
|
||||
#include <machine/pcb.h>
|
||||
#include <machine/trap.h>
|
||||
#include <machine/frame.h>
|
||||
#include <machine/endian.h>
|
||||
|
||||
#include <gdb/gdb.h>
|
||||
|
||||
@ -45,6 +47,14 @@ gdb_cpu_getreg(int regnum, size_t *regsz)
|
||||
{
|
||||
|
||||
*regsz = gdb_cpu_regsz(regnum);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
switch (regnum) {
|
||||
case 3: return (&kdb_thrctx->pcb_ebx);
|
||||
case 4: return (&kdb_thrctx->pcb_esp);
|
||||
@ -60,8 +70,12 @@ void
|
||||
gdb_cpu_setreg(int regnum, register_t val)
|
||||
{
|
||||
|
||||
val = __bswap32(val);
|
||||
switch (regnum) {
|
||||
case GDB_REG_PC: kdb_thrctx->pcb_eip = val; break;
|
||||
case GDB_REG_PC:
|
||||
kdb_thrctx->pcb_eip = val;
|
||||
if (kdb_thread == curthread)
|
||||
kdb_frame->tf_eip = val;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,17 @@ typedef int db_expr_t; /* expression - signed */
|
||||
#define BKPT_SIZE (1) /* size of breakpoint inst */
|
||||
#define BKPT_SET(inst) (BKPT_INST)
|
||||
|
||||
#define BKPT_SKIP kdb_frame->tf_eip += 1
|
||||
#define BKPT_SKIP \
|
||||
do { \
|
||||
kdb_frame->tf_eip += 1; \
|
||||
kdb_thrctx->pcb_eip += 1; \
|
||||
} while(0)
|
||||
|
||||
#define FIXUP_PC_AFTER_BREAK kdb_frame->tf_eip -= 1;
|
||||
#define FIXUP_PC_AFTER_BREAK \
|
||||
do { \
|
||||
kdb_frame->tf_eip -= 1; \
|
||||
kdb_thrctx->pcb_eip -= 1; \
|
||||
} while(0);
|
||||
|
||||
#define db_clear_single_step kdb_cpu_clear_singlestep
|
||||
#define db_set_single_step kdb_cpu_set_singlestep
|
||||
|
Loading…
Reference in New Issue
Block a user