From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id 6333B3857C56 for ; Fri, 21 May 2021 20:37:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6333B3857C56 Received: by mail-pg1-x534.google.com with SMTP id q15so15135799pgg.12 for ; Fri, 21 May 2021 13:37:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=liQOlpS8QeGXxEUSvpg0rxYF52hRG0XK/1aWLNPeST0=; b=RArlQ5qC10ruPpxehcFhT86q1xun4I9Q+vE11EGOzl8ZjFEuhH9+iyFgWXzka/coaM E7UlA4WdEZnnrjV+qpc5ZTNQ0eaD80DTftz2LaWx59IQquVqHJQq9cSydsTNCs/Os7bj TCD/3U11sPjKkKJFmdBOD5u5GGVcuJzMCWfk0Aqq5vHZprg4A69sOdMq3Guzwmtd5Hdq +jC/kVYdiNz2eEB0GMEugq3pa/+J9+t4mz1TIlmfUE6pUElLAch+xf8K2qw9K5MVQOyf IZ3Dwc8dP1SyYuiON8FgTJsANaETQAKQ0yUlyRSTYeQpBixrW2+SR/3y6dzBAQ5vxrlf YahA== X-Gm-Message-State: AOAM530fpwFb4YqeA7uPZPRwWYSPH0/cmDGRk83FNKunp4/FmGI+0xkg BcnG++bSF8lnOuJ6AkGNO3JzO93X0gBdpXaO3kkj3YOu10Y= X-Google-Smtp-Source: ABdhPJzICJ+/bjETy23x0O+9g8FVp4P1mglkvGM2P67QpohHHugcsKgio4VNdkTApdE4phMAorRkL17nrkhIRemBFNQ= X-Received: by 2002:a62:5a46:0:b029:2d5:a67:1460 with SMTP id o67-20020a625a460000b02902d50a671460mr11813273pfb.75.1621629478481; Fri, 21 May 2021 13:37:58 -0700 (PDT) MIME-Version: 1.0 References: <20210521140340.GC2295059@embecosm.com> In-Reply-To: <20210521140340.GC2295059@embecosm.com> From: vaibhav kurhe Date: Sat, 22 May 2021 02:07:45 +0530 Message-ID: Subject: Re: GDB | DWARF expression | Extracting a range of bits from an 'xmm' register To: Andrew Burgess Cc: gdb@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2021 20:38:00 -0000 On Fri, May 21, 2021 at 7:33 PM Andrew Burgess wrote: > > * vaibhav kurhe via Gdb [2021-05-21 14:27:15 +0530]: > > > Hello all, > > For a use case, I am trying to build a DWARF expression which represents > > the value of an arbitrary range of bits (e.g. 96-127 bits) in an *128-bit > > xmm register* to be used as a *location attri bute value* for a variable DIE. > > I am using GDB to consume the debug info and test it. > > > > Following is the expression I started with to test out a shift operation on > > an 128-bit xmm0 register using Typed DWARF stack :- > > > > *"DW_OP_GNU_regval_type: 21 (xmm0) <0x30>; DW_OP_GNU_const_type: <0x30> 16 > > byte block: 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; DW_OP_shl; > > I'm probably just not understanding correctly, but I'm confused by the > use of DW_OP_GNU_const_type. Isn't this providing the number of bits > to shift? I'd have expected something like 'DW_OP_const1u 96'. > > Thanks, > Andrew Hi Andrew, Thanks for the reply! Yes, the second operand to DW_OP_shl is indeed the number of bits to shift. But, I saw that the DWARF5 standard mentions that both the operands should be of the same type. So, in this case, as the 1st operand is typed (which points to a DIE for the base type), I think the 2nd operand also has to be typed and hence used the operation DW_OP_const_type. Regards, Vaibhav