From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 71BCE3848023; Mon, 2 Aug 2021 16:06:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71BCE3848023 From: "cvs-commit at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: [Bug varobj/28131] Segfault in gdbpy_enter_varobj::gdbpy_enter_varobj when debugging in VS Code Date: Mon, 02 Aug 2021 16:06:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: varobj X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: tromey at sourceware dot org X-Bugzilla-Target-Milestone: 11.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 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 16:06:10 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28131 --- Comment #7 from cvs-commit at gcc dot gnu.org --- The gdb-11-branch branch has been updated by Tom Tromey : https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D3e5ec878a43a= c06624a2cc816a329d9b22b95cac commit 3e5ec878a43ac06624a2cc816a329d9b22b95cac Author: Tom Tromey Date: Fri Jul 30 11:18:36 2021 -0600 Avoid crash in varobj deletion PR varobj/28131 points out a crash in the varobj deletion code. It took a while to reproduce this, but essentially what happens is that a top-level varobj deletes its root object, then deletes the "dynamic" object. However, deletion of the dynamic object may cause ~py_varobj_iter to run, which in turn uses gdbpy_enter_varobj: gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var) : gdbpy_enter (var->root->exp->gdbarch, var->root->exp->language_defn) { } However, because var->root has already been destroyed, this is invalid. I've added a new test case. This doesn't reliably crash, but the problem can easily be seen under valgrind (and, I presume, with ASAN, though I did not try this). Tested on x86-64 Fedora 32. I also propose putting this on the GDB 11 branch, with a suitable ChangeLog entry of course. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D28131 (cherry picked from commit 4d0754c5f572b01cf2fe6c8ab292adba83331cbc) gdb/ChangeLog 2021-08-02 Tom Tromey PR varobj/28131 * varobj.c (~varobj): Delete 'dynamic' before 'root'. gdb/testsuite/ChangeLog 2021-08-02 Tom Tromey PR varobj/28131 * gdb.python/py-mi-var-info-path-expression.exp: Add regression test. --=20 You are receiving this mail because: You are on the CC list for the bug.=