Skip to content

Commit

Permalink
disas: introduce show_opcodes
Browse files Browse the repository at this point in the history
For plugins we don't expect the raw opcodes in the disassembly. We
already deal with this by hand crafting our capstone call but for
other diassemblers we need a flag. Introduce show_opcodes which
defaults to off.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240305121005.3528075-27-alex.bennee@linaro.org>
  • Loading branch information
stsquad committed Mar 6, 2024
1 parent 3077be2 commit 83b4613
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions disas/disas.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ void disas(FILE *out, const void *code, size_t size)
s.info.buffer = code;
s.info.buffer_vma = (uintptr_t)code;
s.info.buffer_length = size;
s.info.show_opcodes = true;

if (s.info.cap_arch >= 0 && cap_disas_host(&s.info, code, size)) {
return;
Expand Down
8 changes: 8 additions & 0 deletions include/disas/dis-asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,14 @@ typedef struct disassemble_info {
/* Command line options specific to the target disassembler. */
char * disassembler_options;

/*
* When true instruct the disassembler it may preface the
* disassembly with the opcodes values if it wants to. This is
* mainly for the benefit of the plugin interface which doesn't want
* that.
*/
bool show_opcodes;

/* Field intended to be used by targets in any way they deem suitable. */
void *target_info;

Expand Down

0 comments on commit 83b4613

Please sign in to comment.