From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4BEE13858288; Tue, 3 Jan 2023 10:53:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4BEE13858288 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672743197; bh=SIq9BNDDtNyYzd7chzy6E80LGVLoEqS/FYCWAU/xJvg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HQFcMvmgi1Tw5J7tSk1fgweovdBdSwfmbAnaQzG6W2WtsT6bwIlhV+Y50y9PiAQRK n42x32VAR4VxZ3kn/SpgTDi67gdwEIlFhKw5f5Cr2XSDoSDduKTlAM/nDtiXUrUBa4 MNzEB9AOKsf7OiRxHYX7qq2JBRnSyjwsSDqVu7dw= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug gdb/29941] Inferior call strlen(p) gives segfaults in GDB 13, (somewhat?) works in GDB11 and GDB12 Date: Tue, 03 Jan 2023 10:53:16 +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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: 13.1 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D29941 --- Comment #6 from cvs-commit at gcc dot gnu.org --- The gdb-13-branch branch has been updated by Tom de Vries : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D322fde46dcc3= a954992af8650a6c1200a670b973 commit 322fde46dcc3a954992af8650a6c1200a670b973 Author: Andrew Burgess Date: Tue Jan 3 11:53:09 2023 +0100 [gdb] Fix segfault during inferior call to ifunc With a simple test-case: ... $ cat test.c char *p =3D "a"; int main (void) { return strlen (p); } $ gcc -g test.c ... we run into this segfault: ... $ gdb -q -batch a.out -ex start -ex "p strlen (p)" Temporary breakpoint 1 at 0x1151: file test.c, line 4. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.= 1". Temporary breakpoint 1, main () at test.c:4 4 return strlen (p); Fatal signal: Segmentation fault ... The strlen is an ifunc, and consequently during the call to call_function_by_hand_dummy for "p strlen (p)" another call to call_function_by_hand_dummy is used to resolve the ifunc. This invalidates the get_current_frame () result in the outer call. Fix this by using prepare_reinflate and reinflate. Note that this series ( =20=20=20 https://inbox.sourceware.org/gdb-patches/20221214033441.499512-1-simon.marc= hi@polymtl.ca/ ) should address this problem, but this patch is a simpler fix which is e= asy to backport. Tested on x86_64-linux. Co-Authored-By: Tom de Vries PR gdb/29941 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29941 --=20 You are receiving this mail because: You are on the CC list for the bug.=