This is an automated email from Gerrit.

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

-- gerrit

commit 66e60789bce781cbc8932cc6bca1304e1f3b13d0
Author: Alexey Brodkin <[email protected]>
Date:   Fri May 17 22:18:45 2019 +0300

    gdb-server: Create arch-specific structure type for every feature
    
    As it is mentioned here [1] type's ID is unique name within containing 
feature.
    
    That said if regs of the same type located in different features it's 
required
    to insert type definition at least in each feature.
    
    See more details in discussion here [2].
    
    [1] 
https://sourceware.org/gdb/onlinedocs/gdb/Target-Description-Format.html#Types
    [2] 
https://github.com/foss-for-synopsys-dwc-arc-processors/openocd/commit/2a5f5125ac8fa0e1359b6be03b209f9f5d1ade82#r33460077
    
    Change-Id: Id92b061cfbf47d5c032a02c2c406b28affd0b02a
    Signed-off-by: Alexey Brodkin <[email protected]>

diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 95e6c04..bd99b5b 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -2199,14 +2199,12 @@ static int gdb_generate_target_description(struct 
target *target, char **tdesc_o
        int reg_list_size;
        char const *architecture;
        char const **features = NULL;
-       char const **arch_defined_types = NULL;
        int feature_list_size = 0;
        int num_arch_defined_types = 0;
        char *tdesc = NULL;
        int pos = 0;
        int size = 0;
 
-       arch_defined_types = calloc(1, sizeof(char *));
 
        retval = target_get_gdb_reg_list(target, &reg_list,
                        &reg_list_size, REG_CLASS_ALL);
@@ -2248,7 +2246,9 @@ static int gdb_generate_target_description(struct target 
*target, char **tdesc_o
        /* generate target description according to register list */
        if (features != NULL) {
                while (features[current_feature]) {
+                       char const **arch_defined_types = NULL;
 
+                       arch_defined_types = calloc(1, sizeof(char *));
                        xml_printf(&retval, &tdesc, &pos, &size,
                                        "<feature name=\"%s\">\n",
                                        features[current_feature]);
@@ -2313,6 +2313,7 @@ static int gdb_generate_target_description(struct target 
*target, char **tdesc_o
                                        "</feature>\n");
 
                        current_feature++;
+                       free(arch_defined_types);
                }
        }
 
@@ -2322,7 +2323,6 @@ static int gdb_generate_target_description(struct target 
*target, char **tdesc_o
 error:
        free(features);
        free(reg_list);
-       free(arch_defined_types);
 
        if (retval == ERROR_OK)
                *tdesc_out = tdesc;

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to