aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMarkus Metzger <mmetzger@sourceware.org>2012-11-13 15:35:43 +0000
committerMarkus Metzger <mmetzger@sourceware.org>2012-11-13 15:35:43 +0000
commit4cd29721179a29be4f31798c5860d0964130b78c (patch)
tree54938daba9af7a291729ae10002d4e9eba6d792d /gdb
parentdfaae88645ac58515a3037a09df0d1b7b6d034a4 (diff)
downloadgdb-4cd29721179a29be4f31798c5860d0964130b78c.zip
gdb-4cd29721179a29be4f31798c5860d0964130b78c.tar.gz
gdb-4cd29721179a29be4f31798c5860d0964130b78c.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/disasm.c12
-rw-r--r--gdb/disasm.h1
-rw-r--r--gdb/source.c5
-rw-r--r--gdb/symtab.h5
5 files changed, 28 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 498b6a7..f90311a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
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.
* source.c (print_source_lines_base): Change noerror to flags.
(print_source_lines): Change noerror to flags.
diff --git a/gdb/disasm.c b/gdb/disasm.c
index e3d3349..25d87d7 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -204,10 +204,14 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout,
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));
@@ -275,7 +279,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout,
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
{
@@ -289,7 +293,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout,
= 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");
@@ -301,7 +305,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout,
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
@@ -309,7 +313,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout,
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;
diff --git a/gdb/disasm.h b/gdb/disasm.h
index 646ee8e..a254642 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -22,6 +22,7 @@
#define DISASSEMBLY_SOURCE (0x1 << 0)
#define DISASSEMBLY_RAW_INSN (0x1 << 1)
#define DISASSEMBLY_OMIT_FNAME (0x1 << 2)
+#define DISASSEMBLY_FILENAME (0x1 << 3)
struct ui_out;
struct ui_file;
diff --git a/gdb/source.c b/gdb/source.c
index 2fe2e50..7e14fc6 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1345,6 +1345,11 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
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
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 3b87c96..0d24cb5 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -1167,7 +1167,10 @@ extern int identify_source_line (struct symtab *, int, int, CORE_ADDR);
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,