]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
./
authorDaniel Jacobowitz <drow@false.org>
Mon, 19 Apr 2004 20:35:19 +0000 (20:35 +0000)
committerDaniel Jacobowitz <drow@false.org>
Mon, 19 Apr 2004 20:35:19 +0000 (20:35 +0000)
* Makefile.in (dwarf2read.o): Update dependencies.
* dwarf2read.c: Include "command.h" and "gdbcmd.h".
(MAX_CACHE_AGE): Remove.
(dwarf2_max_cache_age): New variable.
(free_comp_units_worker): Update.
(set_dwarf2_cmdlist, show_dwarf2_cmdlist, set_dwarf2_cmd)
(show_dwarf2_cmd): New.
(_initialize_dwarf2_read): Provide "maint set dwarf2 max-cache-age"
and "maint show dwarf2 max-cache-age".
* gdbcmd.h (maintenance_set_cmdlist, maintenance_show_cmdlist): New
externs.
* maint.c (maintenance_set_cmdlist, maintenance_show_cmdlist): Make
global.
doc/
* gdb.texinfo (Maintenance Commands): Document "maint set dwarf2
max-cache-age" and "maint show dwarf2 max-cache-age".

gdb/ChangeLog.intercu
gdb/Makefile.in
gdb/doc/gdb.texinfo
gdb/dwarf2read.c
gdb/gdbcmd.h
gdb/maint.c

index 9f68f20bcca19208c31ea7963c17592c25612e17..fe009de3c882c0b9f356a3f1a767afb2d2a6a866 100644 (file)
@@ -1,3 +1,22 @@
+2004-04-19  Daniel Jacobowitz  <drow@mvista.com>
+
+       * Makefile.in (dwarf2read.o): Update dependencies.
+       * dwarf2read.c: Include "command.h" and "gdbcmd.h".
+       (MAX_CACHE_AGE): Remove.
+       (dwarf2_max_cache_age): New variable.
+       (free_comp_units_worker): Update.
+       (set_dwarf2_cmdlist, show_dwarf2_cmdlist, set_dwarf2_cmd)
+       (show_dwarf2_cmd): New.
+       (_initialize_dwarf2_read): Provide "maint set dwarf2 max-cache-age"
+       and "maint show dwarf2 max-cache-age".
+       * gdbcmd.h (maintenance_set_cmdlist, maintenance_show_cmdlist): New
+       externs.
+       * maint.c (maintenance_set_cmdlist, maintenance_show_cmdlist): Make
+       global.
+
+       * doc/gdb.texinfo (Maintenance Commands): Document "maint set dwarf2
+       max-cache-age" and "maint show dwarf2 max-cache-age".
+
 2004-04-19  Daniel Jacobowitz  <drow@mvista.com>
 
        * cli/cli-setshow.c (cmd_show_list): Check for "show" in the middle
index ea61e243bf4c97ae8e08ec6bd99f89970115660a..feb2eae231246bc2a7d25ef5cc6fbe8278dc6a02 100644 (file)
@@ -1724,7 +1724,7 @@ dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \
        $(expression_h) $(filenames_h) $(macrotab_h) $(language_h) \
        $(complaints_h) $(bcache_h) $(dwarf2expr_h) $(dwarf2loc_h) \
        $(cp_support_h) $(gdb_string_h) $(gdb_assert_h) \
-       $(splay_tree_h) $(hashtab_h)
+       $(splay_tree_h) $(hashtab_h) $(command_h) $(gdbcmd_h)
 dwarfread.o: dwarfread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(objfiles_h) \
        $(elf_dwarf_h) $(buildsym_h) $(demangle_h) $(expression_h) \
        $(language_h) $(complaints_h) $(gdb_string_h)
index 80d32257b7383d20c0d26b1a486bbabff91c691b..7ace6cd3f875e5acea99be02d32439bae4ce934e 100644 (file)
@@ -19499,6 +19499,19 @@ data in a @file{gmon.out} file, be sure to move it to a safe location.
 Configuring with @samp{--enable-profiling} arranges for @value{GDBN} to be
 compiled with the @samp{-pg} compiler option.
 
+@kindex maint set dwarf2 max-cache-age
+@kindex maint show dwarf2 max-cache-age
+@item maint set dwarf2 max-cache-age
+@itemx maint show dwarf2 max-cache-age
+Control the DWARF 2 compilation unit cache.
+
+In object files with inter-compilation-unit references, such as those
+produced by the GCC option @samp{-feliminate-dwarf2-dups}, the DWARF 2
+reader needs to frequently refer to previously read compilation units.
+This setting controls how long a compilation unit will remain in the cache
+if it is not referenced.  Setting it to zero disables caching, which will
+slow down @value{GDBN} startup but reduce memory consumption.
+
 @end table
 
 
index 32bba514cad25218b339a1d608c59ddb47259c26..da20e0ccdfca6f7d43a4e9a1478d1461bcf4bfba 100644 (file)
@@ -46,6 +46,8 @@
 #include "cp-support.h"
 #include "splay-tree.h"
 #include "hashtab.h"
