From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NEw7HfH4+1+jDQAAWB0awg (envelope-from ) for ; Mon, 11 Jan 2021 02:06:25 -0500 Received: by simark.ca (Postfix, from userid 112) id 68F6B1EEEF; Mon, 11 Jan 2021 02:06:25 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 046341E590 for ; Mon, 11 Jan 2021 02:06:25 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CC54F3850430; Mon, 11 Jan 2021 07:06:23 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id C311D3850430 for ; Mon, 11 Jan 2021 07:06:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C311D3850430 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D1CBFAB7A; Mon, 11 Jan 2021 07:06:20 +0000 (UTC) Date: Mon, 11 Jan 2021 08:06:19 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix gdb.arch/amd64-stap-three-arg-disp.S Message-ID: <20210111070618.GA2149@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sergiodj@sergiodj.net Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, On SLE-11 I ran into: ... (gdb) print $_probe_arg0^M Cannot access memory at address 0x8000003fe05c^M (gdb) FAIL: gdb.arch/amd64-stap-special-operands.exp: probe: three_arg: \ print $_probe_arg0 ... The memory cannot be accessed because the address used to evaluate $_probe_arg0 at the probe point is incorrect. The address is calculated using this expression: ... .asciz "-4@-4(%rbp,%ebx,0)" ... which uses $ebx, but $ebx is uninitialized at the probe point. The test-case does contain a "movl $0, %ebx" insn to set $ebx to 0, but that insn is placed after the probe point. We could fix this by moving the insn to before the probe point. But, $ebx is also a callee-save register, so normally, if we modify it, we also need to save and restore it, which is currently not done. This is currently not harmful, because we don't run the test-case further than the probe point, but it's bound to cause confusion. So, fix this instead by using $eax instead in the expression, and moving the insn setting $eax to 0 to before the probe point. Any comments? Thanks, - Tom [gdb/testsuite] Fix gdb.arch/amd64-stap-three-arg-disp.S gdb/testsuite/ChangeLog: 2021-01-10 Tom de Vries PR testsuite/26968 * gdb.arch/amd64-stap-three-arg-disp.S: Remove insn modifying $ebx. Move insn setting $eax to before probe point. --- gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S b/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S index cf3856f41e9..17b64048082 100644 --- a/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S +++ b/gdb/testsuite/gdb.arch/amd64-stap-three-arg-disp.S @@ -15,6 +15,7 @@ main: movl %edi, -20(%rbp) movq %rsi, -32(%rbp) movl $10, -4(%rbp) + movl $0, %eax #APP # 8 "amd64-stap-three-arg-disp.c" 1 990: nop @@ -28,7 +29,7 @@ main: .8byte 0 .asciz "test" .asciz "three_arg" -.asciz "-4@-4(%rbp,%ebx,0)" +.asciz "-4@-4(%rbp,%eax,0)" 994: .balign 4 .popsection @@ -45,8 +46,6 @@ _.stapsdt.base: .space 1 # 0 "" 2 #NO_APP - movl $0, %eax - movl $0, %ebx popq %rbp .cfi_def_cfa 7, 8 # SUCC: EXIT [100.0%]