armv8: check the core state to pass the correct arch to gdb

Commit 3799eded67 ("target/aarch64: add support for
multi-architecture gdb") passes the constant string "aarch64" as
architecture to gdb. This is not working if the core is running
in 32 bits mode; gdb reports:
	Truncated register 8 in remote 'g' packet
then closes the connection with OpenOCD.

Make the architecture string dependant from the current state of
the core.

Change-Id: I16e1614ea02ba29bf87f450b3dfe25c83c9a3612
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5234
Tested-by: jenkins
Reviewed-by: Muhammad Omair Javaid <omair.javaid@linaro.org>
This commit is contained in:
Antonio Borneo 2019-06-14 15:59:17 +02:00
parent 1492a103db
commit 5481401514
1 changed files with 2 additions and 1 deletions

View File

@ -1753,7 +1753,8 @@ const struct command_registration armv8_command_handlers[] = {
const char *armv8_get_gdb_arch(struct target *target)
{
return "aarch64";
struct arm *arm = target_to_arm(target);
return arm->core_state == ARM_STATE_AARCH64 ? "aarch64" : "arm";
}
int armv8_get_gdb_reg_list(struct target *target,