This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [rfc] Swap out current when creating a new architecture


Andrew Cagney wrote:
> 
> Really nice bug!
> 
> The proposed change unfortunatly isn't right for reasons similar to the
> original current_gdbarch problem.  The exec file might belong to a
> completely different architecture.  Consider a sequence like:
> 
>         (gdb) file hello.d10v
>         (gdb) info architecture
>         The current architecture is d10v
>         (gdb) set cris-mode CRIS_MODE_USER

Hm, I had a feeling I was just moving the problem elsewhere, though I
didn't think of the case of having gdb configured for two
architectures.  But with multi-arch I guess this is not just a remote
possibility.

> For MIPS, the problem has so far been avoided by coding functions as:
> 
>         if (set by user)
>           return user value;
>         else
>           return value from architecture;
> 

>From looking at the MIPS target just now I thought it would suffer from
the same problem when it comes to guessing the ABI (since info.abfd is
used if present).  But then I saw that the functions tied to the MIPS
specific user-commands don't call gdbarch_update, they change
current_gdbarch directly.  I'm going to try something similar.

Thanks,
Orjan

-- 
Orjan Friberg              E-mail: orjan.friberg@axis.com
Axis Communications AB     Phone:  +46 46 272 17 68


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]