From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69302 invoked by alias); 22 Feb 2018 21:42:27 -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 69286 invoked by uid 89); 22 Feb 2018 21:42:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_1,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg22.ericsson.net Received: from sesbmg22.ericsson.net (HELO sesbmg22.ericsson.net) (193.180.251.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Feb 2018 21:42:24 +0000 Received: from ESESSHC002.ericsson.se (Unknown_Domain [153.88.183.24]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 82.6F.18296.D393F8A5; Thu, 22 Feb 2018 22:42:21 +0100 (CET) Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSHC002.ericsson.se (153.88.183.24) with Microsoft SMTP Server (TLS) id 14.3.352.0; Thu, 22 Feb 2018 22:42:21 +0100 Received: from ESESBMB502.ericsson.se (153.88.183.169) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Thu, 22 Feb 2018 22:42:20 +0100 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB502.ericsson.se (153.88.183.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26 via Frontend Transport; Thu, 22 Feb 2018 22:42:20 +0100 Received: from [142.133.61.152] (192.75.88.130) by MW2PR1501MB2012.namprd15.prod.outlook.com (2603:10b6:302:c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.464.11; Thu, 22 Feb 2018 21:42:18 +0000 Subject: Re: [PATCH] dwarf: Make sect_offset 64-bits To: Pedro Alves , Simon Marchi , References: <1514692098-8054-1-git-send-email-simon.marchi@ericsson.com> <0694b84f-7fef-5373-2cb3-87f6b8fd56b7@polymtl.ca> <09806ce5-3e85-dacc-cf3e-22660fab90b8@ericsson.com> From: Simon Marchi Message-ID: Date: Thu, 22 Feb 2018 21:42:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MWHPR15CA0043.namprd15.prod.outlook.com (2603:10b6:300:ad::29) To MW2PR1501MB2012.namprd15.prod.outlook.com (2603:10b6:302:c::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c82d5a8-6825-4cab-f4b1-08d57a3d25a4 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:MW2PR1501MB2012; X-Microsoft-Exchange-Diagnostics: 1;MW2PR1501MB2012;3:BpPdaFdh7psp/tiNaS0VPcBacZ43WeL8XGv+dEbzfzn+yR+6Bo33ge95qDQ/odG+oIMRWm67+/GOYEAxgLYnO8YJTduKHGeG96ACOJZQPKs4PLHNWkd3Ggpcw5DQ5RH7w465qhS0nHz8JGalhQ5bRSP5Fu/X2+D90erzS31+0PIQ3GkMdTSqC79PQv3pQptMr4kdHzoBT5Ri8w+YNDOgRYq+OTcTf0jjwLHwOyblRqqAZHLtGml7ZLjaUPwxG/6J;25:Ut6Sxc0UTqO6yhNXzIOxGKHgYGsdUOyUcB6uWWOkGM4eAFb9uYXddb1zg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oYT8wlLwLa/i8VOUjqQtz;4:krcvAydIGxIDJtmZ2XzjWJeBJIb6Oo9dO3Pq1C28qxlezm1fvFk2ZjtkG2hiOfCWL5vwZorg2E2AgpwIqNDf/Q8cFVbQNeaAKHpvdX0YlKQwYiKEkSS/LTeu3BFF1kGCxqheY9z5xM/keMHnYS/4crO/VcsfP+Uwl+Wf5QmHrbHA5ekg8GVxqOngzSNOeuwnuigF7bRLYzF4cZvh8rE2kOm+VnnlzL/p29xc/SXFJRPyhViMJd7PwmDhZ0+bTtmu9+t7v+PucXUOH19GGx3hIw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001082)(6040501)(2401047)(5005006)(8121501046)(3002001)(93006095)(93001095)(10201501046)(3231166)(2400082)(944501161)(52105095)(6041288)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(6072148)(201708071742011);SRVR:MW2PR1501MB2012;BCL:0;PCL:0;RULEID:;SRVR:MW2PR1501MB2012; X-Forefront-PRVS: 059185FE08 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(39380400002)(366004)(39860400002)(346002)(396003)(376002)(189003)(199004)(51444003)(377424004)(6246003)(5660300001)(7736002)(2486003)(16576012)(386003)(31696002)(316002)(229853002)(23676004)(76176011)(58126008)(59450400001)(31686004)(52116002)(53546011)(86362001)(186003)(230700001)(110136005)(6666003)(3846002)(68736007)(81156014)(81166006)(105586002)(478600001)(97736004)(6116002)(65956001)(50466002)(25786009)(6486002)(49976009)(47776003)(36756003)(64126003)(93886005)(65826007)(65806001)(8676002)(6346003)(8936002)(16526019)(106356001)(66066001)(2906002)(52146003)(2950100002)(53936002)(305945005)(26005)(78286006);DIR:OUT;SFP:1101;SCL:1;SRVR:MW2PR1501MB2012;H:[142.133.61.152];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNVzJQUjE1MDFNQjIwMTI7MjM6YUhISUh0V1pyc1ZId09VVVYrNXl1UE96?= =?utf-8?B?bGpkOHAzQkJnRVRmQVlTZFg3cnVweG5WaGdBWURyeHFucnlweGNlbDluVEFG?= =?utf-8?B?MFlpdW5EblJoU1Y1Um9rVGNDeU9LOUNxd0h0d1VsT20wNVp3SHp6d3JPbzIx?= =?utf-8?B?YVlwZ3Q2SXV2cW50Y0p5dmQ1YWV4c3BPWU9RRVhPRTdUaFpPeERlWmRSYk16?= =?utf-8?B?L05rNW5zQnRBd0VHTEZ3bEU0TTVNbUQvaEJ0L3h0a3AvZGszbmo0aFhyWnYx?= =?utf-8?B?eU1XNTFvTHp0N0d2VTZESUpjT24vNSt1a085VVlQVTVLMlVrcGZLTGc4Q1Yr?= =?utf-8?B?YzhXcFZBYUtLSWxwcE5kZVhObCtmZnEyeEZBZ0RuTXdMUnVUM3FBajV6UzBz?= =?utf-8?B?QmgvSUFEaXl5bktYTkFQTVRhTTQyZHh5OVNkRTVzRHBJNGdUMmtWYjZvNG13?= =?utf-8?B?L1creGo0b2ZOR3hha1BhU0ZUMGM4RXVJRGE2VG11dG1aWVVrdi9rZHluYVVn?= =?utf-8?B?WEhNWXZqRFVHaEU4QUZkQ0cvbkNLYlptWm13bzgvc29odGdaS20yVmhqTnFv?= =?utf-8?B?NHN3RU5ldVJER2N6UG9OMlM5enV2TlloTVA5UElRL2Y4eXhjeXdEb3BzT20z?= =?utf-8?B?cnVaQ3owQlY0YjdvbEI1dWViOSthc0t6dmdkaE9JQk0xZUtMYVdzTjh0THIx?= =?utf-8?B?YllLMmx2U3RuSFFpYi8rdUNPSFVuVTdqc0VZR3ROWkkyL3dvTWlRZ3M5Tzdm?= =?utf-8?B?RG5JWFJG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qKr7P/Q/M8Dw6Ui4GDG3Khua7DzjHSo+9R8W7yyGtVa+Zqi0xiWdnqLMhoq2lw1R6QHz2PFqXMQ3vRbyw5BF3VDvPzO1B5OmaVQ5Xs+EejhxvcQVxHCVS/PWJg+Jv64DWD8BYBmK9UEAnLxueztJSVhKunUYF2eXoah8eMy1YfAEHDI3GAslg1OBMitkQTEGjfk3OuDW7PDCtb1K+hE9VQILVD4fNv5st3La5H8sy0vwIqldk1XRBeJGL2ODcI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2018 21:42:18.1735 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c82d5a8-6825-4cab-f4b1-08d57a3d25a4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR1501MB2012 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes X-SW-Source: 2018-02/txt/msg00331.txt.bz2 Hi Pedro, They are all very good questions, I should have given that info in the first place, but here it is. On 2018-02-20 11:49 AM, Pedro Alves wrote: > Does this change the type of any field of the structures that form the > indexes? I.e., does it affect binary compatibility there? I.e., > can you save a gdb index with pre-patch gdb, and load it back in > post-patch gdb. Likewise viceversa. Also DWARF5 indexes. I generated both kinds of indexes (using the gdb binary itself as a guinea pig) with and without the patch applied, all produced files had the same checksum in both cases. I don't think we ever use sizeof on sect_offset or a variable of that type, so its size should not change anything (except cause an overflow if it's 32 bits and we need it to be larger). All reads/writes I could find were either with an hardcoded number of bytes, or a number of bytes based of whether we're using dwarf64 or not (4 or 8 bytes). > Also, just for the record, can we assume that this doesn't increase > memory usage considerably when debugging bigger programs? I assume that > this will create some padding holes in some structures and that we can > probably win back the memory by just changing order of some fields > for better packing. Indeed it adds a few bytes to some structures. The numbers are different if you compile GDB as a 64 bits or 32 bits program. Some structures have no holes on 32 bits have holes on 64 bits (because of the different pointer size/alignment), and a bigger sect_offset field just fills that hole, so there's no net increase. In other cases, the bigger sect_offset field just take the place of some padding. For example, this structure: struct foo { uint64_t a; sect_offset b; }; takes 16 bytes when built on 64 bits, regardless of the size of sect_offset. Here are some tables that summarize the impact. The notation is S/H, where S is the size of the structure in bytes (including padding), and H is the total size of holes (excluding padding at the end, because ptype/o does not show it). This value is expressed as B.b, where B is the number of integral bytes and b the number of bits (up to 7). 64 bits: before after comp_unit_head 48/0 64/8 dwarf2_per_cu_data 56/5.2 56/1.2 signatured_type 96/5.2 104/5.2 stmt_list_hash 16/0 16/0 dwo_unit 40/0 40/0 line_header 104/8.7 112/12.7 partial_die_info 96/4.1 104/4.1 abbrev_table 104/4 104/0 die_info 56/4.6 56/0.6 tu_abbrev_offset 16/0 16/0 dwarf2_per_cu_offset_and_type 24/4 24/0 32 bits: before after comp_unit_head 44/0 52/0 dwarf2_per_cu_data 32/1.2 36/1.2 signatured_type 60/1.2 68/1.2 stmt_list_hash 8/0 12/0 dwo_unit 28/0 32/0 line_header 64/8.7 72/8.7 partial_die_info 52/0.1 64/0.1 abbrev_table 52/0 56/0 die_info 36/0.6 40/0.6 tu_abbrev_offset 8/0 12/0 dwarf2_per_cu_offset_and_type 12/0 16/0 Among those, I think that partial_die_info and die_info are probably the most critical, since they are allocated the most often. Loading gdb in gdb allocates about 2023000 partial_die_info. Loading with -readnow allocates about 7479000 die_info. However, I think that those two structures are not kept around for very long, only while reading in the CU, so the increase in memory usage is not really noticeable. I compared the memory usage after having read the symbols from the gdb binary (both with and without -readnow), and it seemed the same with and without the patch. comp_unit_head and line_header have a similar lifetime it seems. signatured_type instances are allocated on the objfile obstack, so they last for a long time. I don't think in practice you can have enough types described by signatured_type for it to make a difference though. > Offhand, I know about code in dwarf2read.c that assumes that offset_type > is 32-bit for both of the reasons above -- memory usage (e.g., > struct name_component), and also as type used in indexes. > I'm not seeing anything for sect_offset, but can you double check? Simon