libunwind-devel
[Top][All Lists]
Advanced

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

RE: [libunwind] [PATCH][RESEND] check-ip-cfa-unchanged.patch ?JUNK MAIL?


From: rajagopal, dwarak
Subject: RE: [libunwind] [PATCH][RESEND] check-ip-cfa-unchanged.patch ?JUNK MAIL? 4
Date: Tue, 24 Jan 2006 10:36:04 -0600

For which test case are you seeing this?
- Dwarak

-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of Arun Sharma
Sent: Friday, November 18, 2005 5:51 PM
To: address@hidden
Subject: [libunwind] [PATCH][RESEND] check-ip-cfa-unchanged.patch ?JUNK
MAIL? 4

update_frame_state() seems to assume that someone is going to update
c->cfa, but I don't see that happening. So in the presence of recursive
functions, ip == prev_ip. So update_frame_state() gets upset.

> update_frame_state: ip and cfa unchanged; stopping here (ip=0x400a5d)

Based on my very limited understanding of how dwarf2 based unwinding
works, the check should be after apply_reg_state?

Signed-off-by: Arun Sharma <address@hidden>

--- libunwind-0.98.5/src/dwarf/Gparser.c        2004-11-03
13:08:07.000000000 -0800
+++ libunwind-0.98.5.new/src/dwarf/Gparser.c    2005-11-07
21:35:48.000000000 -0800
@@ -586,6 +586,7 @@
 dwarf_find_save_locs (struct dwarf_cursor *c)
 {
   dwarf_state_record_t sr;
+  unw_word_t prev_ip, prev_cfa;
   int ret;
 
   if ((ret = fetch_proc_info (c, c->ip, 1)) < 0)
@@ -594,9 +595,19 @@
   if ((ret = create_state_record_for (c, &sr, c->ip)) < 0)
     return ret;
 
+  prev_ip = c->ip;
+  prev_cfa= c->cfa;
+
   if ((ret = apply_reg_state (c, &sr.rs_current)) < 0)
     return ret;
 
+  if (c->ip == prev_ip && c->cfa == prev_cfa)
+    {
+      dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n",
+              __FUNCTION__, (long) c->ip);
+      return -UNW_EBADFRAME;
+    }
+
   put_unwind_info (c, &c->pi);
   return 0;
 }
diff -ur libunwind-0.98.5/src/dwarf/Gstep.c
libunwind-0.98.5.new/src/dwarf/Gstep.c
--- libunwind-0.98.5/src/dwarf/Gstep.c  2004-11-03 13:08:07.000000000
-0800
+++ libunwind-0.98.5.new/src/dwarf/Gstep.c      2005-11-07
21:33:56.000000000 -0800
@@ -29,12 +29,9 @@
 static int
 update_frame_state (struct dwarf_cursor *c)
 {
-  unw_word_t prev_ip, prev_cfa, ip;
+  unw_word_t  ip;
   int ret;
 
-  prev_ip = c->ip;
-  prev_cfa = c->cfa;
-
   /* Update the IP cache (do this first: if we reach the end of the
      frame-chain, the rest of the info may not be valid/useful
      anymore. */
@@ -108,13 +105,6 @@
   c->abi_marker = 0;
 #endif
 
-  if (c->ip == prev_ip && c->cfa == prev_cfa)
-    {
-      dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n",
-              __FUNCTION__, (long) ip);
-      return -UNW_EBADFRAME;
-    }
-
   c->pi_valid = 0;
   return 0;
 }
_______________________________________________
libunwind mailing list
address@hidden
http://www.hpl.hp.com/hosted/linux/mail-archives/libunwind/




reply via email to

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