0%

SDB

si [N]

1
{ "si", "Step in", cmd_si}
1
2
3
4
5
6
7
8
9
static int cmd_si(char *args){
if(args != NULL){
cpu_exec(atoi(args));
}else{
cpu_exec(1);
}

return 0;
}

info

1
{ "info", "Get information of regs or watchpoints", cmd_info}
1
2
3
4
5
6
7
8
9
static int cmd_info(char *args){
if(*args == 'r'){
isa_reg_display();
}else if(*args == 'w'){

}

return 0;
}

x [N] [EXPR]

1
{ "x", "Scan the memory", cmd_x}

规定 EXPR 只能是十六进制数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
static int cmd_x(char *args){
if(args != NULL){
// get the string of instruction number and expression
char *inst_num_in = strtok(args, " ");
char *expr_in = args + strlen(args) + 1;
// get the start address of scanning
paddr_t addr_start_scan;
sscanf(expr_in,"%x",&addr_start_scan);
// output
printf("inst_num_in: %d, addr_start: 0x%08x\n", atoi(inst_num_in), addr_start_scan);
for(u_char i = 0; i <= (atoi(inst_num_in)-1); i++){
printf("%08lx\n", paddr_read(addr_start_scan + i*4, 4));
}
}

return 0;
}

EXPR 正则表达式

1