From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2038F3858C66; Sun, 8 Sep 2024 07:28:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2038F3858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1725780509; bh=pSLTO/WqzfJh3HpP9hVMmpxfxZjG7k4sukuGKeomOTM=; h=From:To:Subject:Date:From; b=Qqv486MIoCWclS+975X5kO+eG3+iKvtzobuw+CKCO5bj0eA0/jETfYT6n3MkY9JSN 4g0j8zxP/sxUwzbPJmoZruj4CW3y7qB6vhmXpoeSdxnHCk9mkTXgvwMk3ORzJimj/w OI1frCDV6ic2cOgZ9S17h9huPEPWhvJl9jmTgLto= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug tdep/32152] New: [gdb/tdep, riscv64] FAIL: gdb.cp/non-trivial-retval.exp: finish from f1 Date: Sun, 08 Sep 2024 07:28:28 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: tdep X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D32152 Bug ID: 32152 Summary: [gdb/tdep, riscv64] FAIL: gdb.cp/non-trivial-retval.exp: finish from f1 Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: tdep Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- On riscv64-linux, I ran into: ... (gdb) finish^M Run till exit from #0 f1 (i1=3Di1@entry=3D23, i2=3Di2@entry=3D100) at non-trivial-retval.cc:34^M main () at non-trivial-retval.cc:163^M 163 B b =3D f2 (i1, i2);^M Value returned is $6 =3D {a =3D -5856}^M (gdb) FAIL: gdb.cp/non-trivial-retval.exp: finish from f1 ... The problem is that gdb thinks that the return value is in $a0: ... $ gdb -q -batch non-trivial-retval \ -ex "b f1" \ -ex run \ -ex "set debug riscv infcall on" \ -ex finish Breakpoint 1 at 0x80a: file non-trivial-retval.cc, line 34. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/riscv64-linux-gnu/libthread_db.so.1". Breakpoint 1, f1 (i1=3Di1@entry=3D23, i2=3Di2@entry=3D100) at non-trivial-r= etval.cc:34 34 { [riscv-infcall] riscv_return_value: [R] type: 'A', length: 0x4, alignment: = 0x4, register a0 [riscv-infcall] riscv_return_value: [R] type: 'A', length: 0x4, alignment: = 0x4, register a0 [riscv-infcall] riscv_return_value: [R] type: 'A', length: 0x4, alignment: = 0x4, register a0 main () at non-trivial-retval.cc:163 163 B b =3D f2 (i1, i2); Value returned is $1 =3D {a =3D -3568} ... while $a0 actually contains a pointer to the returned value 123: ... (gdb) p /x $a0 $3 =3D 0x3ffffff210 (gdb) p *((unsigned int *)$a0) $5 =3D 123 ... which is instead interpreted as an int: ... (gdb) p (int) $a0 $6 =3D -3568 ... The system gcc compiler is configured with --with-abi=3Dlp64d. --=20 You are receiving this mail because: You are on the CC list for the bug.=