+2012-11-13 Markus Metzger <markus.t.metzger@intel.com>
+
+ * disasm.h (DISASSEMBLY_FILENAME): New macro.
+ * disasm.c (do_mixed_source_and_assembly): Pass filename flag on
+ to print_source_lines ().
+ * symtab.h (PRINT_SOURCE_LINES_FILENAME): New print source lines
+ flag.
+ * source.c (print_source_lines_base): Prefix source line with
+ filename if PRINT_SOURCE_LINES_FILENAME flag is set.
+
2012-11-13 Markus Metzger <markus.t.metzger@intel.com>
* symtab.h (print_source_lines_flags): New enum.
int out_of_order = 0;
int next_line = 0;
int num_displayed = 0;
+ enum print_source_lines_flags psl_flags = 0;
struct cleanup *ui_out_chain;
struct cleanup *ui_out_tuple_chain = make_cleanup (null_cleanup, 0);
struct cleanup *ui_out_list_chain = make_cleanup (null_cleanup, 0);
+ if (flags & DISASSEMBLY_FILENAME)
+ psl_flags |= PRINT_SOURCE_LINES_FILENAME;
+
mle = (struct dis_line_entry *) alloca (nlines
* sizeof (struct dis_line_entry));
ui_out_tuple_chain
= make_cleanup_ui_out_tuple_begin_end (uiout,
"src_and_asm_line");
- print_source_lines (symtab, next_line, mle[i].line + 1, 0);
+ print_source_lines (symtab, next_line, mle[i].line + 1, psl_flags);
}
else
{
= make_cleanup_ui_out_tuple_begin_end (uiout,
"src_and_asm_line");
print_source_lines (symtab, next_line, next_line + 1,
- 0);
+ psl_flags);
ui_out_list_chain_line
= make_cleanup_ui_out_list_begin_end (uiout,
"line_asm_insn");
ui_out_tuple_chain
= make_cleanup_ui_out_tuple_begin_end (uiout,
"src_and_asm_line");
- print_source_lines (symtab, next_line, mle[i].line + 1, 0);
+ print_source_lines (symtab, next_line, mle[i].line + 1, psl_flags);
}
}
else
ui_out_tuple_chain
= make_cleanup_ui_out_tuple_begin_end (uiout,
"src_and_asm_line");
- print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0);
+ print_source_lines (symtab, mle[i].line, mle[i].line + 1, psl_flags);
}
next_line = mle[i].line + 1;
if (c == EOF)
break;
last_line_listed = current_source_line;
+ if (flags & PRINT_SOURCE_LINES_FILENAME)
+ {
+ ui_out_text (uiout, s->filename);
+ ui_out_text (uiout, ":");
+ }
xsnprintf (buf, sizeof (buf), "%d\t", current_source_line++);
ui_out_text (uiout, buf);
do
enum print_source_lines_flags
{
/* Do not print an error message. */
- PRINT_SOURCE_LINES_NOERROR = (1 << 0)
+ PRINT_SOURCE_LINES_NOERROR = (1 << 0),
+
+ /* Print the filename in front of the source lines. */
+ PRINT_SOURCE_LINES_FILENAME = (1 << 1)
};
extern void print_source_lines (struct symtab *, int, int,