aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorSteven Stallion <stallion@squareup.com>2017-03-21 10:33:09 -0500
committerMatthias Welwarsky <matthias@welwarsky.de>2018-10-16 11:58:10 +0100
commite65acd889c61a424c7bd72fdee5d6a3aee1d8504 (patch)
treecbd8a13b34ada89a99b6090ba0ec650588f70120 /src/server
parentd92adf8abf6257c2d58ba409731f4d7fa5aa6b5f (diff)
gdb_server: add support for architecture element
This change adds optional support for a target to report architecture information in the target description to GDB. This is needed by some GDB implementations to properly support remote target with custom behavior. More information on the architecture element can be found here: https://sourceware.org/gdb/onlinedocs/gdb/Target-Description-Format.html#Target-Description-Format Change-Id: I57b19cae5ac3496256e4e5cc52cf6526ca5c322d Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4078 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 2b3057a1..13e5aca6 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -2196,6 +2196,7 @@ static int gdb_generate_target_description(struct target *target, char **tdesc_o
int retval = ERROR_OK;
struct reg **reg_list = NULL;
int reg_list_size;
+ char const *architecture;
char const **features = NULL;
char const **arch_defined_types = NULL;
int feature_list_size = 0;
@@ -2237,6 +2238,12 @@ static int gdb_generate_target_description(struct target *target, char **tdesc_o
"<!DOCTYPE target SYSTEM \"gdb-target.dtd\">\n"
"<target version=\"1.0\">\n");
+ /* generate architecture element if supported by target */
+ architecture = target_get_gdb_arch(target);
+ if (architecture != NULL)
+ xml_printf(&retval, &tdesc, &pos, &size,
+ "<architecture>%s</architecture>\n", architecture);
+
/* generate target description according to register list */
if (features != NULL) {
while (features[current_feature]) {
@@ -2386,6 +2393,8 @@ static int gdb_target_description_supported(struct target *target, int *supporte
char const **features = NULL;
int feature_list_size = 0;
+ char const *architecture = target_get_gdb_arch(target);
+
retval = target_get_gdb_reg_list(target, &reg_list,
&reg_list_size, REG_CLASS_ALL);
if (retval != ERROR_OK) {
@@ -2407,7 +2416,7 @@ static int gdb_target_description_supported(struct target *target, int *supporte
}
if (supported) {
- if (feature_list_size)
+ if (architecture || feature_list_size)
*supported = 1;
else
*supported = 0;