Ejemplo n.º 1
0
void
arch_do_displaced_inst(os_context_t *context, unsigned int orig_inst)
{
    unsigned int *pc = (unsigned int*)(*os_context_pc_addr(context));

    /* Put the original instruction back. */
    arch_remove_breakpoint(pc, orig_inst);

#ifdef CANNOT_GET_TO_SINGLE_STEP_FLAG
    /* Install helper instructions for the single step:
     * pushf; or [esp],0x100; popf. */
    single_step_save1 = *(pc-3);
    single_step_save2 = *(pc-2);
    single_step_save3 = *(pc-1);
    *(pc-3) = 0x9c909090;
    *(pc-2) = 0x00240c81;
    *(pc-1) = 0x9d000001;
#else
    *context_eflags_addr(context) |= 0x100;
#endif

    single_stepping = pc;

#ifdef CANNOT_GET_TO_SINGLE_STEP_FLAG
    *os_context_pc_addr(context) = (os_context_register_t)((char *)pc - 9);
#endif
}
Ejemplo n.º 2
0
char *
dbg_remove_sw_break(GdbState *s, unsigned long addr)
{
	char *error;
	int i;

	for (i = 0; i < MAX_BREAKPOINTS; i++) {
		if (breakpoints[i].bpt_addr != addr) {
			continue;
		}

		if (breakpoints[i].state == BP_SET) {
			breakpoints[i].state = BP_REMOVED;
			return nil;
		} else if (breakpoints[i].state == BP_ACTIVE) {
			error = arch_remove_breakpoint(s, &breakpoints[i]);
			if (error) {
				fprint(2, "dbg_remove_sw_break failed: %lx\n", breakpoints[i].bpt_addr);
				return error;
			}

			breakpoints[i].state = BP_REMOVED;
			return nil;
		}
	}
	return "no such breakpoint";
}
Ejemplo n.º 3
0
char *
dbg_remove_all_break(GdbState *s)
{
	char *error;
	int i;

	/* Clear memory breakpoints. */
	for (i = 0; i < MAX_BREAKPOINTS; i++) {
		if (breakpoints[i].state != BP_ACTIVE)
			goto setundefined;
		error = arch_remove_breakpoint(s, &breakpoints[i]);
		if (error)
			fprint(2, "KGDB: breakpoint remove failed: %lx\n",
				   breakpoints[i].bpt_addr);
setundefined:
		breakpoints[i].state = BP_UNDEFINED;
	}

	return 0;
}
Ejemplo n.º 4
0
char *
dbg_deactivate_sw_breakpoints(GdbState *s)
{
	char *error;
	char *ret = 0;
	int i;

	for (i = 0; i < MAX_BREAKPOINTS; i++) {
		if (breakpoints[i].state != BP_ACTIVE)
			continue;
		error = arch_remove_breakpoint(s, &breakpoints[i]);
		if (error) {
			fprint(2, "KGDB: BP remove failed: %lx\n", breakpoints[i].bpt_addr);
			ret = error;
		}

		//flush_swbreak_addr(breakpoints[i].bpt_addr);
		breakpoints[i].state = BP_SET;
	}
	return ret;
}
Ejemplo n.º 5
0
void breakpoint_remove(lispobj code_obj, int pc_offset,
                       unsigned int orig_inst)
{
    arch_remove_breakpoint(compute_pc(code_obj, pc_offset), orig_inst);
}