[PATCH] Remove 'target_mach' global from score-tdep.c

Pedro Alves pedro@palves.net
Wed Mar 16 12:07:41 GMT 2022


On 2022-03-15 22:31, Tom Tromey wrote:
> I randomly noticed that score-tdep.c sets a global variable from
> score_gdbarch_init, and then reuses this in other spots in the file.
> 
> This seems incorrect to me, at least if multiple inferiors or targets
> are used; or potentially if there is a single gdb session that
> switches back and forth between (sub-)architectures, causing the
> global to be invalid.
> 
> This patch fixes the problem by deferring the lookup.
> 
> I wrote this just based on inspection, though, and have no way to test
> it.  I wonder if other *-tdep.c files have similar issues.


Looks fine.  

I think we should just drop the whole score port, though.  See here, from 2014 (!):

 https://sourceware.org/pipermail/gdb/2014-October/044643.html

Pedro Alves


More information about the Gdb-patches mailing list