Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Prevent internal-error when computing $pc in ARM assembly code
@ 2015-05-20  9:49 Martin Simmons
  2015-06-09 18:44 ` Joel Brobecker
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Simmons @ 2015-05-20  9:49 UTC (permalink / raw)
  To: gdb-patches

This patch prevents a gdb internal-error when computing $pc for ARM assembly
code that doesn't use the normal stack frame convention.

It might also help with gdb/12223.

I'm not subscribed to the list so please include me on any replies.


gdb/ChangeLog:

	* arm-tdep.c (arm_analyze_prologue): Read memory without throwing an
	exception, to allow debugging of assembly code.

diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 8181f25..d47b4af 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -1669,8 +1669,11 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
        current_pc < prologue_end;
        current_pc += 4)
     {
-      unsigned int insn
-	= read_memory_unsigned_integer (current_pc, 4, byte_order_for_code);
+      unsigned int insn;
+      gdb_byte buf[4];
+      if (target_read_memory (current_pc, buf, 4))
+	break;
+      insn = extract_unsigned_integer (buf, 4, byte_order_for_code);
 
       if (insn == 0xe1a0c00d)		/* mov ip, sp */
 	{


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-06-15 13:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-20  9:49 [PATCH] Prevent internal-error when computing $pc in ARM assembly code Martin Simmons
2015-06-09 18:44 ` Joel Brobecker
2015-06-11 17:25   ` Martin Simmons
2015-06-12 13:21     ` Joel Brobecker
2015-06-12 15:09       ` Martin Simmons
2015-06-12 17:58         ` Joel Brobecker
2015-06-15 10:02   ` Yao Qi
2015-06-15 13:36     ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox