@@ -426,6 +426,14 @@ static int zephyr_get_riscv_state(struct rtos *rtos, target_addr_t *addr,
426
426
if (retval != ERROR_OK )
427
427
return retval ;
428
428
429
+
430
+ #if 0
431
+ for (int i = 0 ; i < num_callee_saved_regs ; i ++ ) {
432
+ LOG_OUTPUT ("%x " , * (uint32_t * )callee_saved_reg_list [i ].value );
433
+ }
434
+ LOG_OUTPUT ("\r\n" );
435
+ #endif
436
+
429
437
/* This part is a bit weird; this is absolutely necessary because rtos_generic_stack_read initializes
430
438
* a neat little GDB compatible register list for us. But then we move onto reading some bogus values
431
439
* because indexes are incompatble with the Zephyr callee-saved layout.
@@ -640,6 +648,9 @@ static int zephyr_fetch_thread(const struct rtos *rtos,
640
648
if (retval != ERROR_OK )
641
649
return retval ;
642
650
651
+ LOG_DEBUG ("thread->ptr=0x%x, thread->next_ptr=0x%x, thread->stack_pointer=0x%x" ,
652
+ thread -> ptr , thread -> next_ptr , thread -> stack_pointer );
653
+
643
654
retval = target_read_u8 (rtos -> target , ptr + param -> offsets [OFFSET_T_STATE ],
644
655
& thread -> state );
645
656
if (retval != ERROR_OK )
@@ -692,6 +703,9 @@ static int zephyr_fetch_thread_list(struct rtos *rtos, uint32_t current_thread)
692
703
return retval ;
693
704
}
694
705
706
+ LOG_DEBUG ("zephyr_kptr(rtos, OFFSET_K_THREADS)=0x%x, curr=0x%x" ,
707
+ zephyr_kptr (rtos , OFFSET_K_THREADS ), curr );
708
+
695
709
zephyr_array_init (& thread_array );
696
710
697
711
for (; curr ; curr = thread .next_ptr ) {
@@ -704,6 +718,7 @@ static int zephyr_fetch_thread_list(struct rtos *rtos, uint32_t current_thread)
704
718
goto error ;
705
719
706
720
td -> threadid = thread .ptr ;
721
+ LOG_DEBUG ("td->threadid=0x%x" , (uint32_t )td -> threadid );
707
722
td -> exists = true;
708
723
709
724
if (thread .name [0 ])
@@ -728,6 +743,7 @@ static int zephyr_fetch_thread_list(struct rtos *rtos, uint32_t current_thread)
728
743
rtos -> thread_details = zephyr_array_detach_ptr (& thread_array );
729
744
730
745
rtos -> current_threadid = curr_id ;
746
+ LOG_DEBUG ("rtos->current_threadid=%lx" , rtos -> current_threadid );
731
747
rtos -> current_thread = current_thread ;
732
748
733
749
return ERROR_OK ;
@@ -833,6 +849,9 @@ static int zephyr_update_threads(struct rtos *rtos)
833
849
LOG_ERROR ("Could not fetch offsets from Zephyr" );
834
850
return ERROR_FAIL ;
835
851
}
852
+ else {
853
+ LOG_DEBUG ("Zephyr offset %zu: 0x%" PRIx32 , i , param -> offsets [i ]);
854
+ }
836
855
}
837
856
838
857
LOG_DEBUG ("Zephyr OpenOCD support version %" PRId32 ,
@@ -875,6 +894,9 @@ static int zephyr_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
875
894
if (!params )
876
895
return ERROR_FAIL ;
877
896
897
+ LOG_DEBUG ("thread_id=%lx, params->offsets[OFFSET_T_STACK_POINTER]=%x, params->callee_saved_stacking->register_offsets[0].offset=%x" ,
898
+ thread_id , params -> offsets [OFFSET_T_STACK_POINTER ], params -> callee_saved_stacking -> register_offsets [0 ].offset );
899
+
878
900
addr = thread_id + params -> offsets [OFFSET_T_STACK_POINTER ]
879
901
- params -> callee_saved_stacking -> register_offsets [0 ].offset ;
880
902
0 commit comments