|
|
6693b3 |
2005-07-25 James E Wilson <wilson@specifixinc.com>
|
|
|
6693b3 |
|
|
|
6693b3 |
* dwarf2out.c (add_call_src_coords_attributes): New.
|
|
|
6693b3 |
(gen_inlined_subroutine_die): Call it.
|
|
|
6693b3 |
(maybe_emit_file, init_file_table): Add comments.
|
|
|
6693b3 |
(prune_unused_types_walk_attribs): Pass DW_AT_call_file through
|
|
|
6693b3 |
maybe_emit_file.
|
|
|
6693b3 |
* tree-inline.c (remap_block): Copy BLOCK_SOURCE_LOCATION.
|
|
|
6693b3 |
(expand_call_inline): Set BLOCK_SOURCE_LOCATION.
|
|
|
6693b3 |
* tree.h (BLOCK_SOURCE_LOCATION): New.
|
|
|
6693b3 |
(struct tree_block): New field locus.
|
|
|
6693b3 |
|
|
|
6693b3 |
--- gcc/dwarf2out.c.orig 2005-11-17 23:37:43.000000000 -0200
|
|
|
6693b3 |
+++ gcc/dwarf2out.c 2005-11-17 23:38:25.000000000 -0200
|
|
|
6693b3 |
@@ -11509,6 +11509,20 @@
|
|
|
6693b3 |
}
|
|
|
6693b3 |
}
|
|
|
6693b3 |
|
|
|
6693b3 |
+/* A helper function for gen_inlined_subroutine_die. Add source coordinate
|
|
|
6693b3 |
+ attributes to the DIE for a block STMT, to describe where the inlined
|
|
|
6693b3 |
+ function was called from. This is similar to add_src_coords_attributes. */
|
|
|
6693b3 |
+
|
|
|
6693b3 |
+static inline void
|
|
|
6693b3 |
+add_call_src_coords_attributes (tree stmt, dw_die_ref die)
|
|
|
6693b3 |
+{
|
|
|
6693b3 |
+ unsigned file_index = BLOCK_SOURCE_LOCATION (stmt).file
|
|
|
6693b3 |
+ ? lookup_filename (BLOCK_SOURCE_LOCATION (stmt).file) : 0;
|
|
|
6693b3 |
+
|
|
|
6693b3 |
+ add_AT_unsigned (die, DW_AT_call_file, file_index);
|
|
|
6693b3 |
+ add_AT_unsigned (die, DW_AT_call_line, BLOCK_SOURCE_LOCATION (stmt).line);
|
|
|
6693b3 |
+}
|
|
|
6693b3 |
+
|
|
|
6693b3 |
/* A helper function for gen_lexical_block_die and gen_inlined_subroutine_die.
|
|
|
6693b3 |
Add low_pc and high_pc attributes to the DIE for a block STMT. */
|
|
|
6693b3 |
|
|
|
6693b3 |
@@ -11576,6 +11590,7 @@
|
|
|
6693b3 |
|
|
|
6693b3 |
add_abstract_origin_attribute (subr_die, decl);
|
|
|
6693b3 |
add_high_low_attributes (stmt, subr_die);
|
|
|
6693b3 |
+ add_call_src_coords_attributes (stmt, subr_die);
|
|
|
6693b3 |
|
|
|
6693b3 |
decls_for_scope (stmt, subr_die, depth);
|
|
|
6693b3 |
current_function_has_inlines = 1;
|
|
|
6693b3 |
@@ -12824,6 +12839,12 @@
|
|
|
6693b3 |
return i;
|
|
|
6693b3 |
}
|
|
|
6693b3 |
|
|
|
6693b3 |
+/* If the assembler will construct the file table, then translate the compiler
|
|
|
6693b3 |
+ internal file table number into the assembler file table number, and emit
|
|
|
6693b3 |
+ a .file directive if we haven't already emitted one yet. The file table
|
|
|
6693b3 |
+ numbers are different because we prune debug info for unused variables and
|
|
|
6693b3 |
+ types, which may include filenames. */
|
|
|
6693b3 |
+
|
|
|
6693b3 |
static int
|
|
|
6693b3 |
maybe_emit_file (int fileno)
|
|
|
6693b3 |
{
|
|
|
6693b3 |
@@ -12844,6 +12865,8 @@
|
|
|
6693b3 |
return fileno;
|
|
|
6693b3 |
}
|
|
|
6693b3 |
|
|
|
6693b3 |
+/* Initialize the compiler internal file table. */
|
|
|
6693b3 |
+
|
|
|
6693b3 |
static void
|
|
|
6693b3 |
init_file_table (void)
|
|
|
6693b3 |
{
|
|
|
6693b3 |
@@ -13207,7 +13230,7 @@
|
|
|
6693b3 |
Make sure that it will get emitted. */
|
|
|
6693b3 |
prune_unused_types_mark (a->dw_attr_val.v.val_die_ref.die, 1);
|
|
|
6693b3 |
}
|
|
|
6693b3 |
- else if (a->dw_attr == DW_AT_decl_file)
|
|
|
6693b3 |
+ else if (a->dw_attr == DW_AT_decl_file || a->dw_attr == DW_AT_call_file)
|
|
|
6693b3 |
{
|
|
|
6693b3 |
/* A reference to a file. Make sure the file name is emitted. */
|
|
|
6693b3 |
a->dw_attr_val.v.val_unsigned =
|
|
|
6693b3 |
--- gcc/tree-inline.c.orig 2005-11-17 23:37:02.000000000 -0200
|
|
|
6693b3 |
+++ gcc/tree-inline.c 2005-11-17 23:37:46.000000000 -0200
|
|
|
6693b3 |
@@ -346,6 +346,7 @@
|
|
|
6693b3 |
new_block = make_node (BLOCK);
|
|
|
6693b3 |
TREE_USED (new_block) = TREE_USED (old_block);
|
|
|
6693b3 |
BLOCK_ABSTRACT_ORIGIN (new_block) = old_block;
|
|
|
6693b3 |
+ BLOCK_SOURCE_LOCATION (new_block) = BLOCK_SOURCE_LOCATION (old_block);
|
|
|
6693b3 |
SCOPE_STMT_BLOCK (scope_stmt) = new_block;
|
|
|
6693b3 |
|
|
|
6693b3 |
/* Remap its variables. */
|
|
|
6693b3 |
@@ -420,6 +421,7 @@
|
|
|
6693b3 |
new_block = make_node (BLOCK);
|
|
|
6693b3 |
TREE_USED (new_block) = TREE_USED (old_block);
|
|
|
6693b3 |
BLOCK_ABSTRACT_ORIGIN (new_block) = old_block;
|
|
|
6693b3 |
+ BLOCK_SOURCE_LOCATION (new_block) = BLOCK_SOURCE_LOCATION (old_block);
|
|
|
6693b3 |
BLOCK_SUBBLOCKS (new_block) = BLOCK_SUBBLOCKS (old_block);
|
|
|
6693b3 |
TREE_SIDE_EFFECTS (new_block) = TREE_SIDE_EFFECTS (old_block);
|
|
|
6693b3 |
TREE_TYPE (new_block) = TREE_TYPE (old_block);
|
|
|
6693b3 |
--- gcc/tree.h.orig 2005-11-17 23:37:02.000000000 -0200
|
|
|
6693b3 |
+++ gcc/tree.h 2005-11-17 23:37:46.000000000 -0200
|
|
|
6693b3 |
@@ -903,6 +903,12 @@
|
|
|
6693b3 |
#define BLOCK_FRAGMENT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_origin)
|
|
|
6693b3 |
#define BLOCK_FRAGMENT_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.fragment_chain)
|
|
|
6693b3 |
|
|
|
6693b3 |
+/* For an inlined function, this gives the location where it was called
|
|
|
6693b3 |
+ from. This is only set in the top level block, which corresponds to the
|
|
|
6693b3 |
+ inlined function scope. This is used in the debug output routines. */
|
|
|
6693b3 |
+
|
|
|
6693b3 |
+#define BLOCK_SOURCE_LOCATION(NODE) (BLOCK_CHECK (NODE)->block.locus)
|
|
|
6693b3 |
+
|
|
|
6693b3 |
struct tree_block GTY(())
|
|
|
6693b3 |
{
|
|
|
6693b3 |
struct tree_common common;
|
|
|
6693b3 |
@@ -917,6 +923,7 @@
|
|
|
6693b3 |
tree abstract_origin;
|
|
|
6693b3 |
tree fragment_origin;
|
|
|
6693b3 |
tree fragment_chain;
|
|
|
6693b3 |
+ location_t locus;
|
|
|
6693b3 |
};
|
|
|
6693b3 |
|
|
|
6693b3 |
/* Define fields and accessors for nodes representing data types. */
|