diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2009-07-31 14:39:12 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2009-07-31 14:39:12 +0000 |
commit | e35359c551b7ae1fb3bf1cdff1c58f3abafa07fb (patch) | |
tree | 6d9fbcaaa4c4ba6e30b644179b3c6d13164a8505 /gdb/arch-utils.c | |
parent | 3a1bae8e7f6b90879682cbcd7391cb8493efb9a1 (diff) | |
download | gdb-e35359c551b7ae1fb3bf1cdff1c58f3abafa07fb.zip gdb-e35359c551b7ae1fb3bf1cdff1c58f3abafa07fb.tar.gz gdb-e35359c551b7ae1fb3bf1cdff1c58f3abafa07fb.tar.bz2 |
ChangeLog:
* features/gdb-target.dtd (target): Accept optional
<compatible> elements.
(compatible): Define element.
* target-descriptions.h (tdesc_compatible_p): New.
(tdesc_add_compatible): New.
* target-descriptions.c (arch_p): New VEC_P type.
(struct target_desc): New member compatible.
(free_target_description): Handle it.
(maint_print_c_tdesc_cmd): Likewise.
(tdesc_compatible_p): New function.
(tdesc_add_compatible): New function.
* xml-tdesc.c (tdesc_end_compatible): New function.
(target_children): Handle <compatible> element.
* arch-utils.c (choose_architecture_for_target): Accept target
description instead of BFD architecture as input. Query target
description for compatible architectures.
(gdbarch_info_fill): Update call.
* NEWS: Mention <compatible> element of target descriptions.
doc/ChangeLog:
* gdb.texinfo (Target Descriptions): Document <compatible> element.
Diffstat (limited to 'gdb/arch-utils.c')
-rw-r--r-- | gdb/arch-utils.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index f075922..5cf4afd 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -320,15 +320,24 @@ set_endian (char *ignore_args, int from_tty, struct cmd_list_element *c) } /* Given SELECTED, a currently selected BFD architecture, and - FROM_TARGET, a BFD architecture reported by the target description, - return what architecture to use. Either may be NULL; if both are - specified, we use the more specific. If the two are obviously - incompatible, warn the user. */ + TARGET_DESC, the current target description, return what + architecture to use. + + SELECTED may be NULL, in which case we return the architecture + associated with TARGET_DESC. If SELECTED specifies a variant + of the architecture associtated with TARGET_DESC, return the + more specific of the two. + + If SELECTED is a different architecture, but it is accepted as + compatible by the target, we can use the target architecture. + + If SELECTED is obviously incompatible, warn the user. */ static const struct bfd_arch_info * -choose_architecture_for_target (const struct bfd_arch_info *selected, - const struct bfd_arch_info *from_target) +choose_architecture_for_target (const struct target_desc *target_desc, + const struct bfd_arch_info *selected) { + const struct bfd_arch_info *from_target = tdesc_architecture (target_desc); const struct bfd_arch_info *compat1, *compat2; if (selected == NULL) @@ -358,6 +367,11 @@ choose_architecture_for_target (const struct bfd_arch_info *selected, if (compat1 == NULL && compat2 == NULL) { + /* BFD considers the architectures incompatible. Check our target + description whether it accepts SELECTED as compatible anyway. */ + if (tdesc_compatible_p (target_desc, selected)) + return from_target; + warning (_("Selected architecture %s is not compatible " "with reported target architecture %s"), selected->printable_name, from_target->printable_name); @@ -685,7 +699,7 @@ gdbarch_info_fill (struct gdbarch_info *info) /* From the target. */ if (info->target_desc != NULL) info->bfd_arch_info = choose_architecture_for_target - (info->bfd_arch_info, tdesc_architecture (info->target_desc)); + (info->target_desc, info->bfd_arch_info); /* From the default. */ if (info->bfd_arch_info == NULL) info->bfd_arch_info = default_bfd_arch; |