From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NGsrApUhqGA2BwAAWB0awg (envelope-from ) for ; Fri, 21 May 2021 17:09:41 -0400 Received: by simark.ca (Postfix, from userid 112) id ECE011F11C; Fri, 21 May 2021 17:09:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.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 457D01E783 for ; Fri, 21 May 2021 17:09:40 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 65D79386FC09; Fri, 21 May 2021 21:09:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65D79386FC09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1621631379; bh=ZfFhFm5ERikp2yvl3k2ewCasxYqg7TFBY8/nnvIq8w0=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=t/MbJSzT+o2WgZetaMZ275B+yVg3s6D4htSMLDJx/7uv7hOnxzdwO/IKEeEu0x7NV 2U86zB6gkxC7ni3/XDBM9pHqG+5a5E/EplAXpiSL6yy52NIAqi3NWNaFQ1ckZr20m7 1NYeB3YPxB7ZXUWWNzWan+bWLWw8Ow05BrbBIPNc= Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by sourceware.org (Postfix) with ESMTPS id C5889386FC09 for ; Fri, 21 May 2021 21:09:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C5889386FC09 Received: by mail-pj1-x1033.google.com with SMTP id b13-20020a17090a8c8db029015cd97baea9so7717938pjo.0 for ; Fri, 21 May 2021 14:09:36 -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=ZfFhFm5ERikp2yvl3k2ewCasxYqg7TFBY8/nnvIq8w0=; b=rMCzHPTXn4UyyPtKXXV44wmlIcedCdEKp9guUYFlP2PV06NomXFSfISZyARFYfr9tq vKsfjszhbHV0ILc5fAgJi7/2IJsmZFGB+0YqLS2rnaGf79vSvk7fu3PZL5joaISz5yRd kURu+VsrLmqqGlpQi8vvkB4T7NLTlFJ+3WhMT6gVyeWeco9VqTUW5po2APTJ6m3MfNvW 9RqElnkBH8415Db8ky3VLS1k+edm8cSDfsvLCOKHL6k/Vc5ea/PEwCOQRg3wVX3DAUXE AnAiFK8OttVKzUmb3RMYjFpv2NveBa+KTS0bdeYPXvJg1kbNqvXMotwuTbt0/rdoLf1q vxRw== X-Gm-Message-State: AOAM533wNceCnSgsKfzUW4xBamhd2gXrcE7AQjYMT9sNHWoRglXCbqlQ RlOSTCvuDMpVQtugzUDs8idnHu/XjqVmtojmzbg= X-Google-Smtp-Source: ABdhPJwQ93EVezXawJH/fJFUJ/jUvKTdl9CDrXCfF3nkaCpuT3f8NpLjwfW38q9/WCeRVeqi6pfzx8t6B5JcskOcXDI= X-Received: by 2002:a17:90b:4d82:: with SMTP id oj2mr12342990pjb.61.1621631375658; Fri, 21 May 2021 14:09:35 -0700 (PDT) MIME-Version: 1.0 References: <20210521140340.GC2295059@embecosm.com> <4319e88e-4f22-fce6-8678-07e27fb043d4@amd.com> In-Reply-To: <4319e88e-4f22-fce6-8678-07e27fb043d4@amd.com> Date: Sat, 22 May 2021 02:39:23 +0530 Message-ID: Subject: Re: Re: GDB | DWARF expression | Extracting a range of bits from an 'xmm' register To: "Zaric, Zoran (Zare)" Content-Type: text/plain; charset="UTF-8" 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: , From: vaibhav kurhe via Gdb Reply-To: vaibhav kurhe Cc: "gdb@sourceware.org" Errors-To: gdb-bounces@sourceware.org Sender: "Gdb" On Fri, May 21, 2021 at 10:36 PM Zaric, Zoran (Zare) via Gdb wrote: > > On 5/21/21 3:03 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 attribute 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 Vaibhav, > > Maybe I am missing something, but what is the end goal that you are > trying to accomplish? > > The way how you formed your expression, you can only get a read only > stack value location description. > > Why not use the DW_OP_bit_piece with your register being the only piece > inside of it and then use that as your end location description? > > Thanks, > Zoran Hi Zoran, Thanks for the reply! Actually I am trying to improve an object file's debug info in case of a vectorized transformation by the compiler. e.g. when a source variable, 'sum' = (xmm0[0-31] + xmm0[32-63] + xmm0[64-95] + xmm0[96-127]). Thanks for pointing out the DW_OP_bit_piece operation! It worked in a setting where a source variable resides directly in a 32-bit chunk of an 128-bit xmm register. But, I think it won't be possible for the above example(?). Here, we'll have to do 128-bit operations (such as DW_OP_shl) on the register to get its 32-bit chunks. Is that correct? Regards, Vaibhav