While hunting another bug, I noticed that the namespace code dumping
early debug information was only dumping statics. Ooops... The patch
below fixes this oversight.
Jason also suggested that we could look into emitting debug info for
DECLs directly in rest_of_decl_compilation as we currently do for
rest_of_type_compilation. I have added a note to that effect, as
something to look into later. I'd rather not rock the boat now that
things are somewhat stable and I'm busy looking into gdb failures.
Committed to branch.
Aldy
commit 1e055f3a98ca3bf271506511c30298a7f156c96f
Author: Aldy Hernandez <al...@redhat.com>
Date: Wed Oct 1 14:26:06 2014 -0700
* cp/decl2.c (emit_debug_for_namespace): Emit early debug
information for all DECLs instead of just the statics.
Include debug.h.
* passes.c (rest_of_decl_compilation): Add reminder that we could
emit early debug information here.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 64cd968..1479f03 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "c-family/c-ada-spec.h"
#include "asan.h"
+#include "debug.h"
extern cpp_reader *parse_in;
@@ -4298,7 +4299,13 @@ emit_debug_for_namespace (tree name_space, void* data
ATTRIBUTE_UNUSED)
int len = statics->length ();
check_global_declarations (vec, len);
- emit_debug_global_declarations (vec, len, EMIT_DEBUG_EARLY);
+
+ for (tree t = level->names; t; t = TREE_CHAIN(t))
+ if (TREE_CODE (t) != TYPE_DECL
+ && TREE_CODE (t) != PARM_DECL
+ && !DECL_IS_BUILTIN (t))
+ debug_hooks->early_global_decl (t);
+
return 0;
}
diff --git a/gcc/passes.c b/gcc/passes.c
index 5001c3d..aabd365 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -268,6 +268,12 @@ rest_of_decl_compilation (tree decl,
else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)
&& TREE_STATIC (decl))
varpool_node::get_create (decl);
+
+ /* ?? Theoretically, we should be able to to call
+ debug_hooks->early_global_decl() here just as we do for
+ rest_of_type_compilation below. This would require changing how
+ we're currently calling early_global_decl() in all the
+ front-ends. Something to look into later. */
}
/* Called after finishing a record, union or enumeral type. */