From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E2603858D20; Thu, 28 Sep 2023 10:48:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E2603858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1695898132; bh=qLVeYMlmVAvMhuwGd7lIIohZktUfsYQCYptL3ARCO+U=; h=From:To:Subject:Date:From; b=B967xJ9lipa9578ZeMAntYJJJWdkokvVLtrlL/rHf1EWRu+hV5L53l2IkrhXfo4aQ ENHvR7JuKXvf5Dp//FEyMHVcg5gI9CUGxpohmIO1/xpWTYXVMsyaK3XFN+qscu2wJT 6FExCd8CfYc/R3Yd70ghZ0xcdXtOmeqYPZgE3Kas= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug exp/30911] New: [gdb/exp] Cannot call ifunc strstr with debuginfo installed Date: Thu, 28 Sep 2023 10:48:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: exp 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=3D30911 Bug ID: 30911 Summary: [gdb/exp] Cannot call ifunc strstr with debuginfo installed Product: gdb Version: HEAD Status: NEW Severity: normal Priority: P2 Component: exp Assignee: unassigned at sourceware dot org Reporter: vries at gcc dot gnu.org Target Milestone: --- [ This report is based on fedora patch gdb-glibc-strstr-workaround.patch (s= ee also PR glibc/14166). ] Consider a hello world a.out with debug info. Without glibc debug info installed, I'm able to call strstr: ... $ gdb -q a.out -ex start -ex "p strstr" -ex "ptype strstr" Reading symbols from a.out... Temporary breakpoint 1 at 0x40051b: file hello.c, line 6. Starting program: /data/vries/gdb/a.out=20 Temporary breakpoint 1, main () at hello.c:6 6 printf ("hello\n"); $1 =3D {} 0x7ffff7e4f9ce type =3D () (gdb) p strstr ("haha", "ah") '__strstr_sse2_unaligned' has unknown return type; cast the call to its declared return type (gdb) p (char *)strstr ("haha", "ah") $2 =3D 0x7ffff7dab1b1 "aha" (gdb)=20 ... Now with glibc debug info installed: ... $ gdb -q a.out -ex start -ex "p strstr" -ex "ptype strstr" Reading symbols from a.out... Temporary breakpoint 1 at 0x40051b: file hello.c, line 6. Starting program: /data/vries/gdb/a.out=20 Temporary breakpoint 1, main () at hello.c:6 6 printf ("hello\n"); $1 =3D {} 0x7ffff7e4e9ce <__libc_strstr_ifunc> type =3D () (gdb) p strstr ("haha", "ah") $2 =3D void (gdb) p (char *)strstr ("haha", "ah") Invalid cast. (gdb)=20 ... This is with glibc 2.31 on openSUSE Leap 15.4. With glibc 2.38 on openSUSE Tumbleweed this doesn't happen. This seems to be caused by the fact that in the tumbleweed case we have an unspecified_type return type: ... <1><11dd5e>: Abbrev Number: 1 (DW_TAG_subprogram) <11dd5f> DW_AT_name : __strstr_sse2_unaligned <11dd63> DW_AT_external : 1 <11dd63> DW_AT_type : <0x11dd6e> <11dd64> DW_AT_low_pc : 0xb9c9e <11dd6c> DW_AT_high_pc : 1173 <1><11dd6e>: Abbrev Number: 3 (DW_TAG_unspecified_type) <1><11dd6f>: Abbrev Number: 0 ... and in the failing case there's no type at all, which defaults to void: ... <1><3e1e58>: Abbrev Number: 2 (DW_TAG_subprogram) <3e1e59> DW_AT_name : __strstr_sse2_unaligned <3e1e5d> DW_AT_external : 1 <3e1e5e> DW_AT_low_pc : 0xbbd2e <3e1e66> DW_AT_high_pc : 0xbc1c3 ... This is basically PR gas/29517, fixed in 2.40 but present in 2.39. What is curious though is that we do manage to find the correct type for the revolver function: ... (gdb) p __libc_strstr_ifunc $3 =3D {char *(*(void))(const char *, const char *)} 0x7ffff7e4e9ce <__libc_strstr_ifunc> ... but we don't use it. --=20 You are receiving this mail because: You are on the CC list for the bug.=