mips32
[Debugging]


Files

file  debug.h
file  debugger.h
file  debugger.c

Data Structures

struct  bpinfo_t

Defines

#define __mips23_DEBUG_H__
#define ___traceon()   asm volatile ( "\t.word\t0x39\n");
#define ___traceoff()   asm volatile ( "\t.word\t0x3d\n");
#define ___regview()   asm volatile ( "\t.word\t0x37\n");
#define ___halt()   asm volatile ( "\t.word\t0x28\n");
#define ___intmode()   asm volatile ( "\t.word\t0x29\n");
#define BKPOINTS_MAX   10
#define BKPOINT_INPROG   (1 << 0)
#define BKPOINT_ONESHOT   (1 << 1)
#define BKPOINT_REINST   (1 << 2)
#define BKPOINT_FUNCCALL   (1 << 3)

Functions

void debugger_init (void)
void debugger_bpoint (istate_t *istate)
 SPINLOCK_INITIALIZE (bkpoint_lock)
static int cmd_print_breakpoints (cmd_arg_t *argv)
static int cmd_del_breakpoint (cmd_arg_t *argv)
static int cmd_add_breakpoint (cmd_arg_t *argv)
static bool is_jump (__native instr)

Variables

bpinfo_t breakpoints [BKPOINTS_MAX]
bpinfo_t breakpoints [BKPOINTS_MAX]
static cmd_info_t bkpts_info
static cmd_arg_t del_argv
static cmd_info_t delbkpt_info
static cmd_arg_t add_argv
static cmd_info_t addbkpt_info
static cmd_arg_t adde_argv []
static cmd_info_t addbkpte_info
struct {
 SPINLOCK_DECLARE (lock)
   const char *   name
   iroutine   f
   int   count
   zone_t *   info [ZONES_MAX]
   __u32   andmask
   __u32   value
jmpinstr []

Define Documentation

 
#define ___halt  )     asm volatile ( "\t.word\t0x28\n");
 

halt the simulator

Definition at line 47 of file debug.h.

 
#define ___intmode  )     asm volatile ( "\t.word\t0x29\n");
 

simulator enters interactive mode

Definition at line 49 of file debug.h.

 
#define ___regview  )     asm volatile ( "\t.word\t0x37\n");
 

register dump

Definition at line 45 of file debug.h.

 
#define ___traceoff  )     asm volatile ( "\t.word\t0x3d\n");
 

simulator leaves the trace mode

Definition at line 43 of file debug.h.

 
#define ___traceon  )     asm volatile ( "\t.word\t0x39\n");
 

simulator enters the trace mode

Definition at line 41 of file debug.h.

#define __mips23_DEBUG_H__
 

Definition at line 36 of file debug.h.

#define BKPOINT_FUNCCALL   (1 << 3)
 

Call a predefined function

Definition at line 50 of file debugger.h.

Referenced by cmd_print_breakpoints().

#define BKPOINT_INPROG   (1 << 0)
 

Breakpoint was shot

Definition at line 44 of file debugger.h.

Referenced by cmd_del_breakpoint(), and cmd_print_breakpoints().

#define BKPOINT_ONESHOT   (1 << 1)
 

One-time breakpoint,mandatory for j/b instructions

Definition at line 45 of file debugger.h.

Referenced by cmd_del_breakpoint(), and cmd_print_breakpoints().

#define BKPOINT_REINST   (1 << 2)
 

Breakpoint is set on the next instruction, so that it could be reinstalled on the previous one

Definition at line 47 of file debugger.h.

Referenced by debugger_bpoint().

#define BKPOINTS_MAX   10
 

Definition at line 42 of file debugger.h.

Referenced by cmd_add_breakpoint().


Function Documentation

int cmd_add_breakpoint cmd_arg_t argv  )  [static]
 

Add new breakpoint to table

Definition at line 141 of file debugger.c.

References BKPOINTS_MAX, breakpoints, interrupts_disable(), cmd_arg::intval, NULL, printf(), spinlock_lock, and spinlock_unlock().

Here is the call graph for this function:

int cmd_del_breakpoint cmd_arg_t argv  )  [static]
 

Remove breakpoint from table

Definition at line 206 of file debugger.c.

References bpinfo_t::address, BKPOINT_INPROG, BKPOINT_ONESHOT, breakpoints, bpinfo_t::flags, bpinfo_t::instruction, interrupts_disable(), interrupts_restore(), cmd_arg::intval, bpinfo_t::nextinstruction, NULL, printf(), spinlock_lock, and spinlock_unlock().

Here is the call graph for this function:

int cmd_print_breakpoints cmd_arg_t argv  )  [static]
 

