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.