This is the mail archive of the gdb@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: Under Linux/Glibc, GDB read DT_DEBUG from gdbserver too early?


On Tue, Sep 15, 2009 at 2:08 AM,  <don.lee@sunplusct.com> wrote:
> Hi all,
>
> I'm now working on shared library support on a target GDB porting
> (based on GDB 6.6), and we using Linux/Glibc as OS.
>
> When I run 'target remote the-target:1234', GDB try to read
> '.dynamic' section in the inferior address space, but looks like
> at this moment the inferior is stopped at dynamic loader, and
> the DT_DEBUG didn't get a meaningful value.
>
> Did I do something wrong?
>
> don
>
> Here is my osabi init function:
>
> static void
> score_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> {
> ?int target_mach = info.bfd_arch_info->mach;
>
> ?set_solib_svr4_fetch_link_map_offsets
> ? ?(gdbarch, svr4_ilp32_fetch_link_map_offsets);
>
> ?/* Shared library handling. ?*/
> ?set_gdbarch_skip_trampoline_code (gdbarch,
> find_solib_trampoline_target);
> ?set_gdbarch_skip_solib_resolver (gdbarch, score_linux_skip_resolver);
>
> ?/* Enable TLS support. ?*/
> ?set_gdbarch_fetch_tls_load_module_address (gdbarch,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? svr4_fetch_objfile_link_map);
>
> ?switch (target_mach)
> ? ?{
> ? ?case bfd_mach_score7:
> ? ? ?tramp_frame_prepend_unwinder (gdbarch,
> ?&score7_linux_rt_sigreturn_tramp_frame);
>
> ? ? ?/* Core file support. */
> ? ? ?set_gdbarch_regset_from_core_section (gdbarch,
> score7_linux_regset_from_core_section);
> ? ? ?break;
> ? ?}
> }
>

gdb 6.6 is pretty old, I'm not sure how much support you can get.

Are you doing something wrong?  I'm not sure but I think the answer is
"not necessarily".

On amd64-linux, gdb (cvs head, and I'm guessing 6.8) will actually
read .dynamic multiple times during program start up, before the
dynamic linker has run.  Eventually the dynamic linker runs, and gdb
gets the desired info.

The only thing I can suggest (sorry!) is to dig deeper.
Maybe someone else will have something more useful to say.


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