This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [RFC] Replicate src dir in build dir


Pedro Alves <palves@redhat.com> writes:

> We've had to touch these lists several times recently to add some object to
> a bunch of triplets.  It'd be nice to move the common CPU-specific files to
> variables shared by the different OS triplets, so that we'd have simple places
> to edit them.  Similar to srv_i386_linux_regobj etc. in
> gdbserver/configure.srv.

This is about common CPU-specific files shared by different triplets.
This makes think a little bit further, how do we handle common
OS-specific files shared by different triplets?  We can match triplet
CPU part and OS part respectively, and append the right objects to
gdb_target_obs, like this,

i386_tobjs="i386-tdep.o i386.o i387-tdep.o"
amd64_tobjs="amd64-tdep.o arch/amd64.o"
gdb_target_obs=""

# Fill in gdb_target_obs according to CPU.

case "${targ}" in
aarch64*-*-*)
        gdb_target_obs="aarch64-tdep.o aarch64-insn.o ${gdb_target_obs}";;
arm*-*-*)
        gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o ${gdb_target_obs}";;
i[34567]86-*-*)
        gdb_target_obs="${i386_tobjs} ${gdb_target_obs}";;
	if test "x$enable_64_bit_bfd" = "xyes"; then
	    gdb_target_obs="${amd64_tobjs} ${gdb_target_obs}"
	fi
sparc-*-*)
        gdb_target_obs="sparc-tdep.o ravenscar-thread.o sparc-ravenscar-thread.o ${gdb_target_obs}";;

sparc64-*-*)
        gdb_target_obs="sparc-tdep.o sparc64-tdep.o ravenscar-thread.o sparc-ravenscar-thread.o ${gdb_target_obs}";;

x86_64-*-*)
        gdb_target_obs="${i386_tobjs} ${amd64_tobjs} ${gdb_target_obs}";;
esac

# Fill in gdb_target_obs according to OS.

case "${targ}" in
*-*-freebsd*)
        gdb_target_obs="fbsd-tdep.o solib-svr4.o ${gdb_target_obs}";;
*-*-netbsd*)
        gdb_target_obs="nbsd-tdep.o solib-svr4.o ${gdb_target_obs}";;
*-*-openbsd*)
        gdb_target_obs="obsd-tdep.o solib-svr4.o ${gdb_target_obs}";;
esac

# Fill in the rest according to the triplet.
...

What do you think?

>
> Like e.g.:
>
> + i386_tobjs="i386-tdep.o i386.o i387-tdep.o"
> + amd64_tobjs="${i386_tobjs} amd64-tdep.o arch/amd64.o"
>
> And then use these variables throughout, like:
>
>   x86_64-*-netbsd* | x86_64-*-knetbsd*-gnu)
>   	# Target: NetBSD/amd64
>  -	gdb_target_obs="amd64-tdep.o amd64.o amd64-nbsd-tdep.o i386-tdep.o \
>  - 			i386.o i387-tdep.o nbsd-tdep.o solib-svr4.o"
>  +      gdb_target_obs="${amd64_tobjs} amd64-nbsd-tdep.o nbsd-tdep.o solib-svr4.o"

-- 
Yao (齐尧)


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