*name = "<unknown>";
}
+/* Handle DW_AT_stmt_list for a compilation unit. */
+
+static void
+handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
+ const char *comp_dir)
+{
+ struct attribute *attr;
+ struct objfile *objfile = cu->objfile;
+ bfd *abfd = objfile->obfd;
+
+ /* Decode line number information if present. We do this before
+ processing child DIEs, so that the line header table is available
+ for DW_AT_decl_file. */
+ attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
+ if (attr)
+ {
+ unsigned int line_offset = DW_UNSND (attr);
+ struct line_header *line_header
+ = dwarf_decode_line_header (line_offset, abfd, cu);
+
+ if (line_header)
+ {
+ cu->line_header = line_header;
+ make_cleanup (free_cu_line_header, cu);
+ dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
+ }
+ }
+}
+
/* Process DW_TAG_compile_unit. */
static void
char *comp_dir = NULL;
struct die_info *child_die;
bfd *abfd = objfile->obfd;
- struct line_header *line_header = 0;
CORE_ADDR baseaddr;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
initialize_cu_func_list (cu);
- /* Decode line number information if present. We do this before
- processing child DIEs, so that the line header table is available
- for DW_AT_decl_file. */
- attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
- if (attr)
- {
- unsigned int line_offset = DW_UNSND (attr);
- line_header = dwarf_decode_line_header (line_offset, abfd, cu);
- if (line_header)
- {
- cu->line_header = line_header;
- make_cleanup (free_cu_line_header, cu);
- dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
- }
- }
+ handle_DW_AT_stmt_list (die, cu, comp_dir);
/* Process all dies in compilation unit. */
if (die->child != NULL)
header, so we can only read it if we've read the header
successfully. */
attr = dwarf2_attr (die, DW_AT_macro_info, cu);
- if (attr && line_header)
+ if (attr && cu->line_header)
{
unsigned int macro_offset = DW_UNSND (attr);
- dwarf_decode_macros (line_header, macro_offset,
+ dwarf_decode_macros (cu->line_header, macro_offset,
comp_dir, abfd, cu);
}
do_cleanups (back_to);
record_debugformat ("DWARF 2");
record_producer (cu->producer);
+ handle_DW_AT_stmt_list (die, cu, comp_dir);
+
/* Process the dies in the type unit. */
if (die->child == NULL)
{