gdb_server: Include thread name as XML attribute

Explicitly providing a thread name in the "thread" element produces
better thread visualizations in downstream tools like IDEs.

Signed-off-by: Ben McMorran <bemcmorr@microsoft.com>
Change-Id: I102c14ddb8b87757fa474de8e3a3f6a1cfe10d98
Reviewed-on: https://review.openocd.org/c/openocd/+/6828
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Ben McMorran 2022-01-27 14:30:58 -08:00 committed by Antonio Borneo
parent f998a2aaf1
commit 7307fd0e3f
1 changed files with 8 additions and 2 deletions

View File

@ -2619,8 +2619,14 @@ static int gdb_generate_thread_list(struct target *target, char **thread_list_ou
if (!thread_detail->exists)
continue;
xml_printf(&retval, &thread_list, &pos, &size,
"<thread id=\"%" PRIx64 "\">", thread_detail->threadid);
if (thread_detail->thread_name_str)
xml_printf(&retval, &thread_list, &pos, &size,
"<thread id=\"%" PRIx64 "\" name=\"%s\">",
thread_detail->threadid,
thread_detail->thread_name_str);
else
xml_printf(&retval, &thread_list, &pos, &size,
"<thread id=\"%" PRIx64 "\">", thread_detail->threadid);
if (thread_detail->thread_name_str)
xml_printf(&retval, &thread_list, &pos, &size,