This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Re: x86-64-tdep.h cleanup
On Mar 6, 1:26pm, Andrew Cagney wrote:
> >> Michal Ludvig <mludvig@suse.cz> writes:
> >>
> >> |> Andreas Schwab wrote:
> >> |> > I think the registration of the Linux specific gdbarch functions should be
> >> |> > moved to x86-64-linux-tdep.c.
> >> |> > |> It seems reasonable. Perhaps I can do it like in the attachment?
> >>
> >> No, x86-64-tdep.c should not have _any_ reference to
> >> x86-64-linux-tdep.c. The former must be usable without the latter.
> >
> >
> > How is that possible though? I've studied this problem for other
> > targets and have (up to now, anyway) concluded that the main tdep.c
> > file is going to need to know about the (OS or ABI) variants in some
> > fashion.
>
> I think AndreasS is correct. x86-64-tdep.c only contains ISA and ABI
> stuff while x86-64-linux.c contains GNU/Linux specific OS functions.
>
> Two problems are tripping up the theory. First is that gdbarch doesn't
> currently groak this arangement - x86-64-linux-tdep is derived (correct
> O-O word?) from x86-64-tdep.
I'm not sure I agree with this characterization. As I see it, the
x86-64-linux-tdep.c functions could just as easily have gone in the
main tdep.c file, but it is/was cleaner to put them in their own file.
> The second problem is that gdbarch doesn't
> handle the concept of OS variants within an ISA/ABI.
Well, maybe not directly, but it is certainly possible use a
gdbarch_tdep struct to describe certain features of the OS in
question. I use this sort of mechanism on IA-64 to distinguish
between AIX and Linux. The OS-specific IA-64 tdep files deal with the
same kinds of issues that x86-64-linux-tdep.c is meant to handle.
(See the first sixty lines or so of ia64_gdbarch_init().)
> Up until now people have side stepped the issue by retaining macro
> definitions in config/*/tm-linux.h. I'm personally ok with this - it
> retains the status quo and at least manages to retain the separation.
Yuck. I don't mind the status quo for targets that haven't completely
converted over to being multiarched yet. I don't think that we should
encourage a new target to do this though.
Kevin