summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ChangeLog11
-rw-r--r--include/dis-asm.h20
-rw-r--r--opcodes/ChangeLog12
-rw-r--r--opcodes/arm-dis.c17
-rw-r--r--opcodes/dis-buf.c11
-rw-r--r--opcodes/dis-init.c2
-rw-r--r--opcodes/disassemble.c18
7 files changed, 87 insertions, 4 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 9fa8373e4e5..9052a6e203f 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,14 @@
+2003-11-14 Nick Clifton <nickc@redhat.com>
+
+ * dis-asm.h (struct disassemble_info): Add new field
+ 'symbol_is_valid' which is a function which can tell the
+ disassembler to skip certain symbols as they should not be
+ displayed to the user.
+ (arm_symbol_is_valid): New prototype. This is the ARM
+ specific function for the symbol_is_valid field.
+ (generic_symbol_is_valid): New prototype. This is the default
+ function pointed to by the symbol_is_valid field.
+
2003-11-06 Bruno Rohee <bruno@rohee.com>
* hp-symtab.h: Fix "the the" typo.
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 6bdd7517de5..3670c518986 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -130,6 +130,12 @@ typedef struct disassemble_info {
int (* symbol_at_address_func)
(bfd_vma addr, struct disassemble_info * info);
+ /* Function called to check if a SYMBOL is can be displayed to the user.
+ This is used by some ports that want to hide special symbols when
+ displaying debugging outout. */
+ bfd_boolean (* symbol_is_valid)
+ (asymbol *, struct disassemble_info * info);
+
/* These are for buffer_read_memory. */
bfd_byte *buffer;
bfd_vma buffer_vma;
@@ -141,7 +147,7 @@ typedef struct disassemble_info {
the same value in order to get reasonable looking output. */
int bytes_per_line;
- /* the next two variables control the way objdump displays the raw data */
+ /* The next two variables control the way objdump displays the raw data. */
/* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
/* output will look like this:
00: 00000000 00000000
@@ -251,12 +257,16 @@ extern void print_arm_disassembler_options (FILE *);
extern void parse_arm_disassembler_option (char *);
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 ***);
+extern int get_arm_regnames (int, const char **, const char **, const char ***);
+extern bfd_boolean arm_symbol_is_valid (asymbol *, struct disassemble_info *);
/* Fetch the disassembler for a given BFD, if that support is available. */
extern disassembler_ftype disassembler (bfd *);
+/* Amend the disassemble_info structure as necessary for the target architecture.
+ Should only be called after initialising the info->arch field. */
+extern void disassemble_init_for_target (struct disassemble_info * info);
+
/* Document any target specific options available from the disassembler. */
extern void disassembler_usage (FILE *);
@@ -284,6 +294,10 @@ extern void generic_print_address
extern int generic_symbol_at_address
(bfd_vma, struct disassemble_info *);
+/* Also always true. */
+extern bfd_boolean generic_symbol_is_valid
+ (asymbol *, struct disassemble_info *);
+
/* Method to initialize a disassemble_info struct. This should be
called by all applications creating such a struct. */
extern void init_disassemble_info (struct disassemble_info *info, void *stream,
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 2f613cb71e5..5918252c802 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,15 @@
+2003-11-14 Nick Clifton <nickc@redhat.com>
+
+ * 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 <hongjiu.lu@intel.com>
* m68k-opc.c (m68k_opcodes): Reorder "fmovel".
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index 5f8fc4cfd12..d4ba196b852 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 8f846a9b1b7..83fbfbd7d21 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 4c3e36e6e8c..35a5ee720b8 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 14113b57366..d5b17be3253 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;
+ }
+}