public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lancelot.six@amd.com>
To: <gdb-patches@sourceware.org>
Cc: <tdevries@suse.de>, Lancelot SIX <lancelot.six@amd.com>
Subject: [PATCH] gdb/testsuite/lib/rocm: Fix with_rocm_gpu_lock
Date: Tue, 7 May 2024 10:17:23 +0100	[thread overview]
Message-ID: <20240507091723.107082-1-lancelot.six@amd.com> (raw)

A recent commit refactored with_rocm_gpu_lock:

    commit fbb0edfe60edf4ca01884151e6d9b1353aaa0a7e
    Date:   Sat May 4 10:41:09 2024 +0200

        [gdb/testsuite] Factor out proc with_lock

        Factor out proc with_lock from with_rocm_gpu_lock, and move required procs
        lock_file_acquire and lock_file_release to lib/gdb-utils.exp.

This causes regressions in gdb.rocm/*.exp (as well as in downstream
ROCgdb).  The issue can be reproduced in the following minimal test:

    load_lib rocm.exp
    set foo hello
    with_rocm_gpu_lock {
        verbose -logs $foo
    }

The issue is that the body to execute under the lock is executed in the
context of with_rocm_gpu_lock (uplevel 1 used in with_lock) instead of
in the context of the "original" caller.

This patch adjusted with_rocm_gpu_lock to account for the new extra
frame in the call stack between the caller of with_rocm_gpu_lock and
where the code execution is triggered.

Change-Id: I79ce2c9615012215867ed5bb60144abe7dce28fe
---
 gdb/testsuite/lib/rocm.exp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/rocm.exp b/gdb/testsuite/lib/rocm.exp
index 2276bb3640e..b2db0d5c783 100644
--- a/gdb/testsuite/lib/rocm.exp
+++ b/gdb/testsuite/lib/rocm.exp
@@ -112,7 +112,7 @@ set gpu_lock_filename gpu-parallel.lock
 # the GPU lock.
 
 proc with_rocm_gpu_lock { body } {
-    with_lock $::gpu_lock_filename $body
+    with_lock $::gpu_lock_filename {uplevel 1 $body}
 
     # In case BODY returned early due to some testcase failing, and
     # left GDB running, debugging the GPU.

base-commit: cdf5362f562ad605199f28db686f93251979ae5d
-- 
2.34.1


             reply	other threads:[~2024-05-07  9:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  9:17 Lancelot SIX [this message]
2024-05-07  9:33 ` Tom de Vries
2024-05-07  9:37   ` Lancelot SIX

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=20240507091723.107082-1-lancelot.six@amd.com \
    --to=lancelot.six@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).