xiaoxiang781216 commented on code in PR #16095: URL: https://github.com/apache/nuttx/pull/16095#discussion_r2020357356
########## arch/xtensa/src/common/xtensa_debug.c: ########## @@ -438,9 +505,22 @@ int up_debugpoint_remove(int type, void *addr, size_t size) uint32_t *xtensa_debug_handler(uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + uint32_t *saved_regs = NULL; Review Comment: bool irq = up_interrupt_context(); ########## arch/xtensa/src/common/xtensa_debug.c: ########## @@ -438,9 +505,22 @@ int up_debugpoint_remove(int type, void *addr, size_t size) uint32_t *xtensa_debug_handler(uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + uint32_t *saved_regs = NULL; uint32_t cause; uint32_t dbnum; + if (!up_interrupt_context()) Review Comment: ``` if (!irq) { up_set_interrupt_context(true); (*running_task)->xcp.regs = regs; } ``` ########## arch/xtensa/src/common/xtensa_int_handlers.S: ########## @@ -587,7 +587,17 @@ _xtensa_debug_handler: /* Set up PS for C, re-enable hi-pri interrupts, and clear EXCM. */ - ps_setup XCHAL_DEBUGLEVEL a0 Review Comment: why not modify ps_setup macro? ########## arch/xtensa/src/common/xtensa_debug.c: ########## @@ -460,10 +540,21 @@ uint32_t *xtensa_debug_handler(uint32_t *regs) dbnum = ((cause & 0x0f00) >> 8); xtensa_watchpoint_handler(dbnum); } + else if(cause & XCHAL_DEBUGCAUSE_ICOUNT_MASK) + { + xtensa_singlestep_handler(); + } else { _alert("Unhandled debug cause 0x%x\n", cause); } + if (saved_regs == NULL) Review Comment: ``` if (!irq) { up_set_interrupt_context(false); regs = (*running_task)->xcp.regs; (*running_task)->xcp.regs = NULL; } ``` ########## libs/libc/gdbstub/lib_gdbstub.c: ########## @@ -671,22 +671,51 @@ static int gdb_recv_ack(FAR struct gdb_state_s *state) static ssize_t gdb_bin2hex(FAR void *buf, size_t buf_len, FAR const void *data, size_t data_len) { - FAR const char *in = data; + size_t skip = (uintptr_t)data % 4; + size_t ret = data_len * 2; FAR char *out = buf; - size_t pos; + size_t total; + uint32_t in; if (buf_len < data_len * 2) { return -EOVERFLOW; /* Buffer too small */ } - for (pos = 0; pos < data_len; pos++) + if (skip != 0) Review Comment: but why need align on 4bytes? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org