From 22a398e1906e55c453f561070206acb80daf91f1 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 14 Nov 2003 15:12:44 +0000 Subject: Add new field to disassemble_info structure: symbol_is_valid() and use it to skip displaying arm elf mapping symbols in disassembly output. --- opcodes/ChangeLog | 12 ++++++++++++ opcodes/arm-dis.c | 17 +++++++++++++++++ opcodes/dis-buf.c | 11 ++++++++++- opcodes/dis-init.c | 2 ++ opcodes/disassemble.c | 18 ++++++++++++++++++ 5 files changed, 59 insertions(+), 1 deletion(-) (limited to 'opcodes') diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 2f613cb..5918252 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,15 @@ +2003-11-14 Nick Clifton + + * dis-init.c (init_disassemble_info): Initialise + symbol_is_valid field. + * dis-buf.c (generic_symbol_is_valid): New function. Always + returns TRUE. + * arm-dis.c (arm_symbol_is_valid): New function. Return FALSE + for ARM ELF mapping symbols. + * disassemble.c (disassemble_init_for_target): Set + symbol_is_valid field to arm_symbol_is_valid of the target is + an ARM. + 2003-11-05 H.J. Lu * m68k-opc.c (m68k_opcodes): Reorder "fmovel". diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c index 5f8fc4c..d4ba196 100644 --- a/opcodes/arm-dis.c +++ b/opcodes/arm-dis.c @@ -1145,6 +1145,23 @@ print_insn_thumb (pc, info, given) abort (); } +/* Disallow mapping symbols ($a, $b, $d, $t etc) from + being displayed in symbol relative addresses. */ + +bfd_boolean +arm_symbol_is_valid (asymbol * sym, + struct disassemble_info * info ATTRIBUTE_UNUSED) +{ + const char * name; + + if (sym == NULL) + return FALSE; + + name = bfd_asymbol_name (sym); + + return (name && *name != '$'); +} + /* Parse an individual disassembler option. */ void diff --git a/opcodes/dis-buf.c b/opcodes/dis-buf.c index 8f846a9..83fbfbd 100644 --- a/opcodes/dis-buf.c +++ b/opcodes/dis-buf.c @@ -107,7 +107,7 @@ generic_strcat_address (addr, buf, len) } #endif -/* Just return the given address. */ +/* Just return true. */ int generic_symbol_at_address (addr, info) @@ -116,3 +116,12 @@ generic_symbol_at_address (addr, info) { return 1; } + +/* Just return TRUE. */ + +bfd_boolean +generic_symbol_is_valid (asymbol * sym ATTRIBUTE_UNUSED, + struct disassemble_info *info ATTRIBUTE_UNUSED) +{ + return TRUE; +} diff --git a/opcodes/dis-init.c b/opcodes/dis-init.c index 4c3e36e..35a5ee7 100644 --- a/opcodes/dis-init.c +++ b/opcodes/dis-init.c @@ -26,6 +26,7 @@ init_disassemble_info (struct disassemble_info *info, void *stream, fprintf_ftype fprintf_func) { memset (info, 0, sizeof (*info)); + info->flavour = bfd_target_unknown_flavour; info->arch = bfd_arch_unknown; info->endian = BFD_ENDIAN_UNKNOWN; @@ -36,6 +37,7 @@ init_disassemble_info (struct disassemble_info *info, void *stream, info->memory_error_func = perror_memory; info->print_address_func = generic_print_address; info->symbol_at_address_func = generic_symbol_at_address; + info->symbol_is_valid = generic_symbol_is_valid; info->display_endian = BFD_ENDIAN_UNKNOWN; } diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 14113b5..d5b17be 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -397,3 +397,21 @@ disassembler_usage (stream) return; } + +void +disassemble_init_for_target (struct disassemble_info * info) +{ + if (info == NULL) + return; + + switch (info->arch) + { +#ifdef ARCH_arm + case bfd_arch_arm: + info->symbol_is_valid = arm_symbol_is_valid; + break; +#endif + default: + break; + } +} -- cgit v1.1