target: get_gdb_arch() accepts target via const pointer

The function in question does not need to change target state. It is a
target-type-dependant function, however, IMHO, it is safe to assume that
any target type would not need to change type-independant state of a
target to figure out the arch.

Change-Id: I607cb3aee6529cd5a97bc1200a0226cf6ef43caf
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8093
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Evgeniy Naydanov
2024-01-12 16:29:32 +03:00
committed by Antonio Borneo
parent 67675323e1
commit 1b0ffa97ea
13 changed files with 15 additions and 15 deletions

View File

@@ -257,7 +257,7 @@ struct arm {
};
/** Convert target handle to generic ARM target state handle. */
static inline struct arm *target_to_arm(struct target *target)
static inline struct arm *target_to_arm(const struct target *target)
{
assert(target);
return target->arch_info;
@@ -293,11 +293,11 @@ extern const struct command_registration arm_command_handlers[];
extern const struct command_registration arm_all_profiles_command_handlers[];
int arm_arch_state(struct target *target);
const char *arm_get_gdb_arch(struct target *target);
const char *arm_get_gdb_arch(const struct target *target);
int arm_get_gdb_reg_list(struct target *target,
struct reg **reg_list[], int *reg_list_size,
enum target_register_class reg_class);
const char *armv8_get_gdb_arch(struct target *target);
const char *armv8_get_gdb_arch(const struct target *target);
int armv8_get_gdb_reg_list(struct target *target,
struct reg **reg_list[], int *reg_list_size,
enum target_register_class reg_class);