From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 41E7C3857B85; Mon, 10 Oct 2022 10:14:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41E7C3857B85 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665396848; bh=laWQqpSAhTUm2q8BpUE02iPo6ChY5HuXfycVJhEFTao=; h=From:To:Subject:Date:In-Reply-To:References:From; b=D3AZ4jKHkkIWeUbEkF4KDFtnMFxAqmxaLZgxGZES24k1lBA8GzbMhnRR5DN19BSMC Q3WU+o21eQtGdb+Zs4jYZsi5sV3oUt/X1usSq2tXe93+YT9qY6W/hs1XVkQhCmvfWP iwmleGAjCyKwDalGIRQLt6iKgOuPwwh3k05jp8yk= From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug python/28856] Python pretty printer causes stack overflow when printing frame arguments Date: Mon, 10 Oct 2022 10:14:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: python X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 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=3D28856 --- Comment #9 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by Bruno Larsen : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc29a6445a981= cee5e8eebe3617ef5c049fd3409f commit c29a6445a981cee5e8eebe3617ef5c049fd3409f Author: Bruno Larsen Date: Mon Jul 25 14:06:37 2022 -0300 gdb/frame: Add reinflation method for frame_info_ptr Currently, despite having a smart pointer for frame_infos, GDB may attempt to use an invalidated frame_info_ptr, which would cause internal errors to happen. One such example has been documented as PR python/28856, that happened when printing frame arguments calls an inferior function. To avoid failures, the smart wrapper was changed to also cache the frame id, so the pointer can be reinflated later. For this to work, the frame-id stuff had to be moved to their own .h file, which is included by frame-info.h. Frame_id caching is done explicitly using the prepare_reinflate method. Caching is done manually so that only the pointers that need to be saved will be, and reinflating has to be done manually using the reinflate method because the get method and the -> operator must not change the internals of the class. Finally, attempting to reinflate when the pointer is being invalidated causes the following assertion errors: check_ptrace_stopped_lwp_gone: assertion `lp->stopped` failed. get_frame_pc: Assertion `frame->next !=3D NULL` failed. As for performance concerns, my personal testing with `time make chec-perf GDB_PERFTEST_MODE=3Drun` showed an actual reduction of around 10% of time running. This commit also adds a testcase that exercises the python/28856 bug wi= th 7 different triggers, run, continue, step, backtrace, finish, up and do= wn. Some of them can seem to be testing the same thing twice, but since this test relies on stale pointers, there is always a chance that GDB got lu= cky when testing, so better to test extra. Regression tested on x86_64, using both gcc and clang. Approved-by: Tom Tomey --=20 You are receiving this mail because: You are on the CC list for the bug.=