From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3FF9D384CBA1; Fri, 10 May 2024 07:00:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FF9D384CBA1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1715324425; bh=/N0czWaJTzEJDyR/XS9Q7iILZTIjcySi7W5qRqQgEac=; h=From:To:Subject:Date:In-Reply-To:References:From; b=BEu4t369o5pl9Y/UyxS6LK5EreoB0sAoHeUDRvEGG3tnpw7nmeRA3vCmzQ+y18LYp D1Vzm3CuzHkeBR+Oyrkdqe2Dcw9tbi2wq3DslvQGnPY1jron5qR9+ypbzQCx1xk3Ve kaSr3n/XsVxUcHKNRFVGVc82ofjQzC23p1h3XBuI= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/31563] Problems with accessing errno Date: Fri, 10 May 2024 07:00:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb 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: kevinb at redhat dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: 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=3D31563 Tom de Vries changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vries at gcc dot gnu.org --- Comment #2 from Tom de Vries --- FWIW, this: ... diff --git a/gdb/infcall.c b/gdb/infcall.c index 23d5652dd21..bf836c93152 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -1092,9 +1092,13 @@ call_function_by_hand_dummy (struct value *function, { const char *name =3D get_function_name (funaddr, name_buf, sizeof (name_buf)); - error (_("'%s' has unknown return type; " - "cast the call to its declared return type"), - name); + if (gdbarch_osabi (gdbarch) =3D=3D GDB_OSABI_LINUX + && strcmp (name, "__errno_location") =3D=3D 0) + values_type =3D lookup_pointer_type (builtin_type (gdbarch)->builtin_int); + else + error (_("'%s' has unknown return type; " + "cast the call to its declared return type"), + name); } values_type =3D check_typedef (values_type); ... gives a few xpasses on the new test-case: ... XPASS: gdb.base/check-errno.exp: macros: print errno XPASS: gdb.base/check-errno.exp: macros: print (int) errno XPASS: gdb.base/check-errno.exp: pthreads-macros: print errno XPASS: gdb.base/check-errno.exp: pthreads-macros: print (int) errno ... But it's still a bit hacky, in the sense that it doesn't fix ptype __errno_location, in other words, it only has effect when doing an inferior call. --=20 You are receiving this mail because: You are on the CC list for the bug.=