From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sH9OLIrCB2CaTgAAWB0awg (envelope-from ) for ; Wed, 20 Jan 2021 00:41:30 -0500 Received: by simark.ca (Postfix, from userid 112) id B312C1EF80; Wed, 20 Jan 2021 00:41:30 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [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 601B31E939 for ; Wed, 20 Jan 2021 00:41:30 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1C8AA3947433; Wed, 20 Jan 2021 05:41:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C8AA3947433 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611121290; bh=J4JiyFMzn+VED3mj+wTZvVFLXfe4SwN1DLlPsOHEpnQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=nQmDHTv3Qv+revCcJlgil/dkDFPyub464QfMevqmA9JEK3yVN1A8mxbTi0GUEYVUy ODO6EV1vBkIKvHt0f+Dmoo0OXd1EKMa9kh9UU+LUktzhd60hCdk4+pUve2dkz9gclu pUF+cVHxL03j5mohgAU+XgLLG3B+MQy5+d5KJRZ4= Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id B0780386F419 for ; Wed, 20 Jan 2021 05:41:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B0780386F419 X-ASG-Debug-ID: 1611121286-0c856e67e246f760001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id DqJATLpK6jD4optU (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 20 Jan 2021 00:41:26 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@polymtl.ca X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from simark.localdomain (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by smtp.ebox.ca (Postfix) with ESMTP id A9AF2441D64; Wed, 20 Jan 2021 00:41:26 -0500 (EST) X-Barracuda-RBL-IP: 192.222.157.6 X-Barracuda-Effective-Source-IP: 192-222-157-6.qc.cable.ebox.net[192.222.157.6] X-Barracuda-Apparent-Source-IP: 192.222.157.6 To: gdb-patches@sourceware.org Subject: [PATCH 09/13] gdb/testsuite: DWARF assembler: add context parameters to _location Date: Wed, 20 Jan 2021 00:39:21 -0500 X-ASG-Orig-Subj: [PATCH 09/13] gdb/testsuite: DWARF assembler: add context parameters to _location Message-Id: <20210120053925.142862-10-simon.marchi@polymtl.ca> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210120053925.142862-1-simon.marchi@polymtl.ca> References: <20210120053925.142862-1-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1611121286 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 4185 X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.87375 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 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: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Simon Marchi Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" From: Simon Marchi The _location proc is used to assemble a location description. It needs to know some contextual information: - size of an address - size of an offset (into another DWARF section) - DWARF version It currently get all this directly from global variables holding the compilation unit information. This is fine because as of now, all location descriptions are generated in the context of creating a compilation unit. However, a subsequent patch will generate location descriptions while generating a .debug_loclists section. _location should therefore no longer rely on the current compilation unit's properties. Change it to accept these values as parameters instead of accessing the values for the CU. No functional changes intended. gdb/testsuite/ChangeLog: * lib/dwarf.exp (_location): Add parameters. (_handle_DW_FORM): Adjust. Change-Id: Ib94981979c83ffbebac838081d645ad71c221637 --- gdb/testsuite/lib/dwarf.exp | 40 +++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index aba4afba2249..f4f1cab05e68 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -515,11 +515,15 @@ namespace eval Dwarf { } SPECIAL_expr { + variable _cu_version + variable _cu_addr_size + variable _cu_offset_size + set l1 [new_label "expr_start"] set l2 [new_label "expr_end"] _op .uleb128 "$l2 - $l1" "expression" define_label $l1 - _location $value + _location $value $_cu_version $_cu_addr_size $_cu_offset_size define_label $l2 } @@ -889,18 +893,28 @@ namespace eval Dwarf { # This is a miniature assembler for location expressions. It is # suitable for use in the attributes to a DIE. Its output is # prefixed with "=" to make it automatically use DW_FORM_block. + # # BODY is split by lines, and each line is taken to be a list. + # + # DWARF_VERSION is the DWARF version for the section where the location + # description is found. + # + # ADDR_SIZE is the length in bytes (4 or 8) of an address on the target + # machine (typically found in the header of the section where the location + # description is found). + # + # OFFSET_SIZE is the length in bytes (4 or 8) of an offset into a DWARF + # section. This typically depends on whether 32-bit or 64-bit DWARF is + # used, as indicated in the header of the section where the location + # description is found. + # # (FIXME should use 'info complete' here.) # Each list's first element is the opcode, either short or long # forms are accepted. # FIXME argument handling # FIXME move docs - proc _location {body} { + proc _location { body dwarf_version addr_size offset_size } { variable _constants - variable _cu_label - variable _cu_version - variable _cu_addr_size - variable _cu_offset_size foreach line [split $body \n] { # Ignore blank lines, and allow embedded comments. @@ -912,7 +926,7 @@ namespace eval Dwarf { switch -exact -- $opcode { DW_OP_addr { - _op .${_cu_addr_size}byte [lindex $line 1] + _op .${addr_size}byte [lindex $line 1] } DW_OP_regx { @@ -992,10 +1006,10 @@ namespace eval Dwarf { # Here label is a section offset. set label [lindex $line 1] - if { $_cu_version == 2 } { - _op .${_cu_addr_size}byte $label + if { $dwarf_version == 2 } { + _op .${addr_size}byte $label } else { - _op .${_cu_offset_size}byte $label + _op .${offset_size}byte $label } _op .sleb128 [lindex $line 2] } @@ -1007,10 +1021,10 @@ namespace eval Dwarf { # Here label is a section offset. set label [lindex $line 1] - if { $_cu_version == 2 } { - _op .${_cu_addr_size}byte $label + if { $dwarf_version == 2 } { + _op .${addr_size}byte $label } else { - _op .${_cu_offset_size}byte $label + _op .${offset_size}byte $label } } -- 2.30.0