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: [patch] Allow gdbserver to dynamically lookup libthread_db.so.1


On Thu, Oct 8, 2009 at 11:06 AM, Pedro Alves <pedro@codesourcery.com> wrote:

> '* configure: Regenerate.' or so is missing. Please always
> add that to the changelog even if not posting the regenerated
> files.

Ok.

I believe attached patch fixes all your comments.

> I notice that this return 0 here meant that
> linux-low.c:linux_look_up_symbols still retry thread_db_init,
> and that after your patch it won't.  I'm inclined to think this
> was a buglet and that following thread_db_init retries
> wouldn't work anyway.  Do you agree, or is this something
> that we still need to keep addressing?

Thanks for noticing this. Looking closer I discovered a buglet in
thread_db_enable_reporting -- it shouldn't return TD_ERR (== 1) here:

  if (thread_db->td_ta_set_event_p == NULL
      || thread_db->td_ta_event_addr_p == NULL
      || thread_db->td_ta_event_getmsg_p == NULL)
    /* This libthread_db is missing required support.  */
    return TD_ERR;

Fixed.

I think it's theoretically possible for thread_db_enable_reporting to fail
early in the inferior lifetime, and start working later; so I fixed this
part and linux_look_up_symbols will now keep retrying.

Re-tested on Linux/x86_64.

Thanks,
-- 
Paul Pluzhnikov


doc/
2009-10-08  Paul Pluzhnikov  <ppluzhnikov@google.com>

     * gdb.texinfo (Server): Document libthread-db-search-path.

gdbserver/
2009-10-08  Paul Pluzhnikov  <ppluzhnikov@google.com>


     * acinclude.m4: (SRV_CHECK_THREAD_DB, SRV_CHECK_TLS_GET_ADDR): Remove.
     * configure.ac: Adjust.
     * linux-low.h (struct process_info_private): Move members to struct
     thread_db.
     (thread_db_free, thread_db_handle_monitor_command): New prototype.
     * linux-low.c (linux_remove_process): Adjust.
     (linux_wait_for_event_1, linux_look_up_symbols): Likewise.
     * server.c (handle_query): Move code ...
     (handle_monitor_command): ... here. New function.
     * target.h (struct target_ops): New member.
     * thread-db.c (struct thread_db): New.
     (libthread_db_search_path): New variable.
     (thread_db_create_event, thread_db_enable_reporting)
     (find_one_thread, maybe_attach_thread, find_new_threads_callback)
     (thread_db_find_new_threads, (thread_db_get_tls_address): Adjust.
     (try_thread_db_load_1, dladdr_to_soname): New functions.
     (try_thread_db_load, thread_db_load_search): New functions.
     (thread_db_init): Search for libthread_db.
     (thread_db_free): New function.
     (thread_db_handle_monitor_command): Likewise.
     * config.in: Regenerate.
     * configure: Regenerate.

Attachment: gdb-gdbserver-threaddb-search-20091008.txt
Description: Text document


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