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]

RFC: libunwind-frame.c -vs- optimized-out


PR 11780 concerns another case where the optimized-out change I made
breaks unwinding.  In this case the failures are on IA-64.

ia64_libunwind_frame_prev_register calls libunwind_frame_prev_register
and then uses the contents of the result, for example:

  /* Let libunwind do most of the work.  */
  val = libunwind_frame_prev_register (this_frame, this_cache, reg);
[...]
      prN_val = extract_bit_field (value_contents_all (val),
				   regnum - VP0_REGNUM, 1);
[...]


However, libunwind_frame_prev_register calls set_value_optimized_out on
this value.

I don't really understand why it is doing this.  It looks like the code
there is computing something, and strangely it seems though that the
error cases return a not-optimized-out value.  E.g., here, unw_get_reg_p
returns a negative value on failure:

            ret = unw_get_reg_p (&cache->cursor, uw_regnum, &intval);
            if (ret < 0)
              return frame_unwind_got_constant (this_frame, regnum, 0);
            val = frame_unwind_got_constant (this_frame, regnum, intval);
          }
        set_value_optimized_out (val, 1);

So, this seems like the logic is possibly backward.

The appended patch fixes the IA-64 regressions.  However, I am reluctant
to commit it without understanding what is going on here.

Tom

2010-07-02  Tom Tromey  <tromey@redhat.com>

	PR exp/11780:
	* libunwind-frame.c (libunwind_frame_prev_register): Don't set
	value as optimized-out.

Index: libunwind-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/libunwind-frame.c,v
retrieving revision 1.26
diff -u -r1.26 libunwind-frame.c
--- libunwind-frame.c	14 May 2010 23:41:04 -0000	1.26
+++ libunwind-frame.c	2 Jul 2010 19:34:58 -0000
@@ -348,7 +348,6 @@
               return frame_unwind_got_constant (this_frame, regnum, 0);
             val = frame_unwind_got_constant (this_frame, regnum, intval);
           }
-        set_value_optimized_out (val, 1);
         break;
       }
     }


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