aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2011-04-08 11:42:19 +0000
committerPaul Brook <paul@codesourcery.com>2011-04-08 11:42:19 +0000
commit1fbaefec00e08a2a0dd55e59dcd570d8f1e1b3b1 (patch)
tree0b654556c4b9aa0d2d5b7a6d9e31a7c5e00f8581
parent33b5443119cdb4fdf5101afcbd73bee489840062 (diff)
downloadgdb-1fbaefec00e08a2a0dd55e59dcd570d8f1e1b3b1.zip
gdb-1fbaefec00e08a2a0dd55e59dcd570d8f1e1b3b1.tar.gz
gdb-1fbaefec00e08a2a0dd55e59dcd570d8f1e1b3b1.tar.bz2
2011-04-07 Paul Carroll<pcarroll@codesourcery.com>
opcodes/ * arm-dis.c (print_insn): init vars moved into private_data structure. binutils/testsuite/ * binutils-all/arm/simple.s: Demo issue with objdump with multiple input files * binutils-all/arm/objdump.exp: added new ARM test case code
-rw-r--r--binutils/testsuite/ChangeLog6
-rw-r--r--binutils/testsuite/binutils-all/arm/objdump.exp26
-rw-r--r--binutils/testsuite/binutils-all/arm/simple.s35
-rw-r--r--opcodes/ChangeLog4
-rw-r--r--opcodes/arm-dis.c41
5 files changed, 94 insertions, 18 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 5b92774..2d2981f 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-07 Paul Carroll<pcarroll@codesourcery.com>
+
+ * binutils-all/arm/simple.s: Demo issue with objdump with
+ multiple input files
+ * binutils-all/arm/objdump.exp: added new ARM test case code
+
2011-04-06 Joseph Myers <joseph@codesourcery.com>
* binutils-all/objcopy.exp (*arm*-*-coff): Change to arm*-*-coff.
diff --git a/binutils/testsuite/binutils-all/arm/objdump.exp b/binutils/testsuite/binutils-all/arm/objdump.exp
index d2e04fa..2b78db3 100644
--- a/binutils/testsuite/binutils-all/arm/objdump.exp
+++ b/binutils/testsuite/binutils-all/arm/objdump.exp
@@ -61,3 +61,29 @@ if [regexp $want $got] then {
} else {
fail "thumb2-cond test2"
}
+
+###########################
+# Set up the test of multiple disassemblies
+###########################
+
+if {![binutils_assemble $srcdir/$subdir/simple.s tmpdir/simple.o]} then {
+ return
+}
+
+if [is_remote host] {
+ set objfile [remote_download host tmpdir/simple.o]
+} else {
+ set objfile tmpdir/simple.o
+}
+
+# Make sure multiple disassemblies come out the same
+
+set got [binutils_run $OBJDUMP "-dr $objfile $objfile"]
+
+set want "$objfile:\[ \]*file format.*$objfile:\[ \]*file format.*push.*add.*sub.*str.*add.*pop"
+
+if [regexp $want $got] then {
+ pass "multiple input files"
+} else {
+ fail "multiple input files"
+}
diff --git a/binutils/testsuite/binutils-all/arm/simple.s b/binutils/testsuite/binutils-all/arm/simple.s
new file mode 100644
index 0000000..a486023
--- /dev/null
+++ b/binutils/testsuite/binutils-all/arm/simple.s
@@ -0,0 +1,35 @@
+ .cpu arm7tdmi-s
+ .fpu softvfp
+ .file "y.c"
+ .bss
+ .align 2
+l:
+ .space 4
+ .text
+ .align 2
+ .global f1
+ .type f1, %function
+f1:
+ str fp, [sp, #-4]!
+ add fp, sp, #0
+ sub sp, sp, #12
+ str r0, [fp, #-8]
+ add sp, fp, #0
+ ldmfd sp!, {fp}
+ bx lr
+ .align 2
+ .word l
+ .size f1, .-f1
+ .align 2
+ .global main
+ .type main, %function
+main:
+ stmfd sp!, {fp, lr}
+ add fp, sp, #4
+ bx lr
+ .align 2
+ .word 1717986919
+ .word -1840700269
+ .word l
+ .size main, .-main
+ .ident "GCC: (Sourcery G++ 2011.03) 4.5.1"
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 734f824..7e56d0b 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2011-04-07 Paul Carroll<pcarroll@codesourcery.com>
+
+ * arm-dis.c (print_insn): init vars moved into private_data structure.
+
2011-03-24 Mike Frysinger <vapier@gentoo.org>
* bfin-dis.c (decode_dsp32mac_0): Move MM zeroing down to MAC0 logic.
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index e8abbf5..f1b2104 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -45,6 +45,14 @@
#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
#endif
+/* Cached mapping symbol state. */
+enum map_type
+{
+ MAP_ARM,
+ MAP_THUMB,
+ MAP_DATA
+};
+
struct arm_private_data
{
/* The features to use when disassembling optional instructions. */
@@ -53,6 +61,13 @@ struct arm_private_data
/* Whether any mapping symbols are present in the provided symbol
table. -1 if we do not know yet, otherwise 0 or 1. */
int has_mapping_symbols;
+
+ /* Track the last type (although this doesn't seem to be useful) */
+ enum map_type last_type;
+
+ /* Tracking symbol table information */
+ int last_mapping_sym;
+ bfd_vma last_mapping_addr;
};
struct opcode32
@@ -1642,18 +1657,6 @@ static unsigned int ifthen_next_state;
static bfd_vma ifthen_address;
#define IFTHEN_COND ((ifthen_state >> 4) & 0xf)
-/* Cached mapping symbol state. */
-enum map_type
-{
- MAP_ARM,
- MAP_THUMB,
- MAP_DATA
-};
-
-enum map_type last_type;
-int last_mapping_sym = -1;
-bfd_vma last_mapping_addr = 0;
-
/* Functions. */
int
@@ -4635,6 +4638,8 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little)
select_arm_features (info->mach, & private.features);
private.has_mapping_symbols = -1;
+ private.last_mapping_sym = -1;
+ private.last_mapping_addr = 0;
info->private_data = & private;
}
@@ -4658,8 +4663,8 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little)
/* Start scanning at the start of the function, or wherever
we finished last time. */
start = info->symtab_pos + 1;
- if (start < last_mapping_sym)
- start = last_mapping_sym;
+ if (start < private_data->last_mapping_sym)
+ start = private_data->last_mapping_sym;
found = FALSE;
/* First, look for mapping symbols. */
@@ -4754,10 +4759,10 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little)
}
}
- last_mapping_sym = last_sym;
- last_type = type;
- is_thumb = (last_type == MAP_THUMB);
- is_data = (last_type == MAP_DATA);
+ private_data->last_mapping_sym = last_sym;
+ private_data->last_type = type;
+ is_thumb = (private_data->last_type == MAP_THUMB);
+ is_data = (private_data->last_type == MAP_DATA);
/* Look a little bit ahead to see if we should print out
two or four bytes of data. If there's a symbol,