Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Guinevere Larsen <guinevere@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb: modernize get_frame_pc_if_available
Date: Thu, 14 Aug 2025 10:08:00 -0600	[thread overview]
Message-ID: <87o6shnaxr.fsf@tromey.com> (raw)
In-Reply-To: <20250813202138.2311478-1-guinevere@redhat.com> (Guinevere Larsen's message of "Wed, 13 Aug 2025 17:21:38 -0300")

>>>>> "Guinevere" == Guinevere Larsen <guinevere@redhat.com> writes:

Guinevere> The convenience function get_frame_pc_if_available would take a pointer
Guinevere> to a variable that should be set if available, and would return a
Guinevere> boolean indicating whether that action was successful or not.

Thanks.

Guinevere> -  if (!get_frame_pc_if_available (frame, &pc))
Guinevere> +  if (!(pc = get_frame_pc_if_available (frame)))

This is kind of cheating but in most spots in the patch it is cleaner
than the alternative.  So I'm inclined to let it slide.

Guinevere>    annotate_frame_begin (print_level ? frame_relative_level (frame) : 0,
Guinevere> -			gdbarch, pc);
Guinevere> +			gdbarch, (pc.has_value ()) ? *pc : 0);

I think this can be written: pc.value_or (0).
Ok with that change.

Approved-By: Tom Tromey <tom@tromey.com>

Tom

  reply	other threads:[~2025-08-14 16:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 13:03 [PATCH] " Guinevere Larsen
2025-08-13 18:21 ` Tom Tromey
2025-08-13 19:00   ` Guinevere Larsen
2025-08-13 20:21 ` [PATCH v2] " Guinevere Larsen
2025-08-14 16:08   ` Tom Tromey [this message]
2025-08-14 16:40     ` Guinevere Larsen

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=87o6shnaxr.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=guinevere@redhat.com \
    /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