aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-07-26 23:12:39 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-07-26 23:12:39 +0200
commitb56bc05b9f9a69ab8136243616a31f9b3f2708fc (patch)
treebd25d5376ab1105cc0cf4c82e057b9bf9b787ac2 /gcc
parent625f85e91b9b91fc3d82416abf7e00f556e6e6da (diff)
downloadgcc-b56bc05b9f9a69ab8136243616a31f9b3f2708fc.zip
gcc-b56bc05b9f9a69ab8136243616a31f9b3f2708fc.tar.gz
gcc-b56bc05b9f9a69ab8136243616a31f9b3f2708fc.tar.bz2
dwarf2out.c (output_macinfo_op): Ensure fd->filename points to GC allocated copy of the string.
* dwarf2out.c (output_macinfo_op): Ensure fd->filename points to GC allocated copy of the string. (dwarf2out_finish): Emit .debug_macinfo or .debug_macro sections before .debug_line, not after it. From-SVN: r176811
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dwarf2out.c26
2 files changed, 22 insertions, 11 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5a3a71e..08fb665 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-07-26 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (output_macinfo_op): Ensure fd->filename points
+ to GC allocated copy of the string.
+ (dwarf2out_finish): Emit .debug_macinfo or .debug_macro sections
+ before .debug_line, not after it.
+
2011-07-26 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/47046
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index d430753..8ea9f37 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -20552,11 +20552,15 @@ output_macinfo_op (macinfo_entry *ref)
size_t len;
struct indirect_string_node *node;
char label[MAX_ARTIFICIAL_LABEL_BYTES];
+ struct dwarf_file_data *fd;
switch (ref->code)
{
case DW_MACINFO_start_file:
- file_num = maybe_emit_file (lookup_filename (ref->info));
+ fd = lookup_filename (ref->info);
+ if (fd->filename == ref->info)
+ fd->filename = ggc_strdup (fd->filename);
+ file_num = maybe_emit_file (fd);
dw2_asm_output_data (1, DW_MACINFO_start_file, "Start new file");
dw2_asm_output_data_uleb128 (ref->lineno,
"Included from line number %lu",
@@ -22637,6 +22641,16 @@ dwarf2out_finish (const char *filename)
output_ranges ();
}
+ /* Have to end the macro section. */
+ if (debug_info_level >= DINFO_LEVEL_VERBOSE)
+ {
+ switch_to_section (debug_macinfo_section);
+ ASM_OUTPUT_LABEL (asm_out_file, macinfo_section_label);
+ if (!VEC_empty (macinfo_entry, macinfo_table))
+ output_macinfo ();
+ dw2_asm_output_data (1, 0, "End compilation unit");
+ }
+
/* Output the source line correspondence table. We must do this
even if there is no line information. Otherwise, on an empty
translation unit, we will generate a present, but empty,
@@ -22648,16 +22662,6 @@ dwarf2out_finish (const char *filename)
if (! DWARF2_ASM_LINE_DEBUG_INFO)
output_line_info ();
- /* Have to end the macro section. */
- if (debug_info_level >= DINFO_LEVEL_VERBOSE)
- {
- switch_to_section (debug_macinfo_section);
- ASM_OUTPUT_LABEL (asm_out_file, macinfo_section_label);
- if (!VEC_empty (macinfo_entry, macinfo_table))
- output_macinfo ();
- dw2_asm_output_data (1, 0, "End compilation unit");
- }
-
/* If we emitted any DW_FORM_strp form attribute, output the string
table too. */
if (debug_str_hash)