public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Kévin Le Gouguec" <legouguec@adacore.com>
To: Simon Marchi <simon.marchi@efficios.com>
Cc: gdb-patches@sourceware.org,  Luis Machado <luis.machado@arm.com>,
	 John Baldwin <jhb@freebsd.org>,
	 "Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
Subject: Re: [PATCH 12/24] gdb: make get_frame_register_bytes take the next frame
Date: Fri, 22 Dec 2023 14:33:14 +0100	[thread overview]
Message-ID: <87bkaiz7j9.fsf@adacore.com> (raw)
In-Reply-To: <20231201162751.741751-13-simon.marchi@efficios.com> (Simon Marchi's message of "Fri, 1 Dec 2023 11:27:25 -0500")

[-- Attachment #1: Type: text/plain, Size: 2990 bytes --]

Hey Simon!

Simon Marchi <simon.marchi@efficios.com> writes:

> Similar to the previous patches, change get_frame_register_bytes to take
> the "next frame" instead of "this frame".
>
> Change-Id: Ie8f35042bfa6e93565fcefaee71b6b3903f0fe9f
> Reviewed-By: John Baldwin <jhb@FreeBSD.org>
> ---
>  gdb/dwarf2/expr.c | 22 +++++++++++-----------
>  gdb/frame.c       | 16 ++++++----------
>  gdb/frame.h       | 10 +++++-----
>  gdb/i386-tdep.c   |  8 ++++----
>  gdb/i387-tdep.c   | 10 +++++-----
>  gdb/ia64-tdep.c   |  9 ++++-----
>  gdb/m68k-tdep.c   | 10 +++++-----
>  gdb/mips-tdep.c   |  7 ++++---
>  gdb/rs6000-tdep.c | 10 +++++-----
>  gdb/valops.c      |  3 +--
>  10 files changed, 50 insertions(+), 55 deletions(-)
>
[…]
> diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
> index c43039302bc3..643997e5bd7d 100644
> --- a/gdb/rs6000-tdep.c
> +++ b/gdb/rs6000-tdep.c
> @@ -2713,11 +2713,11 @@ rs6000_register_to_value (frame_info_ptr frame,
>       fpr to vsr.  */
>    regnum = ieee_128_float_regnum_adjust (gdbarch, type, regnum);
>  
> -  if (!get_frame_register_bytes (frame, regnum, 0,
> -				 gdb::make_array_view (from,
> -						       register_size (gdbarch,
> -								      regnum)),
> -				 optimizedp, unavailablep))
> +  auto from_view
> +    = gdb::make_array_view (from, register_size (gdbarch, regnum));
> +  frame_info_ptr next_frame = get_next_frame_sentinel_okay (frame);
> +  if (!get_frame_register_bytes (frame, regnum, 0, from_view, optimizedp,
                                    ^^^^^

Should this have been changed to 'next_frame', as the commit message
suggests, and as was done in the other *-tdep.c?

Asking because I'm observing a regression on ppc-linux in our internal
testsuite.  I've reproduced that regression with the O2_float_param
testcase:

  cd gdb/testsuite/gdb.ada/O2_float_param
  powerpc-linux-gnu-gnatmake foo.adb \
      -cargs -g -O2 -bargs -static -largs -static
  scp foo $TARGET:
  […gdb…] foo                                   \
      -batch                                    \
      -ex 'tbreak callee.increment'             \
      -ex 'target remote | ssh gdbserver - foo' \
      -ex continue

Expected:

  > Temporary breakpoint 1, callee.increment (val=val@entry=99.0, msg=...) at callee.adb:19

Currently, since 2023-12-14 "gdb: make get_frame_register_bytes take the
next frame" (9fc79b42369):

  > Temporary breakpoint 1, callee.increment (val=<optimized out>, val@entry=0.0, msg=...) at callee.adb:19

Applying the attached patch gets us the expected output back, and does
not introduce further regressions that I could find.  I've tried it on
top of both master and your recently submitted "register value cleanups"
series, <20231221191716.257256-1-simon.marchi@efficios.com>.

Let me know if I've missed something!

> +				 unavailablep))
>      return 0;
>  
>    target_float_convert (from, builtin_type (gdbarch)->builtin_double,


[-- Attachment #2: 0001-gdb-fix-refactoring-hiccup-in-rs6000_register_to_val.patch --]
[-- Type: text/x-diff, Size: 1584 bytes --]

From 0fae84368f22250cb672c467e56652103fbb8c49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <legouguec@adacore.com>
Date: Fri, 22 Dec 2023 14:06:15 +0100
Subject: [PATCH] gdb: fix refactoring hiccup in rs6000_register_to_value
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

In 2023-12-14 "gdb: make get_frame_register_bytes take the next frame"
(9fc79b42369), *_register_to_value functions were made to (a) call
get_next_frame_sentinel_okay (frame) (b) pass that next frame to
get_frame_register_bytes.

Step (b) was omitted for rs6000-tdep.c; this manifests as a regression on
PPC platforms for e.g. O2_float_param: instead of seeing…

  Temporary breakpoint 1, callee.increment (val=val@entry=99.0, msg=...) at callee.adb:19

… we get "optimized_out" for val.  Passing next_frame to
get_frame_register_bytes fixes the issue.
---
 gdb/rs6000-tdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 1c9bb3e5f04..f043be08355 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -2716,7 +2716,7 @@ rs6000_register_to_value (frame_info_ptr frame,
   auto from_view
     = gdb::make_array_view (from, register_size (gdbarch, regnum));
   frame_info_ptr next_frame = get_next_frame_sentinel_okay (frame);
-  if (!get_frame_register_bytes (frame, regnum, 0, from_view, optimizedp,
+  if (!get_frame_register_bytes (next_frame, regnum, 0, from_view, optimizedp,
 				 unavailablep))
     return 0;
 
-- 
2.34.1


  reply	other threads:[~2023-12-22 13:33 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 16:27 [PATCH 00/24] Fix reading and writing pseudo registers in non-current frames Simon Marchi
2023-12-01 16:27 ` [PATCH 01/24] gdb: don't handle i386 k registers as pseudo registers Simon Marchi
2023-12-01 16:27 ` [PATCH 02/24] gdb: use reg_buffer_common throughout gdbsupport/common-regcache.h Simon Marchi
2023-12-01 16:27 ` [PATCH 03/24] gdb: make store_integer take an array_view Simon Marchi
2023-12-01 16:27 ` [PATCH 04/24] gdb: simplify conditions in regcache::{read,write,raw_collect,raw_supply}_part Simon Marchi
2023-12-01 16:27 ` [PATCH 05/24] gdb: change regcache interface to use array_view Simon Marchi
2023-12-01 16:27 ` [PATCH 06/24] gdb: fix bugs in {get,put}_frame_register_bytes Simon Marchi
2023-12-01 16:27 ` [PATCH 07/24] gdb: make put_frame_register take an array_view Simon Marchi
2023-12-01 16:27 ` [PATCH 08/24] gdb: change value_of_register and value_of_register_lazy to take the next frame Simon Marchi
2023-12-01 16:27 ` [PATCH 09/24] gdb: remove frame_register Simon Marchi
2023-12-01 16:27 ` [PATCH 10/24] gdb: make put_frame_register take the next frame Simon Marchi
2023-12-01 16:27 ` [PATCH 11/24] gdb: make put_frame_register_bytes " Simon Marchi
2023-12-01 16:27 ` [PATCH 12/24] gdb: make get_frame_register_bytes " Simon Marchi
2023-12-22 13:33   ` Kévin Le Gouguec [this message]
2023-12-22 15:31     ` Simon Marchi
2023-12-22 16:22       ` Kévin Le Gouguec
2023-12-01 16:27 ` [PATCH 13/24] gdb: add value::allocate_register Simon Marchi
2023-12-01 16:27 ` [PATCH 14/24] gdb: read pseudo register through frame Simon Marchi
2023-12-01 16:27 ` [PATCH 15/24] gdb: change parameter name in frame_unwind_register_unsigned declaration Simon Marchi
2023-12-01 16:27 ` [PATCH 16/24] gdb: rename gdbarch_pseudo_register_write to gdbarch_deprecated_pseudo_register_write Simon Marchi
2023-12-01 16:27 ` [PATCH 17/24] gdb: add gdbarch_pseudo_register_write that takes a frame Simon Marchi
2023-12-01 16:27 ` [PATCH 18/24] gdb: migrate i386 and amd64 to the new gdbarch_pseudo_register_write Simon Marchi
2023-12-01 16:27 ` [PATCH 19/24] gdb: make aarch64_za_offsets_from_regnum return za_offsets Simon Marchi
2023-12-01 16:27 ` [PATCH 20/24] gdb: add missing raw register read in aarch64_sme_pseudo_register_write Simon Marchi
2023-12-01 16:27 ` [PATCH 21/24] gdb: migrate aarch64 to new gdbarch_pseudo_register_write Simon Marchi
2023-12-14 14:53   ` Luis Machado
2023-12-01 16:27 ` [PATCH 22/24] gdb: migrate arm to gdbarch_pseudo_register_read_value Simon Marchi
2023-12-01 16:27 ` [PATCH 23/24] gdb: migrate arm to new gdbarch_pseudo_register_write Simon Marchi
2023-12-01 16:27 ` [PATCH 24/24] gdb/testsuite: add tests for unwinding of pseudo registers Simon Marchi
2023-12-14 14:54   ` Luis Machado
2023-12-01 16:56 ` [PATCH 00/24] Fix reading and writing pseudo registers in non-current frames Simon Marchi
2023-12-14 14:51 ` Luis Machado
2023-12-14 16:20   ` Simon Marchi
  -- strict thread matches above, loose matches on Subject: below --
2023-11-08  5:00 Simon Marchi
2023-11-08  5:00 ` [PATCH 12/24] gdb: make get_frame_register_bytes take the next frame Simon Marchi

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=87bkaiz7j9.fsf@adacore.com \
    --to=legouguec@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@freebsd.org \
    --cc=luis.machado@arm.com \
    --cc=simon.marchi@efficios.com \
    --cc=tankut.baris.aktemur@intel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).