From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id MlrKEdIqpF8EdwAAWB0awg (envelope-from ) for ; Thu, 05 Nov 2020 11:39:46 -0500 Received: by simark.ca (Postfix, from userid 112) id 3C0221F08B; Thu, 5 Nov 2020 11:39:46 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, 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 467991E552 for ; Thu, 5 Nov 2020 11:39:45 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 58474386F478; Thu, 5 Nov 2020 16:39:44 +0000 (GMT) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id F17E13861878 for ; Thu, 5 Nov 2020 16:39:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F17E13861878 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 10DAAAB4C for ; Thu, 5 Nov 2020 16:39:41 +0000 (UTC) Date: Thu, 5 Nov 2020 17:39:39 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Add share_abbrev option to cu in dwarf assembler Message-ID: <20201105163938.GA26291@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Hi, This adds a share_abbrev option in the dwarf assembler, such that different CUs can share a single abbrev table, like so: ... cu { share_abbrev first } { ... } cu { share_abbrev 1 } { ... } cu { share_abbrev 1 } { ... } cu { share_abbrev last } { ... } ... Tested by adding share_abbrev first/last to the two CUs in gdb.dwarf2/imported-unit.exp. Any comments? Thanks, - Tom [gdb/testsuite] Add share_abbrev option to cu in dwarf assembler gdb/testsuite/ChangeLog: 2020-11-05 Tom de Vries * lib/dwarf.exp (Dwarf::_abbrev_label): New var. (cu): Add share_abbrev option. --- gdb/testsuite/lib/dwarf.exp | 42 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index c585621ac4..40d0648826 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -310,6 +310,10 @@ namespace eval Dwarf { # table. variable _abbrev_num + # The label used for the current CU's abbrev table. This may be shared + # between CUs. + variable _abbrev_label + # The string table for this assembly. The key is the string; the # value is the label for that string. variable _strings @@ -1039,6 +1043,11 @@ namespace eval Dwarf { # default = default # fission 0|1 - boolean indicating if generating Fission debug info # default = 0 + # share_abbrev 0|first|1|last + # - non-zero indicating that a series of CUs shares the same + # abbrev table. The first and last in the series are marked + # using first and last. + # default = 0 # BODY is Tcl code that emits the DIEs which make up the body of # the CU. It is evaluated in the caller's context. proc cu {options body} { @@ -1049,12 +1058,14 @@ namespace eval Dwarf { variable _cu_version variable _cu_addr_size variable _cu_offset_size + variable _abbrev_label # Establish the defaults. set is_64 0 set _cu_version 4 set _cu_addr_size default set fission 0 + set share_abbrev 0 set section ".debug_info" set _abbrev_section ".debug_abbrev" @@ -1065,6 +1076,7 @@ namespace eval Dwarf { version { set _cu_version $value } addr_size { set _cu_addr_size $value } fission { set fission $value } + share_abbrev { set share_abbrev $value } default { error "unknown option $name" } } } @@ -1084,8 +1096,18 @@ namespace eval Dwarf { _section $section set cu_num [incr _cu_count] - set my_abbrevs [_compute_label "abbrev${cu_num}_begin"] - set _abbrev_num 1 + + set init_abbrev \ + [expr [string equal $share_abbrev 0] \ + || [string equal $share_abbrev first]] + set finish_abbrev \ + [expr [string equal $share_abbrev 0] \ + || [string equal $share_abbrev last]] + + if { $init_abbrev } { + set _abbrev_label [_compute_label "abbrev${cu_num}_begin"] + set _abbrev_num 1 + } set _cu_label [_compute_label "cu${cu_num}_begin"] set start_label [_compute_label "cu${cu_num}_start"] @@ -1100,18 +1122,22 @@ namespace eval Dwarf { } define_label $start_label _op .2byte $_cu_version Version - _op .${_cu_offset_size}byte $my_abbrevs Abbrevs + _op .${_cu_offset_size}byte $_abbrev_label Abbrevs _op .byte $_cu_addr_size "Pointer size" - _defer_output $_abbrev_section { - define_label $my_abbrevs + if { $init_abbrev } { + _defer_output $_abbrev_section { + define_label $_abbrev_label + } } uplevel $body - _defer_output $_abbrev_section { - # Emit the terminator. - _op .byte 0x0 "Abbrev end - Terminator" + if { $finish_abbrev } { + _defer_output $_abbrev_section { + # Emit the terminator. + _op .byte 0x0 "Abbrev end - Terminator" + } } define_label $end_label