Print table of active breakpoints

Definition at line 242 of file debugger.c.

References BKPOINT_FUNCCALL, BKPOINT_INPROG, BKPOINT_ONESHOT, breakpoints, get_symtab_entry(), and printf().

Here is the call graph for this function:

void debugger_bpoint istate_t istate  ) 
 

Handle breakpoint

Find breakpoint in breakpoint table. If found, call kconsole, set break on next instruction and reexecute. If we are on "next instruction", set it back on the first and reexecute. If breakpoint not found in breakpoint table, call kconsole and start next instruction.

Definition at line 298 of file debugger.c.

References BKPOINT_REINST, breakpoints, istate::epc, NULL, panic, and spinlock_lock.

Referenced by breakpoint_exception().

void debugger_init void   ) 
 

Initialize debugger

Definition at line 266 of file debugger.c.

References addbkpt_info, addbkpte_info, bkpts_info, breakpoints, cmd_initialize(), cmd_register(), delbkpt_info, cmd_info::name, NULL, and panic.

Referenced by arch_pre_mm_init().

Here is the call graph for this function:

static bool is_jump __native  instr  )  [static]
 

Test, if the given instruction is a jump or branch instruction

Parameters:
instr Instruction code
Returns:
true - it is jump instruction, false otherwise

Definition at line 128 of file debugger.c.

References andmask, jmpinstr, and value.

SPINLOCK_INITIALIZE bkpoint_lock   ) 
 


Variable Documentation

cmd_arg_t add_argv [static]
 

Initial value:

 {
        .type = ARG_TYPE_INT
}

Definition at line 70 of file debugger.c.

cmd_info_t addbkpt_info [static]
 

Initial value:

 {
        .name = "addbkpt",
        .description = "addbkpt <&symbol> - new bkpoint. Break on J/Branch insts unsupported.",
        .func = cmd_add_breakpoint,
        .argc = 1,
        .argv = &add_argv
}

Definition at line 73 of file debugger.c.

Referenced by debugger_init().

cmd_info_t addbkpte_info [static]
 

Initial value:

 {
        .name = "addbkpte",
        .description = "addebkpte <&symbol> <&func> - new bkpoint. Call func(or Nothing if 0).",
        .func = cmd_add_breakpoint,
        .argc = 2,
        .argv = adde_argv
}

Definition at line 85 of file debugger.c.

Referenced by debugger_init().

cmd_arg_t adde_argv[] [static]
 

Initial value:

 {
        { .type = ARG_TYPE_INT },
        { .type = ARG_TYPE_INT }
}

Definition at line 81 of file debugger.c.

__u32 andmask [inherited]
 

Definition at line 94 of file debugger.c.

cmd_info_t bkpts_info [static]
 

Initial value:

 {
        .name = "bkpts",
        .description = "Print breakpoint table.",
        .func = cmd_print_breakpoints,
        .argc = 0,
}

Definition at line 50 of file debugger.c.

Referenced by debugger_init().

bpinfo_t breakpoints[BKPOINTS_MAX]
 

Definition at line 46 of file debugger.c.

Referenced by cmd_add_breakpoint(), cmd_del_breakpoint(), cmd_print_breakpoints(), debugger_bpoint(), and debugger_init().

bpinfo_t breakpoints[BKPOINTS_MAX]
 

Definition at line 46 of file debugger.c.

Referenced by cmd_add_breakpoint(), cmd_del_breakpoint(), cmd_print_breakpoints(), debugger_bpoint(), and debugger_init().

int count [inherited]
 

Definition at line 97 of file frame.c.

cmd_arg_t del_argv [static]
 

Initial value:

 {
        .type = ARG_TYPE_INT
}

Definition at line 58 of file debugger.c.

cmd_info_t delbkpt_info [static]
 

Initial value:

 {
        .name = "delbkpt",
        .description = "delbkpt <number> - Delete breakpoint.",
        .func = cmd_del_breakpoint,
        .argc = 1,
        .argv = &del_argv
}

Definition at line 61 of file debugger.c.

Referenced by debugger_init().

iroutine f [inherited]
 

Definition at line 53 of file interrupt.c.

zone_t* info[ZONES_MAX] [inherited]
 

Definition at line 98 of file frame.c.

struct { ... } jmpinstr[] [static]
 

Referenced by is_jump().

const char* name [inherited]
 

Definition at line 52 of file interrupt.c.

__u32 value [inherited]
 

Definition at line 95 of file debugger.c.


Generated on Sun Jun 18 17:14:12 2006 for HelenOS Kernel (mips32) by  doxygen 1.4.6