From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 17FF83858D1E for ; Fri, 20 Oct 2023 08:20:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17FF83858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17FF83858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:67c:2178:6::1c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697790041; cv=none; b=os9/axMy3AD3R6e2E1X3EINogyb3ffGdJxD6T9C2EBFJD8kVjzgWr52wGorFsq3WyhjlLU0rxEip/RCCKMZqkMG6RC/qmAhZgabC5AJnQ6HpuIFloKtlYI6vCVHPwgwjMzLB8f0w0s5h1bev4Ob1/CaXyFVJAI90G5J+sFl4b94= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697790041; c=relaxed/simple; bh=W2k6f7N2rkm7CBLNMpoF1eDcnEy15yjy7+zLBoJwrhs=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=rjcb4yIHI77uwztNeOS+36P5NtHV5OdtePHYlE9NSE7C9ctA5x0jIJX8jpto7gP3LyZdFHzE+FUQOlI6+pZORFetQErVKqesHaO78VJNU5SvxYQC3tRbMC/geVNpmsOkJwcYaLf2BMsQhuM2A3CPHQScWYdsI2nFE5s09uRzlH8= ARC-Authentication-Results: i=1; server2.sourceware.org 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-out1.suse.de (Postfix) with ESMTPS id 4F64121A12; Fri, 20 Oct 2023 08:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697790037; 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=GOQbeYMs8l3SDpg4cIJ+grQrymR02IVSOFj2jq2a8rg=; b=caCH7ubMpf86S4JiPCSZCYcmYtCUMYSXIrB3t7vKSED0H1EPBf596T88d3fYkN5/aFE5VO 29Bfwt9Z7w/GToHWr+siBtk2MfGTCWP9pExbaCLyLENVahbMWuGl2g0a+GIL1p0rw2nJE6 CeXZZZd+w/bIEJKvf+GczkaBVZMoV1A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697790037; 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=GOQbeYMs8l3SDpg4cIJ+grQrymR02IVSOFj2jq2a8rg=; b=knafCQ2L6kUCgiyYGPamJZ8LjD/i5YGwVowkVndJVIcxxOcW9mE7QQJHT1H/vPBRVXmAml JXB+n+/+b179zTCw== 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 384AE138E2; Fri, 20 Oct 2023 08:20:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id d0yIDFU4MmVLIAAAMHmgww (envelope-from ); Fri, 20 Oct 2023 08:20:37 +0000 Message-ID: Date: Fri, 20 Oct 2023 10:21:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] [gdb/symtab] Fix style issues in v9 .gdb_index section support Content-Language: en-US To: Thiago Jung Bauermann Cc: gdb-patches@sourceware.org References: <20231011153214.25769-1-tdevries@suse.de> <87fs26tuuj.fsf@linaro.org> From: Tom de Vries In-Reply-To: <87fs26tuuj.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -7.09 X-Spamd-Result: default: False [-7.09 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 10/19/23 18:55, Thiago Jung Bauermann wrote: > > Hello Tom, > > Tom de Vries writes: > >> @@ -1217,7 +1217,7 @@ write_shortcuts_table (cooked_index *table, data_buf& shortcuts, >> } >> } >> >> - shortcuts.append_uint (4, BFD_ENDIAN_LITTLE, dw_lang); >> + shortcuts.append_offset (dw_lang); > > This is a functional change. Is it intentional? If so, it'd be better as > a separate patch. > It is not supposed to be functional change given that append_offset is defined as: ... void append_offset (offset_type value) { append_uint (sizeof (value), BFD_ENDIAN_LITTLE, value); } ... and offset_type as: ... typedef uint32_t offset_type; ... >> shortcuts.append_offset (main_name_offset); >> } >> >> diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c >> index b96eaa96e23..34c5dfd5803 100644 >> --- a/gdb/dwarf2/read-gdb-index.c >> +++ b/gdb/dwarf2/read-gdb-index.c >> @@ -777,10 +777,10 @@ static void >> set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile, >> mapped_gdb_index *index) >> { >> - const auto expected_size = 4 + sizeof (offset_type); >> + const auto expected_size = 2 * sizeof (offset_type); > > This is also a functional change. > Given that we have sizeof (offset_type) == 4, we rewrite "4 + 4" into "2 * 4". >> if (index->shortcut_table.size () < expected_size) >> /* The data in the section is not present, is corrupted or is in a version >> - * we don't know about. Regardless, we can't make use of it. */ >> + we don't know about. Regardless, we can't make use of it. */ > > One further style issue that could be fixed here is the lack of double > space after period. > >> return; >> >> auto ptr = index->shortcut_table.data (); >> @@ -794,7 +794,7 @@ set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile, >> if (dw_lang == 0) >> { >> /* Don't bother if the language for the main symbol was not known or if >> - * there was no main symbol at all when the index was built. */ >> + there was no main symbol at all when the index was built. */ >> return; > > Also here, double space after period is lacking. > >> } >> ptr += 4; > >> diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h >> index 1d9432c5c11..c92474d8b9d 100644 >> --- a/gdb/dwarf2/read.h >> +++ b/gdb/dwarf2/read.h >> @@ -246,11 +246,11 @@ struct dwarf2_per_cu_data >> std::vector *imported_symtabs = nullptr; >> >> /* The original DW_LANG_* value of the CU, as provided to us by >> - * DW_AT_language. It is interesting to keep this value around in cases where >> - * we can't use the values from the language enum, as the mapping to them is >> - * lossy, and, while that is usually fine, things like the index have an >> - * understandable bias towards not exposing internal GDB structures to the >> - * outside world, and so prefer to use DWARF constants in their stead. */ >> + DW_AT_language. It is interesting to keep this value around in cases where >> + we can't use the values from the language enum, as the mapping to them is >> + lossy, and, while that is usually fine, things like the index have an >> + understandable bias towards not exposing internal GDB structures to the >> + outside world, and so prefer to use DWARF constants in their stead. */ > > I think the lack of double space after period here are fixed in the > other patch you sent. > Yes, those are fixed in that patch, I'll commit soon. Thanks for the review. - Tom