[ulog] Fix thread info show when kernel not startup.
This commit is contained in:
parent
b7a5319e5c
commit
3ae6ca1fb0
|
@ -318,9 +318,12 @@ RT_WEAK rt_size_t ulog_formater(char *log_buf, rt_uint32_t level, const char *ta
|
||||||
/* is not in interrupt context */
|
/* is not in interrupt context */
|
||||||
if (rt_interrupt_get_nest() == 0)
|
if (rt_interrupt_get_nest() == 0)
|
||||||
{
|
{
|
||||||
rt_size_t name_len = rt_strnlen(rt_thread_self()->name, RT_NAME_MAX);
|
rt_size_t name_len = 0;
|
||||||
|
const char *thread_name = "N/A";
|
||||||
rt_strncpy(log_buf + log_len, rt_thread_self()->name, name_len);
|
if (rt_thread_self()->name)
|
||||||
|
thread_name = rt_thread_self()->name;
|
||||||
|
name_len = rt_strnlen(thread_name, RT_NAME_MAX);
|
||||||
|
rt_strncpy(log_buf + log_len, thread_name, name_len);
|
||||||
log_len += name_len;
|
log_len += name_len;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue