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: [SH] regs command


On 05/18/2012 01:22 PM, Maciej W. Rozycki wrote:

> static struct target_so_ops mips_svr4_so_ops;
> [...]
> 
>   /* Initialize this lazily, to avoid an initialization order
>      dependency on solib-svr4.c's _initialize routine.  */
>   if (mips_svr4_so_ops.in_dynsym_resolve_code == NULL)
>     {
>       mips_svr4_so_ops = svr4_so_ops;
>       mips_svr4_so_ops.in_dynsym_resolve_code
>         = mips_linux_in_dynsym_resolve_code;
>     }
>   set_solib_ops (gdbarch, &mips_svr4_so_ops);
> 
> that I find all but clean -- I can't even tell straight away, without 
> studying all the code involved and perhaps experimenting, if this indeed 
> is going to work correctly regardless of whether this is run before or 
> after the other piece referred.


solib-svr4.c is as much target dependent as mips-linux-tdep.c though.
The split on file name is a bit arbitrary.  It'd make a bit more sense
to split around something like COMMON_OBS and TARGET_OBJS, but you'd
still bump into such issues.  A "don't depend on order" rule appears
simpler to understand and maintain than having to worry about
hierarchies.

-- 
Pedro Alves


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