Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: RFC: libunwind-frame.c -vs- optimized-out
Date: Fri, 02 Jul 2010 19:42:00 -0000	[thread overview]
Message-ID: <m3d3v5llg3.fsf@fleche.redhat.com> (raw)

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;
       }
     }


             reply	other threads:[~2010-07-02 19:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02 19:42 Tom Tromey [this message]
2010-07-02 21:07 ` Jan Kratochvil
2010-07-02 21:22   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3d3v5llg3.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox