Introduction
In lab 1, we will implement a simple debugger. There are three main tasks.
Task 1, Implement single-step execution, Print register status, Scan memory.
Task 2, Implement expression evaluation.
Task 3, Perfect expression evaluation and Implement expression evaluation.
Implementation
Correct exit
when using the command q
to exit, the nemu
will output an error message.
To fix it, you should debug through gdb
and know must change the state.
|
|
Simple debugger
Single-step execution
add si
cmd to cmd_table
|
|
implement cmd_si
function
|
|
Print register status
add info
cmd to cmd_table
|
|
implement cmd_info
function
the display register function is isa_reg_display
, you need to modify it.
|
|
Scan memory
add x
cmd to cmd_table
|
|
implement cmd_x
function
|
|
Expression evaluation
To start this, you must read to experiment document expression evaluation and
watchpoint. Know how to analyze the expression and calculate it.
add p
cmd to cmd_table
|
|
implement cmd_p
function, and all details in the expr()
function.
|
|
finish make_token
and eval
function, all hints in the experiment document.
we should categorize all tokens.
|
|
modify make_token
|
|
Watchpoint
add w,d
cmd to cmd_table
|
|
implement cmd_w
and cmd_d
function
|
|
finish wp_remove()
, wp_add()
and wp_display()
function
|
|
Put the check of watchpoints in trace_and_difftest()
and use a new macro CONFIG_WATCHPOINT
|
|
implement wp_difftest()
in watchpoint.c
.
|
|