From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23528 invoked by alias); 27 Feb 2020 23:37:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 23517 invoked by uid 89); 27 Feb 2020 23:37:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy= 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; Thu, 27 Feb 2020 23:37:23 +0000 Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1BD8D1E5F9; Thu, 27 Feb 2020 18:37:22 -0500 (EST) Subject: Re: [PATCH] gdb: Check for nullptr when computing srcpath To: Aaron Merey , gdb-patches@sourceware.org, cbiesinger@google.com References: <20200227221156.1248760-1-amerey@redhat.com> From: Simon Marchi Message-ID: Date: Thu, 27 Feb 2020 23:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200227221156.1248760-1-amerey@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2020-02/txt/msg01032.txt.bz2 On 2020-02-27 5:11 p.m., Aaron Merey wrote: > On Thu, Feb 27, 2020 at 2:18 PM Simon Marchi wrote: >> Please provide in the commit message an explanation of what this fixes, including >> how to reproduce the crash.  Since this fixes the execution of an existing test >> case, you can include the "make check" command line used to run it, like: >> >>   make check TESTS="gdb.dwarf2/dw2-ranges-base" > > Fixed. > >> Also, do you think you'd be able to send your patches using git-send-email? That makes >> it much easier to read and comment on. > > Sure. > > On Thu, Feb 27, 2020 at 2:33 PM Christian Biesinger wrote: >> +   if (build_id != nullptr && srcpath.size () > 0) >> >> I usually prefer !srcpath.empty () > > Fixed. > > Aaron > > > From d048f84f027006782cd96dc66a10477ed5a78243 Mon Sep 17 00:00:00 2001 > From: Aaron Merey > Date: Thu, 27 Feb 2020 15:51:11 -0500 > Subject: [PATCH] gdb: Check for nullptr when computing srcpath > > This fixes a regression caused by commit 0d79cdc494d5: > > $ make check TESTS="gdb.dwarf2/dw2-ranges-base.exp" > [...] > ERROR: GDB process no longer exists > > This error is caused by an abort during the computation of srcpath > when SYMTAB_DIRNAME (s) == NULL. > > Computing srcpath only when SYMTAB_DIRNAME (s) is not NULL fixes this > error. Also change the condition for calling debuginfod_source_query > to include whether srcpath could be computed. > > gdb/ChangeLog: > > 2020-02-27 Aaron Merey > > * source.c (open_source_file): Check for nullptr when computing > srcpath. Thanks, that LGTM. Simon