public inbox for gdb-prs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.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 [thread overview] Message-ID: <bug-29941-4717-CxyeT63M6W@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-29941-4717@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=29941 --- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The gdb-13-branch branch has been updated by Tom de Vries <vries@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=322fde46dcc3a954992af8650a6c1200a670b973 commit 322fde46dcc3a954992af8650a6c1200a670b973 Author: Andrew Burgess <aburgess@redhat.com> 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 = "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 ( https://inbox.sourceware.org/gdb-patches/20221214033441.499512-1-simon.marchi@polymtl.ca/ ) should address this problem, but this patch is a simpler fix which is easy to backport. Tested on x86_64-linux. Co-Authored-By: Tom de Vries <tdevries@suse.de> PR gdb/29941 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29941 -- You are receiving this mail because: You are on the CC list for the bug.
prev parent reply other threads:[~2023-01-03 10:53 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-12-25 20:47 [Bug gdb/29941] New: " philippe.waroquiers at skynet dot be 2022-12-25 23:37 ` [Bug gdb/29941] " mark at klomp dot org 2022-12-26 7:39 ` vries at gcc dot gnu.org 2022-12-26 12:59 ` aburgess at redhat dot com 2022-12-26 13:08 ` vries at gcc dot gnu.org 2023-01-03 9:18 ` cvs-commit at gcc dot gnu.org 2023-01-03 10:53 ` cvs-commit at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-29941-4717-CxyeT63M6W@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=gdb-prs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).