From 59016fd3a1a51edc443df263e5007e07c2e66bbc Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM) Date: Tue, 18 Jan 2011 15:59:01 +0800 Subject: fix error in breakpoint index calculation Register R0 is overwritten in macro call. R1 has to be used instead. --- Debugger/debug_stub.S | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/Debugger/debug_stub.S b/Debugger/debug_stub.S index 78a5472..53b4abd 100644 --- a/Debugger/debug_stub.S +++ b/Debugger/debug_stub.S @@ -809,17 +809,17 @@ _exit_dbg__proc_brkpt_params: _dbg__cmd_insert_breakpoint: stmfd sp!, {lr} bl __dbg__cmdParamLen - teq r1, #CMD_BKPT_INSERT_PARAMLEN /* Check for correct length */ - bne __dbg__procCmdParamError /* Unexpected input, report error */ - bl _dbg__proc_brkpt_params /* R0: Breakpoint Address */ + teq r1, #CMD_BKPT_INSERT_PARAMLEN /* Check for correct length */ + bne __dbg__procCmdParamError /* Unexpected input, report error */ + bl _dbg__proc_brkpt_params /* R0: Breakpoint Address */ teq r0, #0 - beq __dbg__procBreakpointAddrError /* Thumb2 instructions, or unknown kind */ - mov r3, r0 /* Keep breakpoint address in R3 */ - mov r0, #0 /* Empty Breakpoint entry */ - bl _dbg_find_breakpoint_slot /* Look for an available breakpoint slot, return index in R0 */ + beq __dbg__procBreakpointAddrError /* Thumb2 instructions, or unknown kind */ + mov r3, r0 /* Keep breakpoint address in R3 */ + mov r0, #0 /* Empty Breakpoint entry */ + bl _dbg_find_breakpoint_slot /* Look for an available breakpoint slot, return index in R0 */ cmp r0, #CMD_BKPT_NOTFOUND beq __dbg__procBreakpointAddrError /* No empty slot! */ - mov r1, r3 /* Move breakpoint address to R1 */ + mov r1, r3 /* Move breakpoint address to R1 */ bl _dbg__install_one_breakpoint /* r0: index, r1: instruction address */ b __dbg__procCmdOk @@ -834,16 +834,17 @@ _dbg__cmd_insert_breakpoint: _dbg__cmd_remove_breakpoint: stmfd sp!, {lr} bl __dbg__cmdParamLen - teq r1, #CMD_BKPT_REMOVE_PARAMLEN /* Check for correct length */ - bne __dbg__procCmdParamError /* Unexpected input, report error */ - bl _dbg__proc_brkpt_params /* R0: Breakpoint Address */ + teq r1, #CMD_BKPT_REMOVE_PARAMLEN /* Check for correct length */ + bne __dbg__procCmdParamError /* Unexpected input, report error */ + bl _dbg__proc_brkpt_params /* R0: Breakpoint Address */ teq r0, #0 - beq __dbg__procBreakpointAddrError /* Thumb2 instructions, or unknown kind */ - bl _dbg_find_breakpoint_slot /* Look for matching breakpoint slot, return index in R0 */ + beq __dbg__procBreakpointAddrError /* Thumb2 instructions, or unknown kind */ + bl _dbg_find_breakpoint_slot /* Look for matching breakpoint slot, return index in R0 */ cmp r0, #CMD_BKPT_NOTFOUND - beq __dbg__procBreakpointAddrError /* Specified Breakpoint not found! */ - _index2bkptindex_addr r0, r0 /* Calculate Breakpoint Entry Address */ - bl _dbg__clear_one_breakpoint /* R0: address of breakpoint to clear */ + beq __dbg__procBreakpointAddrError /* Specified Breakpoint not found! */ + _index2bkptindex_addr r0, r1 /* Calculate Breakpoint Entry Address */ + mov r0, r1 /* Move it to R0 for subroutine call */ + bl _dbg__clear_one_breakpoint /* R0: address of breakpoint to clear */ b __dbg__procCmdOk -- cgit v1.2.3