From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id RDGwAnYxaGF6LwAAWB0awg (envelope-from ) for ; Thu, 14 Oct 2021 09:32:38 -0400 Received: by simark.ca (Postfix, from userid 112) id E75101F0BB; Thu, 14 Oct 2021 09:32:37 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,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 33FE81ECEB for ; Thu, 14 Oct 2021 09:32:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B9EAF3858004 for ; Thu, 14 Oct 2021 13:32:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9EAF3858004 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1634218356; bh=l6yIRzd7Bhs4ubXFuBr8MMY9EGGUTFmNI+LUKoO0j+U=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bWxA2G5SuMPS454PDOADbDKu4L0/6WPPNVU+ZfX8u55A7hGsh8wiuzykgEDl2fi3L L/UroHqGM0dbU40IQoZd3d53YHELRh/507bQxRmLPIN5BoC33S3AHRoWp+hhB+eDgD exjLvnWZDC7pOqkqEQg+b9BGhEQD7JdzJB5qoDmk= Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 4EEF03858C2C for ; Thu, 14 Oct 2021 13:32:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4EEF03858C2C Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 19EDWCCj012390 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Oct 2021 09:32:17 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 19EDWCCj012390 Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 861F01ECEB; Thu, 14 Oct 2021 09:32:12 -0400 (EDT) Message-ID: <0316a868-cb5e-37e3-0040-d64d1acaf521@polymtl.ca> Date: Thu, 14 Oct 2021 09:32:12 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH][gdb/testsuite] Add .debug_loc support in dwarf assembler Content-Language: en-US To: Tom de Vries , gdb-patches@sourceware.org References: <20211014123315.GA22867@delia.home> In-Reply-To: <20211014123315.GA22867@delia.home> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 14 Oct 2021 13:32:12 +0000 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 Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp > index 66f9844fe2e..a15eacfb46c 100644 > --- a/gdb/testsuite/lib/dwarf.exp > +++ b/gdb/testsuite/lib/dwarf.exp > @@ -2369,6 +2369,102 @@ namespace eval Dwarf { > aranges_end: > } > > + # Emit a .debug_loc entry. > + > + proc loc_entry { start end location_description } { > + # Determine how to emit addresses. > + variable _addr_size > + if { $_addr_size == 8 } { > + set addr_op .8byte > + } elseif { $_addr_size == 4 } { > + set addr_op .4byte > + } > + > + # Emit start and end address. > + _op $addr_op $start "Start address" > + _op $addr_op $end "End address" > + > + declare_labels location_description_start > + declare_labels location_description_end > + > + # Emit length of location description. > + set len "$location_description_end - $location_description_start" > + _op .2byte $len "Location description length" > + > + # Tag start of location description. > + define_label $location_description_start > + > + # Emit location description. > + variable _cu_version > + variable _cu_offset_size > + _location $location_description $_cu_version $_addr_size \ > + $_cu_offset_size > + > + # Tag end of location description. > + define_label $location_description_end > + } > + > + # Emit a DWARF .debug_loc contribution. > + # > + # OPTIONS is a list with an even number of elements containing > + # option-name and option-value pairs. > + # Current options are: > + # cu_is_64 0|1 - boolean indicating if references from location > + # descriptions refer to a 64-bit DWARF CU. > + # default = 0 (32-bit) > + # cu_version n - section version of DWARF CU referenced from location > + # descriptions. > + # default = 4 > + # > + # BODY is Tcl code that emits the parts which make up the body of > + # the debug_loc contribution. It is evaluated in the caller's context. > + # The following command is available for the BODY section: > + # > + # loc_entry > + # -- emit a .debug_loc entry > + > + proc loc { options body } { I would suggest using the same trick as used for rnglists: rename loc_entry to _loc_entry (or something like that, to show it's internal). And use: with_override Dwarf::entry Dwarf::_loc_entry { uplevel $body } Users would then look like: loc { ... } { entry 0x123 0x456 { ... } } I think that looks good: because you are in the "loc" context, it is obvious enough that entry is a location list entry. I think that makes it easy to write. I would have suggested renaming "loc" to "loclist", because this is actually generating a "location list", according to the standard. But that might become confusing with the DWARF5 "loclists"... But other than that, the patch LGTM. Simon