public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-lazier-debuginfo-reading: Implementing the on-demand loading of debuginfo for shlibs.
@ 2011-06-01 15:12 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-06-01 15:12 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-lazier-debuginfo-reading has been updated
       via  e40b18e26f3ffbf9d8811bcf215beb754429844b (commit)
       via  f4f6d7df48ec262aff2190fd56c2b31d7fb80335 (commit)
      from  f54e94fe79b2576709dbf467bedf8cfe755e28e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit e40b18e26f3ffbf9d8811bcf215beb754429844b
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Wed Jun 1 12:09:52 2011 -0300

    Implementing the on-demand loading of debuginfo for shlibs.
    
    This commit implements the on-demand loading of debuginfo for shared
    libraries.  I'm stilll working on it, but it already works for
    OpenOffice Writer + thread apply all bt.

commit f4f6d7df48ec262aff2190fd56c2b31d7fb80335
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Wed Jun 1 12:08:08 2011 -0300

    Avoiding the reading of debuginfo for shlibs.
    
    This change makes GDB not read the debuginfo for shared libraries.  With
    this, when you issue a `backtrace', GDB will not display info about
    functions and arguments if they belong to a shared library.

-----------------------------------------------------------------------

Summary of changes:
 gdb/frame.c      |    9 +++++++++
 gdb/solib-svr4.c |   24 ++++++++++++++++++++++++
 gdb/solib.c      |   27 +++++++++++++++++++++++++--
 gdb/solist.h     |    8 ++++++++
 gdb/symfile.c    |   15 ++++++---------
 5 files changed, 72 insertions(+), 11 deletions(-)

First 500 lines of diff:
diff --git a/gdb/frame.c b/gdb/frame.c
index 7a35192..1bbd55c 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -45,6 +45,8 @@
 #include "block.h"
 #include "inline-frame.h"
 #include  "tracepoint.h"
+#include "solist.h"
+#include "solib.h"
 
 static struct frame_info *get_prev_frame_1 (struct frame_info *this_frame);
 static struct frame_info *get_prev_frame_raw (struct frame_info *this_frame);
@@ -622,6 +624,8 @@ frame_find_by_id (struct frame_id id)
 static int
 frame_unwind_pc_if_available (struct frame_info *this_frame, CORE_ADDR *pc)
 {
+  struct so_list *solib;
+
   if (!this_frame->prev_pc.p)
     {
       if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
@@ -677,6 +681,11 @@ frame_unwind_pc_if_available (struct frame_info *this_frame, CORE_ADDR *pc)
 				    this_frame->level,
 				    hex_string (this_frame->prev_pc.value));
 	    }
+
+	  /* On-demand loading of shared libraries' debuginfo.  */
+	  solib = solib_match_pc_solist (pc);
+	  if (solib && !solib->symbols_loaded)
+	    solib_add (solib->so_name, 1, &current_target, 1);
 	}
       else
 	internal_error (__FILE__, __LINE__, _("No unwind_pc method"));
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index bcb94e7..0491e7c 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -2433,6 +2433,29 @@ elf_lookup_lib_symbol (const struct objfile *objfile,
   return lookup_global_symbol_from_objfile (objfile, name, domain);
 }
 
+/* Given PC, try to match a so_list which contains it.
+   See match_pc_solist in solist.h.  */
+
+static struct so_list *
+svr4_match_pc_solist (CORE_ADDR pc, struct so_list *so)
+{
+  struct so_list *iter, *res = NULL;
+  CORE_ADDR cur = CORE_ADDR_MAX;
+
+  for (iter = so; iter; iter = iter->next)
+    {
+      CORE_ADDR addr = lm_dynamic_from_link_map (iter);
+
+      if (addr >= pc && addr < cur)
+	{
+	  cur = addr;
+	  res = iter;
+	}
+    }
+
+  return res;
+}
+
 extern initialize_file_ftype _initialize_svr4_solib; /* -Wmissing-prototypes */
 
 void
@@ -2454,4 +2477,5 @@ _initialize_svr4_solib (void)
   svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol;
   svr4_so_ops.same = svr4_same;
   svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core;
+  svr4_so_ops.match_pc_solist = svr4_match_pc_solist;
 }
diff --git a/gdb/solib.c b/gdb/solib.c
index a9f46e0..ad733af 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -965,8 +965,8 @@ solib_add (char *pattern, int from_tty,
     if (from_tty && pattern && ! any_matches)
       printf_unfiltered
 	("No loaded shared libraries match the pattern `%s'.\n", pattern);
