Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Andrew Burgess <aburgess@broadcom.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFC 00/12] Merge value optimized_out and unavailable
Date: Fri, 29 Nov 2013 22:31:00 -0000	[thread overview]
Message-ID: <5298F718.8060104@redhat.com> (raw)
In-Reply-To: <5208D1DF.1090201@broadcom.com>

On 08/12/2013 01:15 PM, Andrew Burgess wrote:
> This patch set merges together how gdb handles values that are
> optimized out and values that are unavailable.
> 
> I think that in most cases gdb should not care why the contents of
> a value are not fetch-able, it is only when we need to display
> something to the user that we should have to figure out was this
> optimized-out or unavailable?

Kind of, but not quite.  Going through the series, and thinking about
it a lot, I'm not convinced the parts that handle unavailable and
optimized out errors the same way are right.  The frame machinery
handles unavailable registers especially, with the _if_available
wrappers, because it's possible to have a traceframe with no
collected PC, or trimmed core file with no registers info,
and consequently, a frame #0 with an <unavailable> PC / function.
I'm not seeing how it's possible to end up with a frame_info that
has an optimized out PC.  If unwinding the PC results in a not
saved PC, we use that as indication that we've reached the
outermost frame, so we stop the backtrace before that could happen.

So all the _if_available functions that _don't_ try to unwind the
prev frame (which are most, except frame_unwind_caller_pc_if_available),
shouldn't ever throw an optimized error for PC/function.

Since frame_unwind_caller_pc_if_available is the only
_if_available wrapper that unwinds, that's the case where the
caller would need to likewise handle optimized out / not saved
PCs.  But then, after the series, "info frame", the only caller
of frame_unwind_caller_pc_if_available, ends printing <unavailable>
instead of <not saved>, because these different errors passed
through the same sieve hole:

  if (frame_unwind_caller_pc_if_available (fi, &caller_pc))
    fputs_filtered (paddress (gdbarch, caller_pc), gdb_stdout);
  else
    fputs_filtered ("<unavailable>", gdb_stdout);

(gdb) info frame
Stack level 2, frame at 0x0:
 rip = 0x323d4f168d in clone (../sysdeps/unix/sysv/linux/x86_64/clone.S:115); saved rip <unavailable>
 Outermost frame: outermost
 caller of frame at 0x7ffff7fcafc0
 source language asm.
 Arglist at 0x7ffff7fcafb8, args:
 Locals at 0x7ffff7fcafb8, Previous frame's sp is 0x7ffff7fcafc8
(gdb)

Another place showing the issue with "merging" the errors
is here:

 static CORE_ADDR
 frame_unwind_pc (struct frame_info *this_frame)
 {
   CORE_ADDR pc;

   if (!frame_unwind_pc_if_available (this_frame, &pc))
     throw_error (NOT_AVAILABLE_ERROR, _("PC not available"));
   else
     return pc;
 }

This throws the wrong error with the wrong string if
frame_unwind_pc_if_available returned false due to
OPTIMIZED_OUT_ERROR.

So for that part of the series, I'd rather not go around and
sprinkle the is_unavailable_error wrapper function wherever
we use catch NOT_AVAILABLE_ERROR, but instead handle
OPTIMIZED_OUT_ERROR as needed.

I've posted a mini series that fixes the "info frame" case
above:

  https://sourceware.org/ml/gdb-patches/2013-11/msg00943.html

(I had actually tried to fix that before by making
frame_unwind_caller_pc return struct value, and gave up as that
grew quite messy quick.  Making use of your new OPTIMIZED_OUT_ERROR
ends up much simpler.)

> After this patch set there will be a single unified interface to ask
> if a value is available (either fully, partially, or for a range of
> bit/bytes), this will answer in terms of both optimized out and
> unavailable state.

On terminology: I'd much rather not overload the "available/unavailable"
words for this. It'll end up confusing, like "This value is
not available, because it was unavailable?  No, because it
was optimized out.".  Etc.

Thanks,
-- 
Pedro Alves


  parent reply	other threads:[~2013-11-29 20:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-12 12:15 Andrew Burgess
2013-08-12 12:16 ` [PATCH 01/12] Introduce is_unavailable_error Andrew Burgess
2013-08-12 12:18 ` [PATCH 02/12]: Remove set_value_optimized_out Andrew Burgess
2013-08-12 12:20 ` [PATCH 03/12] Mark optimized out values as non-lazy Andrew Burgess
2013-11-26 16:38   ` Pedro Alves
2013-11-26 19:19     ` Andrew Burgess
2013-08-12 12:22 ` [PATCH 04/12] Introduce OPTIMIZED_OUT_ERROR Andrew Burgess
2013-08-12 12:24 ` [PATCH 05/12] Convert the unavailable to be bit based Andrew Burgess
2013-08-12 12:27 ` [PATCH 06/12] Delete value_bits_valid Andrew Burgess
2013-11-25 21:41   ` [PATCH] Print entirely unavailable struct/union values as a single <unavailable>. (Re: [PATCH 06/12] Delete value_bits_valid.) Pedro Alves
2013-11-26 10:13     ` Andrew Burgess
2013-11-28 20:14       ` Pedro Alves
2013-08-12 12:28 ` [PATCH 07/12] Generic print unavailable or optimized out function Andrew Burgess
2013-08-12 12:29 ` [PATCH 08/12] Replace some value_optimized_out with value_entirely_available Andrew Burgess
2013-11-27 17:52   ` [COMMITTED PATCH 0/2] "set debug frame 1" and not saved registers (was: Re: [PATCH 08/12] Replace some value_optimized_out with value_entirely_available) Pedro Alves
2013-11-27 18:14     ` [PATCH 1/2] Make "set debug frame 1" use the standard print routine for optimized out values Pedro Alves
2013-11-27 18:35     ` [PATCH 2/2] Make "set debug frame 1" output print <not saved> instead of <optimized out> Pedro Alves
2013-11-27 18:41       ` Pedro Alves
2013-11-27 18:53         ` [pushed] Fix type of not saved registers. (was: Re: [PATCH 2/2] Make "set debug frame 1" output print <not saved> instead of <optimized out>.) Pedro Alves
2013-08-12 12:30 ` [PATCH 09/12] DWARF value, mark unavailable in bits not bytes Andrew Burgess
2013-08-12 12:31 ` [PATCH 10/12] Merge optimized_out into unavailable vector Andrew Burgess
2013-08-12 12:32 ` [PATCH 11/12] Add test mechanism for value " Andrew Burgess
2013-08-12 12:33 ` [PATCH 12/12] Remove old lval check valid functions Andrew Burgess
2013-08-29 17:21 ` PING: Re: [RFC 00/12] Merge value optimized_out and unavailable Andrew Burgess
2013-11-12  9:37   ` Andrew Burgess
2013-11-29 22:31 ` Pedro Alves [this message]
2013-12-04 14:54   ` Andrew Burgess

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=5298F718.8060104@redhat.com \
    --to=palves@redhat.com \
    --cc=aburgess@broadcom.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