This is an automated email from Gerrit.

Austin Morton ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/4253

-- gerrit

commit 8d91a80dd37f401176eda5e2700b7cc534365bcc
Author: Austin Morton <[email protected]>
Date:   Tue Oct 10 10:27:29 2017 -0400

    gdb_server: support thread names in qXfer:threads:read response
    
    Implements the optional "name" attribute in the xml response
    which is supported in gdb since version 7.11.
    Versions of gdb which support qXfer:threads:read but pre-date
    the addition of the optional "name" attribute simply ignore it.
    
    Also Implement a command which allows the current behavior of
    displaying the thread name in the extra info field to be disabled.
    This command serves no purpose but to cut down on visual clutter
    for users who are using a version of gdb which support the name attribute.
    
    Based on the work originally done by Steven Stallion in gerrit change #3559.
    
    Change-Id: I6a2838247c55ce1684884537663681017df2b356
    Signed-off-by: Austin Morton <[email protected]>

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 483e551..76e6f4d 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -135,6 +135,9 @@ static int gdb_use_target_description = 1;
 /* current processing free-run type, used by file-I/O */
 static char gdb_running_type;
 
+/* controls display of thread name in extra info of qXfer response */
+static int gdb_thread_name_in_extra_info = 1;
+
 static int gdb_last_signal(struct target *target)
 {
        switch (target->debug_reason) {
@@ -2307,14 +2310,21 @@ static int gdb_generate_thread_list(struct target 
*target, char **thread_list_ou
                                continue;
 
                        xml_printf(&retval, &thread_list, &pos, &size,
-                                  "<thread id=\"%" PRIx64 "\">", 
thread_detail->threadid);
+                                  "<thread id=\"%" PRIx64 "\"", 
thread_detail->threadid);
 
                        if (thread_detail->thread_name_str != NULL)
                                xml_printf(&retval, &thread_list, &pos, &size,
+                                       " name=\"%s\"",
+                                       thread_detail->thread_name_str);
+
+                       xml_printf(&retval, &thread_list, &pos, &size, ">");
+
+                       if (thread_detail->thread_name_str != NULL && 
gdb_thread_name_in_extra_info)
+                               xml_printf(&retval, &thread_list, &pos, &size,
                                           "Name: %s", 
thread_detail->thread_name_str);
 
                        if (thread_detail->extra_info_str != NULL) {
-                               if (thread_detail->thread_name_str != NULL)
+                               if (thread_detail->thread_name_str != NULL && 
gdb_thread_name_in_extra_info)
                                        xml_printf(&retval, &thread_list, &pos, 
&size,
                                                   ", ");
                                xml_printf(&retval, &thread_list, &pos, &size,
@@ -3242,6 +3252,15 @@ out:
        return retval;
 }
 
+COMMAND_HANDLER(handle_gdb_no_thread_name_in_extra_info_command)
+{
+       if (CMD_ARGC != 0)
+               return ERROR_COMMAND_SYNTAX_ERROR;
+
+       gdb_thread_name_in_extra_info = 0;
+       return ERROR_OK;
+}
+
 static const struct command_registration gdb_command_handlers[] = {
        {
                .name = "gdb_sync",
@@ -3307,6 +3326,12 @@ static const struct command_registration 
gdb_command_handlers[] = {
                .mode = COMMAND_EXEC,
                .help = "Save the target description file",
        },
+       {
+               .name = "gdb_no_thread_name_in_extra_info",
+               .handler = handle_gdb_no_thread_name_in_extra_info_command,
+               .mode = COMMAND_CONFIG,
+               .help = "Hide the thread name in the extra info field of qXfer 
response",
+       },
        COMMAND_REGISTRATION_DONE
 };
 

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to