From patchwork Sun Dec 23 15:20:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 30822 Received: (qmail 3558 invoked by alias); 23 Dec 2018 15:20:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3543 invoked by uid 89); 23 Dec 2018 15:20:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1036, H*M:61c3, H*Ad:D*ca, his X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 23 Dec 2018 15:20:38 +0000 Received: from [10.0.0.11] (unknown [192.222.164.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9C3871E4C2; Sun, 23 Dec 2018 10:20:36 -0500 (EST) Subject: Re: [PATCH] Fix a crash in jit.c To: Tom Tromey , gdb-patches@sourceware.org References: <20181221185415.20964-1-tom@tromey.com> From: Simon Marchi Message-ID: <882f1e5f-61c3-09ce-17c7-c4c1e28a5d91@simark.ca> Date: Sun, 23 Dec 2018 10:20:36 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <20181221185415.20964-1-tom@tromey.com> On 2018-12-21 1:54 p.m., Tom Tromey wrote: > A user at Mozilla pointed out a crash in jit.c. In his situation, an > inferior using the JIT API exec'd an executable that did not use it. > This caused an assertion failure when jit.c:free_objfile_data called > delete_breakpoint with NULL. > > This patch fixes the problem in the obvious way. New test case > included. The fix itself LGTM. Using "run" in the test, however, makes it not work with the native-gdbserver board. Changing it to this works for me: Simon diff --git a/gdb/testsuite/gdb.base/jit-exec.exp b/gdb/testsuite/gdb.base/jit-exec.exp index 74c6fa7a430f..514e01ffeaed 100644 --- a/gdb/testsuite/gdb.base/jit-exec.exp +++ b/gdb/testsuite/gdb.base/jit-exec.exp @@ -43,7 +43,10 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \ clean_restart $binfile -runto_main -delete_breakpoints +if ![runto_main] { + fail "can't run to main" + return +} +delete_breakpoints gdb_test "continue" "Inferior .* exited normally.*"