Reuse buffers across gdb_pretty_print_insn calls
authorPedro Alves <palves@redhat.com>
Thu, 2 Feb 2017 11:11:47 +0000 (11:11 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 2 Feb 2017 11:11:47 +0000 (11:11 +0000)
commit8b172ce7c9435095d14e0bd98cd431bb9584e95e
treec590f1e822be6f4130bbffe8497eb55acea113d9
parentd7e747318f4d04af033f16325f9b6d74f67079ec
Reuse buffers across gdb_pretty_print_insn calls

gdb_pretty_print_insn allocates and destroys a couple local buffers
each time it is called, which can be many times when disassembling a
region of memory.  Avoid that overhead by adding a new class that
holds the buffers and making gdb_pretty_print_insn a method of that
class, so that the buffers can be reused across calls.

gdb/ChangeLog:
2017-02-02  Pedro Alves  <palves@redhat.com>

* disasm.c (gdb_pretty_print_insn): Rename to ...
(gdb_pretty_print_disassembler::pretty_print_insn): ... this.
Remove gdbarch parameter.  Adapt to clear the object's buffers
instead of allocating new buffers, and to print using the object's
gdb_disassembler instead of calling gdb_print_insn.
(dump_insns): Use gdb_pretty_print_disassembler.
* disasm.h (gdb_pretty_print_insn): Delete declaration.
(gdb_pretty_print_disassembler): New class.
* record-btrace.c (btrace_insn_history): Use
gdb_pretty_print_disassembler.
gdb/ChangeLog
gdb/disasm.c
gdb/disasm.h
gdb/record-btrace.c
This page took 0.026775 seconds and 4 git commands to generate.