Re: [RFA] rs6000-tdep.c: arch switching buglet

Kevin Buettner
2002-02-14T01:15:18Z

On Feb 12, 10:47am, Elena Zannoni wrote:

> I found an odd bug on the ppc.
>
> For this target, the list of arches in bfd includes
> several that are not rupported in gdb, for instance powerpc:630.
>
> If the user says:
>
> set architecture powerpc:630
>
> What should happen?
>
> set_architecture() calls gdbarch_update_p, which should fail (right?),
> and set_architecture should print an error message.
>
> Instead, consider the rs6000 code in rs6000_gdbarch_init():
>
> /* Choose variant. */
> v = find_variant_by_arch (arch, mach);
> if (!v)
> v = find_variant_by_name (power ? "power" : "powerpc");
>
> This code will pick a different architecture, in this case
> powerpc:common, but gdb/multiarch doesn't know, and prints that the
> architecture has been successfully set to powerpc:630.
>
> This code was put in place before the multiarch framework, and it has
> become obsolete. So, how about the following:
>
>
> 2002-02-12 Elena Zannoni <ezannoni@redhat.com>
>
> * rs6000-tdep.c (rs6000_gdbarch_init): Don't call
> find_variant_by_name, because it confuses the multiarch
> framework. Return NULL if there isn't an architecture with the
> user supplied name, instead of forcing a different one without
> recording the change with the multiarch machinery.
> (find_variant_by_name): Delete.

It took me a while to convince myself that find_variant_by_name()
wouldn't be useful in the future. But, you're right, this code should
go. Please commit it.

Thanks,

Kevin