* @brief Print backtrace of a thread to system console device * * @param thread which call stack is traced * @return rt_err_t 0 is success, otherwise a failure */
| 517 | * @return rt_err_t 0 is success, otherwise a failure |
| 518 | */ |
| 519 | rt_err_t rt_backtrace_thread(rt_thread_t thread) |
| 520 | { |
| 521 | rt_err_t rc; |
| 522 | struct rt_hw_backtrace_frame frame; |
| 523 | if (thread) |
| 524 | { |
| 525 | rc = rt_hw_backtrace_frame_get(thread, &frame); |
| 526 | if (rc == RT_EOK) |
| 527 | { |
| 528 | rc = rt_backtrace_frame(thread, &frame); |
| 529 | } |
| 530 | } |
| 531 | else |
| 532 | { |
| 533 | rc = -RT_EINVAL; |
| 534 | } |
| 535 | return rc; |
| 536 | } |
| 537 | |
| 538 | #ifdef RT_USING_CPU_USAGE_TRACER |
| 539 | /** |
no test coverage detected