This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 4/8] Implement unconditional_branch_address method for x86-64 and i386


Here is an updated patch for x86_64 and i386.

    Implement unconditional_branch_destination method for x86-64 and i386.
    
    gdb/ChangeLog:
    
    	* i386-tdep.c (i386_unconditional_branch_destination): New function.
    	(i386_gdbarch_init): Register i386_unconditional_branch_destination.
---
 gdb/i386-tdep.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9d52d4a..4fd9f6e 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8237,6 +8237,23 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
   return valid_p;
 }
 
+/* Implement the unconditional_branch_destination gdbarch method.  */
+
+static int
+i386_unconditional_branch_destination (struct gdbarch *gdbarch, CORE_ADDR pc,
+                                       CORE_ADDR *dest)
+{
+  CORE_ADDR new_pc = i386_follow_jump (gdbarch, pc);
+
+  if (new_pc == pc)
+    return 0;
+  else
+    {
+      *dest = new_pc;
+      return 1;
+    }
+}
+
 
 static struct gdbarch *
 i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
@@ -8582,6 +8599,10 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   set_gdbarch_fast_tracepoint_valid_at (gdbarch,
 					i386_fast_tracepoint_valid_at);
 
+  /* Unconditional Branch.  */
+  set_gdbarch_unconditional_branch_destination
+    (gdbarch, i386_unconditional_branch_destination);
+
   return gdbarch;
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]