aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-09-24 00:30:03 +0000
committerAlan Modra <amodra@gmail.com>2007-09-24 00:30:03 +0000
commitfad9eaf0deff64167032634213f1070193d929f7 (patch)
tree94aa1a8ea6052b785dc3d31fb3238f8895a52751
parent3dca129609ad1329f2223987c13684b7e44866ac (diff)
downloadgdb-fad9eaf0deff64167032634213f1070193d929f7.zip
gdb-fad9eaf0deff64167032634213f1070193d929f7.tar.gz
gdb-fad9eaf0deff64167032634213f1070193d929f7.tar.bz2
* elf32-spu.c (is_indirect_branch): New function.
(find_function_stack_adjust): End scan on hitting indirect branch. (sum_stack): Cast %v arg to correct type.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-spu.c21
2 files changed, 25 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index efab24a..42d91a7 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-24 Trevor Smigiel <Trevor_Smigiel@playstation.sony.com>
+
+ * elf32-spu.c (is_indirect_branch): New function.
+ (find_function_stack_adjust): End scan on hitting indirect branch.
+ (sum_stack): Cast %v arg to correct type.
+
2007-09-21 H.J. Lu <hongjiu.lu@intel.com>
* Makefile.am: Run "make dep-am".
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 9073b63..187d469 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -698,6 +698,22 @@ is_branch (const unsigned char *insn)
return (insn[0] & 0xec) == 0x20 && (insn[1] & 0x80) == 0;
}
+/* Return true for all indirect branch instructions.
+ bi 00110101 000
+ bisl 00110101 001
+ iret 00110101 010
+ bisled 00110101 011
+ biz 00100101 000
+ binz 00100101 001
+ bihz 00100101 010
+ bihnz 00100101 011 */
+
+static bfd_boolean
+is_indirect_branch (const unsigned char *insn)
+{
+ return (insn[0] & 0xef) == 0x25 && (insn[1] & 0x80) == 0;
+}
+
/* Return true for branch hint instructions.
hbra 0001000..
hbrr 0001001.. */
@@ -1534,7 +1550,7 @@ find_function_stack_adjust (asection *sec, bfd_vma offset)
reg[rt] = 0;
continue;
}
- else if (is_branch (buf))
+ else if (is_branch (buf) || is_indirect_branch (buf))
/* If we hit a branch then we must be out of the prologue. */
break;
unknown_insn:
@@ -2510,7 +2526,8 @@ sum_stack (struct function_info *fun,
}
f1 = func_name (fun);
- info->callbacks->minfo (_("%s: 0x%v 0x%v\n"), f1, fun->stack, max_stack);
+ info->callbacks->minfo (_("%s: 0x%v 0x%v\n"),
+ f1, (bfd_vma) fun->stack, max_stack);
if (fun->call_list)
{