diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ChangeLog | 16 | ||||
-rw-r--r-- | include/dis-asm.h | 41 |
2 files changed, 53 insertions, 4 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index de28dcb..17e1752 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,19 @@ +2017-02-28 Peter Bergner <bergner@vnet.ibm.com> + + * dis-asm.h (disasm_options_t): New typedef. + (parse_arm_disassembler_option): Remove prototype. + (set_arm_regname_option): Likewise. + (get_arm_regnames): Likewise. + (get_arm_regname_num_options): Likewise. + (disassemble_init_s390): New prototype. + (disassembler_options_powerpc): Likewise. + (disassembler_options_arm): Likewise. + (disassembler_options_s390): Likewise. + (remove_whitespace_and_extra_commas): Likewise. + (disassembler_options_cmp): Likewise. + (next_disassembler_option): New inline function. + (FOR_EACH_DISASSEMBLER_OPTION): New macro. + 2017-02-28 Alan Modra <amodra@gmail.com> * elf/ppc64.h (R_PPC64_16DX_HA): New. Expand fake reloc comment. diff --git a/include/dis-asm.h b/include/dis-asm.h index 4872920..f054450 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -222,6 +222,16 @@ typedef struct disassemble_info } disassemble_info; +/* This struct is used to pass information about valid disassembler options + and their descriptions from the target to the generic GDB functions that + set and display them. */ + +typedef struct +{ + const char **name; + const char **description; +} disasm_options_t; + /* Standard disassemblers. Disassemble one instruction at the given target address. Return number of octets processed. */ @@ -332,14 +342,14 @@ extern void print_ppc_disassembler_options (FILE *); extern void print_riscv_disassembler_options (FILE *); extern void print_arm_disassembler_options (FILE *); extern void print_arc_disassembler_options (FILE *); -extern void parse_arm_disassembler_option (char *); extern void print_s390_disassembler_options (FILE *); -extern int get_arm_regname_num_options (void); -extern int set_arm_regname_option (int); -extern int get_arm_regnames (int, const char **, const char **, const char *const **); extern bfd_boolean aarch64_symbol_is_valid (asymbol *, struct disassemble_info *); extern bfd_boolean arm_symbol_is_valid (asymbol *, struct disassemble_info *); extern void disassemble_init_powerpc (struct disassemble_info *); +extern void disassemble_init_s390 (struct disassemble_info *); +extern const disasm_options_t *disassembler_options_powerpc (void); +extern const disasm_options_t *disassembler_options_arm (void); +extern const disasm_options_t *disassembler_options_s390 (void); /* Fetch the disassembler for a given BFD, if that support is available. */ extern disassembler_ftype disassembler (bfd *); @@ -351,6 +361,29 @@ extern void disassemble_init_for_target (struct disassemble_info * dinfo); /* Document any target specific options available from the disassembler. */ extern void disassembler_usage (FILE *); +/* Remove whitespace and consecutive commas. */ +extern char *remove_whitespace_and_extra_commas (char *); + +/* Like STRCMP, but treat ',' the same as '\0' so that we match + strings like "foobar" against "foobar,xxyyzz,...". */ +extern int disassembler_options_cmp (const char *, const char *); + +/* A helper function for FOR_EACH_DISASSEMBLER_OPTION. */ +static inline char * +next_disassembler_option (char *options) +{ + char *opt = strchr (options, ','); + if (opt != NULL) + opt++; + return opt; +} + +/* A macro for iterating over each comma separated option in OPTIONS. */ +#define FOR_EACH_DISASSEMBLER_OPTION(OPT, OPTIONS) \ + for ((OPT) = (OPTIONS); \ + (OPT) != NULL; \ + (OPT) = next_disassembler_option (OPT)) + /* This block of definitions is for particular callers who read instructions into a buffer before calling the instruction decoder. */ |