libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unw_get_reg vs current cursor ip (Was: [Libunwind-devel] [patch] Fix


From: Mark Wielaard
Subject: Re: unw_get_reg vs current cursor ip (Was: [Libunwind-devel] [patch] Fixup start_ip in unw_get_proc_info when no dwarf info)
Date: Fri, 14 Dec 2007 14:47:17 +0100

Hi David,

On Tue, 2007-12-11 at 13:21 -0700, David Mosberger-Tang wrote:
> I'm fine with the patch in principe, but I think it needs to go into a
> dwarf-specific file ("mi" stands for "machine-independent").

OK, what about using tdep_get_ip() instead? It will do the right thing
whatever the target.

2007-12-14  Mark Wielaard  <address@hidden>

    * src/mi/Gget_reg.c (unw_get_reg): Use tdep_get_ip() when
    looking for UNW_REG_IP.

Thanks,

Mark
diff --git a/src/mi/Gget_reg.c b/src/mi/Gget_reg.c
index 23b72be..021d913 100644
--- a/src/mi/Gget_reg.c
+++ b/src/mi/Gget_reg.c
@@ -30,5 +30,12 @@ unw_get_reg (unw_cursor_t *cursor, int regnum, unw_word_t 
*valp)
 {
   struct cursor *c = (struct cursor *) cursor;
 
+  // We can get the IP value directly without needing a lookup.
+  if (regnum == UNW_REG_IP)
+    {
+      *valp = tdep_get_ip (c);
+      return 0;
+    }
+
   return tdep_access_reg (c, regnum, valp, 0);
 }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]