From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id QL/7LXlZ0GAcNQAAWB0awg (envelope-from ) for ; Mon, 21 Jun 2021 05:18:49 -0400 Received: by simark.ca (Postfix, from userid 112) id 9E5EF1F1F2; Mon, 21 Jun 2021 05:18:49 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2C0A81E54D for ; Mon, 21 Jun 2021 05:18:48 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 83337389683A for ; Mon, 21 Jun 2021 09:18:46 +0000 (GMT) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 6E542383F422 for ; Mon, 21 Jun 2021 09:18:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E542383F422 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 87032219D2; Mon, 21 Jun 2021 09:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624267113; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NJjuJXO0f8CqPPZh5wAJNoj4M3TKntOJwtI2WHUStJ0=; b=rshbI+7M1DHnIQHypmPSZGENdbhP9/kvkFfirOmCSrHZaI8VM4cvPgs1eoi/z5HVKsq2uz 22tsKuLhozV35mdykvXqS++D1EiFhe4vtgG5Hs0l9q8A3aaDSeNQ1fAXYjdWI7C3f3R0CO LvsuJefzhK45e7cWgaomvWul5fcyY3c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624267113; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NJjuJXO0f8CqPPZh5wAJNoj4M3TKntOJwtI2WHUStJ0=; b=EmEG++EhEJrOMXtVoENPURn8KR+kLoUCaYyHNAK/OBcfXDeVQqz/RuonDsKWer6rvTU4bI CgszzaBXwYT6T8Ag== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 63E37118DD; Mon, 21 Jun 2021 09:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1624267113; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NJjuJXO0f8CqPPZh5wAJNoj4M3TKntOJwtI2WHUStJ0=; b=rshbI+7M1DHnIQHypmPSZGENdbhP9/kvkFfirOmCSrHZaI8VM4cvPgs1eoi/z5HVKsq2uz 22tsKuLhozV35mdykvXqS++D1EiFhe4vtgG5Hs0l9q8A3aaDSeNQ1fAXYjdWI7C3f3R0CO LvsuJefzhK45e7cWgaomvWul5fcyY3c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1624267113; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NJjuJXO0f8CqPPZh5wAJNoj4M3TKntOJwtI2WHUStJ0=; b=EmEG++EhEJrOMXtVoENPURn8KR+kLoUCaYyHNAK/OBcfXDeVQqz/RuonDsKWer6rvTU4bI CgszzaBXwYT6T8Ag== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id COJFF2lZ0GCXRAAALh3uQQ (envelope-from ); Mon, 21 Jun 2021 09:18:33 +0000 Subject: Re: [RFC][gdb/symtab] Lazy expansion of full symbol table To: Tom Tromey References: <20210614093908.GA22709@delia> <87pmwoxj3j.fsf@tromey.com> <533bf7e4-d96c-a6b7-8c37-a4141ebdc761@suse.de> <87im2fxnr7.fsf@tromey.com> <87bl83ykd9.fsf@tromey.com> <87tulsw17w.fsf@tromey.com> From: Tom de Vries Message-ID: <25c649a5-6019-3500-7486-e909bac56f92@suse.de> Date: Mon, 21 Jun 2021 11:18:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <87tulsw17w.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 6/21/21 1:44 AM, Tom Tromey wrote: > Tom> Tried the updated branch and ran into a race condition, fixed in > Tom> attached patch. > > How did you observe it? > Download and extract https://download.opensuse.org/tumbleweed/repo/debug/x86_64/glibc-debuginfo-2.33-8.1.x86_64.rpm . Then: ... $ gdb -q -batch ~/reproduce/usr/lib/debug/usr/lib64/ld-2.33.so-2.33-8.1.x86_64.debug Dwarf Error: DW_FORM_line_strp used without .debug_line_str section [in module /home/vries/reproduce/usr/lib/debug/usr/lib64/ld-2.33.so-2.33-8.1.x86_64.debug] ... > Tom> + static std::mutex mutex; > Tom> asection *sectp; > Tom> bfd *abfd; > Tom> gdb_byte *buf, *retbuf; > > Tom> + std::lock_guard guard (mutex); > Tom> if (readin) > Tom> return; > Tom> buffer = NULL; > > I don't think we want to do this, because BFD isn't thread-safe, and > I've been avoiding touching it. Instead I think we'll have to track > down the problems spots and arrange for the required sections to be read > in before any threaded work is started. > Ack, I see. --- I rebuild the updated branch and ran the tests and investigated this dwarf error: ... (gdb) file /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.arch/amd64-disp-step-avx/amd64-disp-step-avx^M Reading symbols from /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.arch/amd64-disp-step-avx/amd64-disp-step-avx...^M Dwarf Error: Could not find abbrev number 2391 in CU at offset 0x29 [in module /home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.arch/amd64-disp-step-avx/amd64-disp-step-avx]^M ... when using gcc-11. I managed to fix that using this patch: ... diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 265ebee1de8..f98acfa33ed 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -7204,7 +7204,8 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_b yte *info_ptr, /* We only handle DW_FORM_ref4 here. */ const gdb_byte *sibling_data = info_ptr + abbrev->sibling_offset; unsigned int offset = read_4_bytes (abfd, sibling_data); - const gdb_byte *sibling_ptr = buffer + offset; + const gdb_byte *sibling_ptr + = buffer + to_underlying (cu->header.sect_off) + offset; if (sibling_ptr >= info_ptr && sibling_ptr < reader->buffer_end) return sibling_ptr; /* Fall through to the slow way. */ ... The DW_FORM_ref4 offset is relative to the start of the CU, but buffer points to the start of .debug_info. Thanks, - Tom