Message ID | 20250111084519.4469-1-tdevries@suse.de |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4A99B3857829 for <patchwork@sourceware.org>; Sat, 11 Jan 2025 08:47:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4A99B3857829 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Eq73npPB; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XLljy9qP; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Eq73npPB; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=XLljy9qP X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 053623858401 for <gdb-patches@sourceware.org>; Sat, 11 Jan 2025 08:45:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 053623858401 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 053623858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736585138; cv=none; b=sCvVdyRVrCR/Q+VjogXGKObp7U1A082HV+9g6OzhWtSwurDal5K8Rpqph9ndQX7XY1R9FU8ljy/x8v/8rH9tsXJaa7tclwq0Wq9bZpMGUCqjBv6EyWb6iC5tvRNTA2IJvBk7KhWwozvHrZm1CUg1V4jvbMDdyLmlWAdMCpHg4pI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736585138; c=relaxed/simple; bh=EkULAM+r7NkHmotrtP8OH5bWAcklN5psB7eQ3jmC5tQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=CGqzWErXs38WLRwxpyA9bDqpqk8JMaFMG9eTqELrcg5Nb/KUMs1ctAKm8uzeJFJabkaTNBFKIgd05x/zJf+MaiuAjkmDUA8OCyy5sn7LjxUk6vIg6esGpBq/uXq/Jek+mQiq5Ut7xKeBEdfjJYBGjFVnXwc5fMJ2sd/9hR/alY0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 053623858401 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C420C1F365; Sat, 11 Jan 2025 08:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1736585136; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XuGs1173ZEzST1VrueE4WF0umtvSKlP1fS+7F5EjOew=; b=Eq73npPBjd0mfghFdfPD+J4EVhiKzaqJT/mu8ZjluUUCWrmnRmIgczpctZaZzleqjU2Si/ otRugodbrjytAXJ/6kUsj9sab0+iEuf5K7kvY4FolxnFDzBzOYojbypaY+eOV/T8tJWRX1 VJckLBuO1vp5NYqelyeVB8ZMcrfc0Kw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1736585136; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XuGs1173ZEzST1VrueE4WF0umtvSKlP1fS+7F5EjOew=; b=XLljy9qPQljeozh0RyzEGkmKHOuLG0I5mu+vIUiBtjgA7ys2DdI4WbCpitBv1L6tKZNHyV d2YMPl78F7J2R3Cg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1736585136; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XuGs1173ZEzST1VrueE4WF0umtvSKlP1fS+7F5EjOew=; b=Eq73npPBjd0mfghFdfPD+J4EVhiKzaqJT/mu8ZjluUUCWrmnRmIgczpctZaZzleqjU2Si/ otRugodbrjytAXJ/6kUsj9sab0+iEuf5K7kvY4FolxnFDzBzOYojbypaY+eOV/T8tJWRX1 VJckLBuO1vp5NYqelyeVB8ZMcrfc0Kw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1736585136; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=XuGs1173ZEzST1VrueE4WF0umtvSKlP1fS+7F5EjOew=; b=XLljy9qPQljeozh0RyzEGkmKHOuLG0I5mu+vIUiBtjgA7ys2DdI4WbCpitBv1L6tKZNHyV d2YMPl78F7J2R3Cg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9AC7E139AB; Sat, 11 Jan 2025 08:45:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id pkWAI7AvgmcwEgAAD6G6ig (envelope-from <tdevries@suse.de>); Sat, 11 Jan 2025 08:45:36 +0000 From: Tom de Vries <tdevries@suse.de> To: gdb-patches@sourceware.org Cc: Andreas Arnez <arnez@linux.ibm.com> Subject: [PATCH] [gdb/tdep] Fix gdb.ada/O2_float_param.exp on s390x-linux Date: Sat, 11 Jan 2025 09:45:19 +0100 Message-ID: <20250111084519.4469-1-tdevries@suse.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid]; RCVD_TLS_ALL(0.00)[] X-Spam-Level: X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> Errors-To: gdb-patches-bounces~patchwork=sourceware.org@sourceware.org |
Series |
[gdb/tdep] Fix gdb.ada/O2_float_param.exp on s390x-linux
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_gdb_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_gdb_check--master-arm | success | Test passed |
Commit Message
Tom de Vries
Jan. 11, 2025, 8:45 a.m. UTC
With test-case gdb.ada/O2_float_param.exp on s390x-linux, I get: ... (gdb) frame^M #0 callee.increment (val=99.0, val@entry=<error reading variable: \ register has not been saved in frame>, msg=...) at callee.adb:19^M 19 procedure Increment (Val : in out Float; Msg: String) is^M (gdb) FAIL: $exp: scenario=all: frame ... The frame command calls read_frame_arg to get: - the current value of val, and - the value of val at function entry. The first scenario succeeds, and the second scenario fails. For context and contrast, let's also investigate the first scenario: getting the current value of val. Function parameter val: ... <2><b51>: Abbrev Number: 4 (DW_TAG_formal_parameter) <b52> DW_AT_name : val <b58> DW_AT_type : <0xb86> <b5c> DW_AT_location : 0xab (location list) ... has location list: ... 000000ab 0000000001002928 0000000001002967 (DW_OP_reg16 (f0)) 000000be 0000000001002967 0000000001002968 (DW_OP_reg24 (f8)) 000000d1 0000000001002968 0000000001002974 (DW_OP_GNU_regval_type: 24 (f8) <0xb29>; DW_OP_GNU_const_type: <0xb29> 4 byte block: 3f 80 0 0 ; DW_OP_plus; DW_OP_stack_value) 000000ef 0000000001002974 0000000001002982 (DW_OP_GNU_entry_value: (DW_OP_GNU_regval_type: 16 (f0) <0xb29>); DW_OP_GNU_const_type: <0xb29> 4 byte block: 3f 80 0 0 ; DW_OP_plus; DW_OP_stack_value) 0000010f <End of list> ... and since we're stopped at address 0x1002928: ... (gdb) print $pc $1 = (access procedure) 0x1002928 <callee.increment> ... we get the value from dwarf register 16. The s390x ABI specifies that dwarf register 16 maps onto 8-byte register f0 or 16-byte register v0 (where f0 is part of v0), and in this case (because the v0 register is available) s390_dwarf_reg_to_regnum maps it to v0. Val is only 4 bytes: ... (gdb) ptype val type = <4-byte float> ... and s390_value_from_register takes care to get the value from the correct part of v0. The value of v0 is found in the prologue cache, and the value of parameter val is printed. Now the second scenario: getting the value of val at function entry. FWIW, since we're stopped at function entry, we could simply return the same value, reading the same register, but that's currently not implemented [2]. Instead we start from the fact that val is in dwarf reg 16 at function entry, and then use call site information: ... <4><cf7>: Abbrev Number: 13 (DW_TAG_GNU_call_site) <cf8> DW_AT_low_pc : 0x1002a46 <d00> DW_AT_abstract_origin: <0xdda> <5><d04>: Abbrev Number: 12 (DW_TAG_GNU_call_site_parameter) <d05> DW_AT_location : 1 byte block: 60 (DW_OP_reg16 (f0)) <d07> DW_AT_GNU_call_site_value: 3 byte block: f5 18 2d \ (DW_OP_GNU_regval_type: 24 (f8) <0xc42>) <5><d0b>: Abbrev Number: 12 (DW_TAG_GNU_call_site_parameter) ... to conclude that the value we're looking for is in dwarf reg 24, which s390_dwarf_reg_to_regnum maps to v8. As before, s390_value_from_register takes care to get the value from the correct part of v8. However, v8 is not available in the prologue cache, and we take a different path and end up in s390_unwind_pseudo_register, where v8 and similar (regnum_is_vxr_full) is unhandled, and we get: ... return value::allocate_optimized_out (type); ... which eventually causes the "error reading variable: register has not been saved in frame". Fix this by handling the regnum_is_vxr_full case in s390_unwind_pseudo_register, similar to how that is done in s390_pseudo_register_read. Tested on s390x-linux. This also fixes test-case gdb.base/savedregs.exp. [1] https://github.com/IBM/s390x-abi [2] https://sourceware.org/pipermail/gdb-patches/2024-September/211589.html --- gdb/s390-tdep.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) base-commit: e564115c8a0e8f9b993cf0add01fa34548005d20
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 36a70d8642c..c57b6119e63 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -2310,6 +2310,22 @@ s390_unwind_pseudo_register (const frame_info_ptr &this_frame, int regnum) return value_cast (type, val); } + if (regnum_is_vxr_full (tdep, regnum)) + { + struct value *val = value::allocate_register (this_frame, regnum); + + int reg = regnum - tdep->v0_full_regnum; + struct value *val1 + = frame_unwind_register_value (this_frame, S390_F0_REGNUM + reg); + struct value *val2 + = frame_unwind_register_value (this_frame, S390_V0_LOWER_REGNUM + reg); + + val1->contents_copy (val, 0, 0, 8); + val2->contents_copy (val, 8, 0, 8); + + return value_cast (type, val); + } + return value::allocate_optimized_out (type); }