瀏覽代碼

[add] 打印index

rtthread_MCoreDump
huangyulong 2 月之前
父節點
當前提交
3caed2009a
共有 1 個檔案被更改,包括 4 行新增1 行删除
  1. 4
    1
      Middlewares/MCoreDump/rtthread_port.c

+ 4
- 1
Middlewares/MCoreDump/rtthread_port.c 查看文件

@@ -222,13 +222,14 @@ static int mcd_print_coredump_info_string(struct thread_info_ops *ops)
222 222
             /* If this is the current thread, use current stack pointer */
223 223
             if (idx_l == current_idx)
224 224
             {
225
+                uint32_t fpu_flag = 0;
225 226
                 addr = (rt_uint32_t)get_cur_core_regset_address()->sp;      // 异常中填充
226 227
                 memlen = (rt_uint32_t)thread->stack_addr + thread->stack_size - (rt_uint32_t)thread->sp;
227 228
                 addr -= STACK_CORE_REG_SIZE; // 异常中断里面已经压栈了但还没更新tcb里面的sp指针
228 229
                 memlen += STACK_CORE_REG_SIZE * 2; // 前后括大两倍:实际可能更多局部变量在死机前还没来得及向下增长sp
229 230
 #if MCD_FPU_SUPPORT
230 231
                 /* Read FPU flag first - indicates if FPU context was saved */
231
-                uint32_t fpu_flag = *(uint32_t *)thread->sp;
232
+                fpu_flag = *(uint32_t *)thread->sp;
232 233
                 addr -= 1;
233 234
                 memlen += 1;
234 235
 
@@ -244,11 +245,13 @@ static int mcd_print_coredump_info_string(struct thread_info_ops *ops)
244 245
                     memlen = thread->stack_size;
245 246
                 }
246 247
 
248
+                mcd_print("Thread index:%d (fpu:%d)\n", idx_l + 1, fpu_flag);
247 249
                 print_registers((void *)get_cur_core_regset_address(), get_cur_fp_regset_address(), thread->name);
248 250
                 addr2line_cmd_with_pc_print((rt_uint32_t *)get_cur_core_regset_address()->pc, (uint32_t *)addr, memlen);
249 251
             }
250 252
             else
251 253
             {
254
+                mcd_print("Thread index:%d\n", idx_l + 1);
252 255
                 addr = (rt_uint32_t)thread->sp;
253 256
                 memlen = (rt_uint32_t)thread->stack_addr + thread->stack_size - (rt_uint32_t)thread->sp;
254 257
                 core_regset_type core_regset;

Loading…
取消
儲存