From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7833) id B4EB93858D35; Tue, 7 May 2024 09:34:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B4EB93858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1715074488; bh=aVzrsxkhc+UrvWeU6ThNmmyNnZts6AQxE32JVzemjmU=; h=From:To:Subject:Date:From; b=kBbv6nZoLdAWTkJeje4ivZIbgoes6UGxc9GW6Lq3lMl4ukKXnsJ6pNaC5Y9DXA+qb CEP70hVJHP6e5Tpd4HElzV2XNmh7PQu4yFXQz0wjYVY0ZujwDjdHFTnsDwrsI+eDv6 hNZ1PT+xDs4r8Pvtn9+dinA/8gG3kyMVJUdJOMvw= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Lancelot SIX To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite/lib/rocm: Fix with_rocm_gpu_lock X-Act-Checkin: binutils-gdb X-Git-Author: Lancelot SIX X-Git-Refname: refs/heads/master X-Git-Oldrev: d264d04ac4ce418d2f42bf2da270325ad667d8ce X-Git-Newrev: 20100e09dd0f90c1f45a399ae052ddbf6b2b20c1 Message-Id: <20240507093448.B4EB93858D35@sourceware.org> Date: Tue, 7 May 2024 09:34:48 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D20100e09dd0f= 90c1f45a399ae052ddbf6b2b20c1 commit 20100e09dd0f90c1f45a399ae052ddbf6b2b20c1 Author: Lancelot SIX Date: Tue May 7 09:49:51 2024 +0100 gdb/testsuite/lib/rocm: Fix with_rocm_gpu_lock =20 A recent commit refactored with_rocm_gpu_lock: =20 commit fbb0edfe60edf4ca01884151e6d9b1353aaa0a7e Date: Sat May 4 10:41:09 2024 +0200 =20 [gdb/testsuite] Factor out proc with_lock =20 Factor out proc with_lock from with_rocm_gpu_lock, and move req= uired procs lock_file_acquire and lock_file_release to lib/gdb-utils.exp. =20 This causes regressions in gdb.rocm/*.exp (as well as in downstream rocgdb). The issue can be reproduced in the following minimal test: =20 load_lib rocm.exp set foo hello with_rocm_gpu_lock { verbose -logs $foo } =20 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. =20 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. =20 Approved-By: Tom de Vries =20 Change-Id: I79ce2c9615012215867ed5bb60144abe7dce28fe Diff: --- 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. =20 proc with_rocm_gpu_lock { body } { - with_lock $::gpu_lock_filename $body + with_lock $::gpu_lock_filename {uplevel 1 $body} =20 # In case BODY returned early due to some testcase failing, and # left GDB running, debugging the GPU.