public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] disasm, record: fix "record instruction-history /m"
@ 2015-10-19  9:26 Markus Metzger
  2015-10-19  9:23 ` [PATCH v2 3/4] btrace: change record instruction-history /m Markus Metzger
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Markus Metzger @ 2015-10-19  9:26 UTC (permalink / raw)
  To: dje; +Cc: gdb-patches, palves

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

The latter really does a source print with intermixed disassembly.  To that
purpose, it may reorder instructions to better match the source.  This doesn't
work for printing a single instruction.  The output also interferes with
"record instruction-history" specific extensions.

Change record instruction-history /m to use its own simple source interleaving
algorithm.  The most important part is that instructions are printed in
the order in which they were executed.  Before each instruction, we print
a range of source lines that are attributed to the instruction's PC.  If the
source line range has already been printed (or skipped) for the previous
instruction, we skip it.

This is a mixture of an earlier RFC that added source interleaving to the
"record instruction-history" command and version 1 of this patch series that
tried to modify Doug Evans new "disassembly" source interleaving algorithm and
use it for "record instruction-history", as well.

We extend disasm.c's insn tuple printing and use it for printing a single
instruction.  To also share the source interleaving algorithm, we'd need to
change it significantly.  When building a hash table of source lines of the
memory range to disassemble and when inserting lines without source code, the
algorithm assumes that instructions are printed in the order in which they
appear in memory.  The "record instruction-history" command needs to print
instructions in the order in which they retired.

I propose to leave the two source interleaving algorithms separate.


Markus Metzger (4):
  disasm: split dump_insns
  disasm: add struct disasm_insn to describe to-be-disassembled
    instruction
  btrace: change record instruction-history /m
  btrace: add instruction-history /s and fix documentation

 gdb/NEWS            |   3 +
 gdb/disasm.c        | 199 ++++++++++++++++++++++++++++++++--------------------
 gdb/disasm.h        |  23 ++++++
 gdb/doc/gdb.texinfo |  14 ++++
 gdb/record-btrace.c | 191 +++++++++++++++++++++++++++++++++++++++++++------
 gdb/record.c        |   5 +-
 6 files changed, 336 insertions(+), 99 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-10-26 16:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-19  9:26 [PATCH v2 0/4] disasm, record: fix "record instruction-history /m" Markus Metzger
2015-10-19  9:23 ` [PATCH v2 3/4] btrace: change record instruction-history /m Markus Metzger
2015-10-26  3:47   ` Doug Evans
2015-10-26 12:55     ` Metzger, Markus T
2015-10-26 21:15       ` Doug Evans
2015-10-19  9:23 ` [PATCH v2 4/4] btrace: add instruction-history /s and fix documentation Markus Metzger
2015-10-19  9:37   ` Eli Zaretskii
2015-10-19  9:42     ` Metzger, Markus T
2015-10-26  3:47       ` Doug Evans
2015-10-19  9:26 ` [PATCH v2 1/4] disasm: split dump_insns Markus Metzger
2015-10-26  3:47   ` Doug Evans
2015-10-19  9:27 ` [PATCH v2 2/4] disasm: add struct disasm_insn to describe to-be-disassembled instruction Markus Metzger
2015-10-26  3:47   ` Doug Evans
2015-10-26 12:55     ` Metzger, Markus T
2015-10-26 20:57       ` Doug Evans
2015-10-26  3:47 ` [PATCH v2 0/4] disasm, record: fix "record instruction-history /m" Doug Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).