This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Replicate src dir in build dir
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 20 Sep 2017 18:44:43 +0100
- Subject: Re: [RFC] Replicate src dir in build dir
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DEE656146C
- References: <1505832159-23038-1-git-send-email-yao.qi@linaro.org> <0aca31f3-4604-5630-baba-0584bb9d5c65@redhat.com> <86y3p99uy3.fsf@gmail.com>
On 09/20/2017 05:49 PM, Yao Qi wrote:
> 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?
Yes, that works for me too.
Meeting in the middle, using separate variables for arch and OS
objects would allow getting rid of the need for spelling out
gdb_target_obs twice per line, like:
case "${targ}" in
aarch64*-*-*)
cpu_obs="aarch64-tdep.o aarch64-insn.o";;
arm*-*-*)
cpu_obs="arm.o arm-get-next-pcs.o arm-tdep.o";;
esac
case "${targ}" in
*-*-freebsd*)
os_obs="fbsd-tdep.o solib-svr4.o";;
*-*-netbsd*)
os_obs="nbsd-tdep.o solib-svr4.o";;
*-*-openbsd*)
os_obs="obsd-tdep.o solib-svr4.o";;
esac
gdb_target_obs="${cpu_obs} ${os_obs}"
Thanks,
Pedro Alves