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


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


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