From 703dc714c86b83e73acc0ed82944053f0f3b842f Mon Sep 17 00:00:00 2001 From: oharboe Date: Mon, 10 Mar 2008 14:14:15 +0000 Subject: [PATCH] - fixed a problem with big endian XScale and GDB register packets. - hmm..... did I screw up? Was XScale and not gdb_server busted here? My thinking was that OpenOCD has a canonical internal representation of registers that match GDB's expectations git-svn-id: svn://svn.berlios.de/openocd/trunk@484 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/server/gdb_server.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index ce45f2980..1d29d2129 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -773,21 +773,10 @@ void gdb_str_to_target(target_t *target, char *tstr, reg_t *reg) buf = reg->value; buf_len = CEIL(reg->size, 8); - if (target->endianness == TARGET_LITTLE_ENDIAN) + for (i = 0; i < buf_len; i++) { - for (i = 0; i < buf_len; i++) - { - tstr[i*2] = DIGITS[(buf[i]>>4) & 0xf]; - tstr[i*2+1] = DIGITS[buf[i]&0xf]; - } - } - else - { - for (i = 0; i < buf_len; i++) - { - tstr[(buf_len-1-i)*2] = DIGITS[(buf[i]>>4)&0xf]; - tstr[(buf_len-1-i)*2+1] = DIGITS[buf[i]&0xf]; - } + tstr[i*2] = DIGITS[(buf[i]>>4) & 0xf]; + tstr[i*2+1] = DIGITS[buf[i]&0xf]; } } @@ -802,20 +791,10 @@ void gdb_target_to_str(target_t *target, char *tstr, char *str) exit(-1); } - if (target->endianness == TARGET_LITTLE_ENDIAN) + for (i = 0; i < str_len; i+=2) { - for (i = 0; i < str_len; i+=2) - { - str[str_len - i - 1] = tstr[i + 1]; - str[str_len - i - 2] = tstr[i]; - } - } - else - { - for (i = 0; i < str_len; i++) - { - str[i] = tstr[i]; - } + str[str_len - i - 1] = tstr[i + 1]; + str[str_len - i - 2] = tstr[i]; } } -- 2.30.2