-
-    if (loaded_any_symbols)
+#if 0
+    if (0 && loaded_any_symbols)
       {
 	struct target_so_ops *ops = solib_ops (target_gdbarch);
 
@@ -976,6 +976,7 @@ solib_add (char *pattern, int from_tty,
 
 	ops->special_symbol_handling ();
       }
+#endif
   }
 }
 
@@ -1264,6 +1265,28 @@ in_solib_dynsym_resolve_code (CORE_ADDR pc)
   return ops->in_dynsym_resolve_code (pc);
 }
 
+/* GLOBAL FUNCTION
+
+   solib_match_pc_solist -- check to see to which so_list PC belongs.
+
+   SYNOPSIS
+
+   struct so_list *solib_match_pc_solist (CORE_ADDR pc)
+
+   DESCRIPTION
+
+   Determine to which so_list the given PC belongs.  Returns the
+   so_list if found, NULL otherwise.
+*/
+
+struct so_list *
+solib_match_pc_solist (CORE_ADDR pc)
+{
+  struct target_so_ops *ops = solib_ops (target_gdbarch);
+
+  return ops->match_pc_solist (pc, so_list_head);
+}
+
 /*
 
    LOCAL FUNCTION
diff --git a/gdb/solist.h b/gdb/solist.h
index dad11be..83bdcac 100644
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -110,6 +110,10 @@ struct target_so_ops
        the run time loader.  */
     int (*in_dynsym_resolve_code) (CORE_ADDR pc);
 
+    /* Given PC and the current shared objects' list SO, iterate over SO
+       and return the so_list which contains PC, or NULL otherwise.  */
+    struct so_list *(*match_pc_solist) (CORE_ADDR pc, struct so_list *so);
+
     /* Find and open shared library binary file.  */
     bfd *(*bfd_open) (char *pathname);
 
@@ -154,6 +158,10 @@ extern bfd *solib_bfd_fopen (char *pathname, int fd);
 /* Find solib binary file and open it.  */
 extern bfd *solib_bfd_open (char *in_pathname);
 
+/* Iterate over current shared objects' list, and return the so_list
+   which contains PC, or NULL otherwise.  */
+extern struct so_list *solib_match_pc_solist (CORE_ADDR pc);
+
 /* FIXME: gdbarch needs to control this variable.  */
 extern struct target_so_ops *current_target_so_ops;
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 4689e0e..03352fd 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -167,15 +167,12 @@ show_symbol_reloading (struct ui_file *file, int from_tty,
 
 /* If non-zero, shared library symbols will be added automatically
    when the inferior is created, new libraries are loaded, or when
-   attaching to the inferior.  This is almost always what users will
-   want to have happen; but for very large programs, the startup time
-   will be excessive, and so if this is a problem, the user can clear
-   this flag and then add the shared library symbols as needed.  Note
-   that there is a potential for confusion, since if the shared
-   library symbols are not loaded, commands like "info fun" will *not*
-   report all the functions that are actually present.  */
-
-int auto_solib_add = 1;
+   attaching to the inferior.  Because of the on-demand loading
+   feature, we set this variable to zero always.  The user can override
+   this value if she wants, and GDB will automatically load shared
+   library symbols from the beginning.  */
+
+int auto_solib_add = 0;
 \f
 
 /* Make a null terminated copy of the string at PTR with SIZE characters in


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-01 15:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 15:12 [SCM] archer-sergiodj-lazier-debuginfo-reading: Implementing the on-demand loading of debuginfo for shlibs sergiodj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).