+#include "command.h"
+#include "gdbcmd.h"
 
 #include <fcntl.h>
 #include "gdb_string.h"
    can be used for any other data associated to the objfile (symbol
    names, type names, location expressions to name a few).  */
 
-/* Loaded secondary compilation units are kept in memory until they
-   have not been referenced for the processing of this many
-   compilation units.  Set this to zero to disable caching.  Cache
-   sizes of up to at least twenty will improve startup time for
-   typical inter-CU-reference binaries, at an obvious memory cost.  */
-#define MAX_CACHE_AGE 5
-
 #ifndef DWARF2_REG_TO_REGNUM
 #define DWARF2_REG_TO_REGNUM(REG) (REG)
 #endif
@@ -646,6 +641,13 @@ struct field_info
     int nfnfields;
   };
 
+/* Loaded secondary compilation units are kept in memory until they
+   have not been referenced for the processing of this many
+   compilation units.  Set this to zero to disable caching.  Cache
+   sizes of up to at least twenty will improve startup time for
+   typical inter-CU-reference binaries, at an obvious memory cost.  */
+static unsigned int dwarf2_max_cache_age = 5;
+
 /* Various complaints about symbol reading that don't abort the process */
 
 static void
@@ -9153,7 +9155,7 @@ free_comp_units_worker (struct dwarf2_cu *target_cu, int aging)
       while (per_cu != NULL)
        {
          per_cu->cu->last_used ++;
-         if (per_cu->cu->last_used <= MAX_CACHE_AGE)
+         if (per_cu->cu->last_used <= dwarf2_max_cache_age)
            dwarf2_mark (per_cu->cu);
          per_cu = per_cu->cu->read_in_chain;
        }
@@ -9417,10 +9419,51 @@ partial_die_eq (const void *item_lhs, const void *item_rhs)
   return part_die_lhs->offset == part_die_rhs->offset;
 }
 
+static struct cmd_list_element *set_dwarf2_cmdlist;
+static struct cmd_list_element *show_dwarf2_cmdlist;
+
+static void
+set_dwarf2_cmd (char *args, int from_tty)
+{
+  help_list (set_dwarf2_cmdlist, "maintenance set dwarf2 ", -1, gdb_stdout);
+}
+
+static void
+show_dwarf2_cmd (char *args, int from_tty)
+{ 
+  cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
+}
+
 void _initialize_dwarf2_read (void);
 
 void
 _initialize_dwarf2_read (void)
 {
   dwarf2_objfile_data_key = register_objfile_data ();
+
+  add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd,
+                 "Set DWARF 2 specific variables.\n"
+                 "Configure DWARF 2 variables such as the cache size",
+                  &set_dwarf2_cmdlist, "maintenance set dwarf2 ",
+                  0/*allow-unknown*/, &maintenance_set_cmdlist);
+
+  add_prefix_cmd ("dwarf2", class_maintenance, show_dwarf2_cmd,
+                 "Show DWARF 2 specific variables\n"
+                 "Show DWARF 2 variables such as the cache size",
+                  &show_dwarf2_cmdlist, "maintenance show dwarf2 ",
+                  0/*allow-unknown*/, &maintenance_show_cmdlist);
+
+  add_setshow_uinteger_cmd ("max-cache-age", class_obscure,
+                            &dwarf2_max_cache_age,
+                           "Set an upper bound on the age of cached "
+                           "compilation units.\n"
+                           "A higher limit means that cached "
+                           "compilation units will be stored\n"
+                           "in memory longer, and more total memory will "
+                           "be used.  Zero disables\n"
+                           "caching, which can slow down startup.",
+                           "Show the upper bound on the age of cached "
+                           "dwarf2 compilation units.",
+                            NULL, NULL, &set_dwarf2_cmdlist,
+                            &show_dwarf2_cmdlist);
 }
index 8c4490ec9404a24640424fcb0a2a9ed30763b93d..9dabd2c6587157dfee7ca1080e5d35fdcb4f6d55 100644 (file)
@@ -98,6 +98,14 @@ extern struct cmd_list_element *maintenanceinfolist;
 
 extern struct cmd_list_element *maintenanceprintlist;
 
+/* Chain containing all defined "maintenance set" subcommands. */
+
+extern struct cmd_list_element *maintenance_set_cmdlist;
+
+/* Chain containing all defined "maintenance show" subcommands. */
+
+extern struct cmd_list_element *maintenance_show_cmdlist;
+
 extern struct cmd_list_element *setprintlist;
 
 extern struct cmd_list_element *showprintlist;
index f105afa601d58268d02beb549f889146c8ca3f3f..e43b39150c48663275d57d8f0e60d994c4ffd771 100644 (file)
@@ -609,8 +609,8 @@ maintenance_do_deprecate (char *text, int deprecate)
 
 /* Maintenance set/show framework.  */
 
-static struct cmd_list_element *maintenance_set_cmdlist;
-static struct cmd_list_element *maintenance_show_cmdlist;
+struct cmd_list_element *maintenance_set_cmdlist;
+struct cmd_list_element *maintenance_show_cmdlist;
 
 static void
 maintenance_set_cmd (char *args, int from_tty)