btrace: change record instruction-history /m
authorMarkus Metzger <markus.t.metzger@intel.com>
Wed, 12 Aug 2015 08:38:35 +0000 (10:38 +0200)
committerMarkus Metzger <markus.t.metzger@intel.com>
Wed, 4 Nov 2015 08:14:17 +0000 (09:14 +0100)
commitf94cc8975cfcf8625833eba0c0077bb878f0cbaa
tree7cc747ba84ac57effb632e392bb414cde27553c0
parenta50a40267668422e60901cc7fb949050caceb90c
btrace: change record instruction-history /m

The /m modifier interleaves source lines with the disassembly of recorded
instructions.  This calls disasm.c's gdb_disassembly once for each recorded
instruction to be printed.

This doesn't really work because gdb_disassembly may choose not to print
anything in some situations.  And if it does print something, the output
interferes with btrace_insn_history's output around it.

It further results in a separate asm_insns list for each instruction in MI.
Even though there is no MI support for target record, yet, we fix this obvious
issue.

Change record instruction-history /m to use the new gdb_pretty_print_insn
function for printing a single instruction and interleave source lines as
appropriate.

We cannot reuse the new disasm.c do_mixed_source_and_assembly function without
significant changes to it.

gdb/
* record-btrace.c (struct btrace_line_range): New.
(btrace_mk_line_range, btrace_line_range_add)
(btrace_line_range_is_empty, btrace_line_range_contains_range)
(btrace_find_line_range, btrace_print_lines): New.
(btrace_insn_history): Add source interleaving algorithm.
gdb/ChangeLog
gdb/record-btrace.c