This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v4 1/2] Add back gdb_pretty_print_insn


On 2017-02-01 18:50, Pedro Alves wrote:
On 02/01/2017 08:31 PM, Pedro Alves wrote:

reuse both.  Which suggests creating a new struct to hold
whatever should survive across calls.  And then we can
go the step further, and make that a class, with
pretty_print_insn a method of _that_ class instead of
of gdb_disassembler.  Like:

I can try that, but I think I'd rather do it after
string_file is in already.

Here's what it looks like, on top of the v4 series.

I think it looks good, it doesn't really add any complexity.

diff --git a/gdb/disasm.h b/gdb/disasm.h
index dffe9cd..a03eba6 100644
--- a/gdb/disasm.h
+++ b/gdb/disasm.h
@@ -97,11 +97,34 @@ extern void gdb_disassembly (struct gdbarch
*gdbarch, struct ui_out *uiout,
 extern int gdb_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr,
 			   struct ui_file *stream, int *branch_delay_insns);

-/* Prints the instruction INSN into UIOUT and returns the length of
-   the printed instruction in bytes.  */
+/* Class used to pretty-print an instruction.  */

I'd say "...to pretty-print instructions.", since the goal is to reuse it for multiple instructions.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]