aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2004-04-19 20:35:19 +0000
committerDaniel Jacobowitz <drow@false.org>2004-04-19 20:35:19 +0000
commit435eac09743a1e8d0a1cbb992724aee91b712416 (patch)
treec1a85a861b9e716dd82f526f9e299be20972bb45
parentbf298dd37122d45dbeaa609472714cb74793a521 (diff)
downloadfsf-binutils-gdb-435eac09743a1e8d0a1cbb992724aee91b712416.zip
fsf-binutils-gdb-435eac09743a1e8d0a1cbb992724aee91b712416.tar.gz
fsf-binutils-gdb-435eac09743a1e8d0a1cbb992724aee91b712416.tar.bz2
./
* 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".
-rw-r--r--gdb/ChangeLog.intercu19
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/doc/gdb.texinfo13
-rw-r--r--gdb/dwarf2read.c59
-rw-r--r--gdb/gdbcmd.h8
-rw-r--r--gdb/maint.c4
6 files changed, 94 insertions, 11 deletions
diff --git a/gdb/ChangeLog.intercu b/gdb/ChangeLog.intercu
index 9f68f20..fe009de 100644
--- a/gdb/ChangeLog.intercu
+++ b/gdb/ChangeLog.intercu
@@ -1,5 +1,24 @@
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
of prefixes. Don't print the prefix twice in the CLI.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index ea61e24..feb2eae 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 80d3225..7ace6cd 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -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
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 32bba51..da20e0c 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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"
@@ -66,13 +68,6 @@
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);
}
diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h
index 8c4490e..9dabd2c 100644
--- a/gdb/gdbcmd.h
+++ b/gdb/gdbcmd.h
@@ -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;
diff --git a/gdb/maint.c b/gdb/maint.c
index f105afa..e43b391 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -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)