From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 378F8385840F for ; Fri, 24 Feb 2023 12:42:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 378F8385840F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 69F3D6079A; Fri, 24 Feb 2023 12:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1677242525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3qhpVMG5tka8sZgoAb11Gtyndqqc9hj9HjqK2NZ48IY=; b=SGT509e6rdXPBjG4McLoPAIF6Oj7VFsFnVEnWpxki30jOYUfOM6tudIktrf+KKvOfzXeT9 BifHYNQbdTgxXaCpDF0OOpKSPLN7L+2nXLLosAUg5IEDkS6kL7jo+ICdDFkm2tLEGVRafn c9CLcemVJI0kycUnstMlh7eqgkJ07u0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1677242525; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3qhpVMG5tka8sZgoAb11Gtyndqqc9hj9HjqK2NZ48IY=; b=W3bVQvLK4lj1RpKzs7ZeOJ43v3JbFC87Mox6a/Yz1yPKqmtYKlLoT5P/OMN4/3eHcJvwHG Uwtoszwuoal+iTCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5407113A3A; Fri, 24 Feb 2023 12:42:05 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1FA4E52w+GNzLAAAMHmgww (envelope-from ); Fri, 24 Feb 2023 12:42:05 +0000 Message-ID: <78f34ddc-acd7-2e1c-9961-bead283d11bf@suse.de> Date: Fri, 24 Feb 2023 13:42:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 2/3] [RFC][gdb/symtab] Add maint set symbol-read-order Content-Language: en-US To: Bruno Larsen , gdb-patches@sourceware.org References: <20220922152042.21914-1-tdevries@suse.de> <20220922152042.21914-2-tdevries@suse.de> From: Tom de Vries In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 9/26/22 12:43, Bruno Larsen wrote: > > Cheers, > Bruno > > On 22/09/2022 17:20, Tom de Vries via Gdb-patches wrote: >> With the test-case included in this patch, we run into: >> ... >> (gdb) print var_dwarf^M >> $1 = 1^M >> (gdb) PASS: gdb.ctf/dwarf2-and-ctf.exp: print var_dwarf >> print var_ctf^M >> 'var_ctf' has unknown type; cast it to its declared type^M >> (gdb) FAIL: gdb.ctf/dwarf2-and-ctf.exp: print var_ctf >> ... >> >> The problem is that the executable contains both ctf and dwarf2, so >> the ctf >> info is ignored. >> >> GDB has support for handling multiple debug formats, but the common >> use case >> for ctf is to be used when dwarf2 is not present, and gdb reflects that, >> assuming that by reading ctf in addition there won't be any extra >> information, >> so it's not worth the additional cycles and memory. >> >> Add a new maintenance command "maint set symbol-read-order ", >> where >> the argument string "mdebug+stabs+dwarf2/ctf" represent the current >> default, >> in other words: >> - first mdebug is read >> - then stabs is read >> - then dwarf2 is read, >> - then ctf is read, but only if dwarf2 info was missing. >> >> A bit of background on the relevance of reading order: the formats >> that create >> partial symtabs (all but dwarf2) have a priority relationship between >> them, >> where reading earlier means lower priority.  By reading the format >> with the >> most detail last, we ensure it has the highest priority, which makes >> sure that >> in case there is overlapping info, the most detailed info is found.  This >> explains the ordering of mdebug, stabs and dwarf2 (because it used to >> have >> partial symtabs). >> >> By using "maint set symbol-read-order ctf+dwarf2 or dwarf2+ctf, we can >> make the >> test-case pass. >> >> This is an RFC at this point, so no documentation yet. >> >> Points I'd like to have feedback on: >> - I chose this to be a maintenance command, because I suspect the reading >>    order implications are a bit hard to understand. >> - was it a good idea to use strtok ? >> - I went for genericity, but could haved used instead a simple >>    "set read-ctf-symtab ".  If that is better, should >>    it be a maintenance command or not? >> - I initially went for the priority first order in the argument >> string, so >>    reflecting the current default would be "dwarf2/ctf+stabs+mdebug", >> thinking >>    it would be easier to understand the priority scheme this way, but >> abandoned >>    that approach midway.  Which is easier to grasp? > > A point against genericity, it isn't clear if we are supposed to read > mdebug+stabs+(dwarf2)/ctf or (mdebug+stabs+dwarf2)/ctf.  The option to > change how ctf specifically is read would not create this. > > About the ordering, I feel like priority order would be less confusing, > if you decide to go with the generic option. > Hi, thanks for the feedback. I've decided to go with a less generic option, submitted here ( https://sourceware.org/pipermail/gdb-patches/2023-February/197356.html ). Thanks, - Tom