From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id CBB6B385840D for ; Tue, 23 Apr 2024 18:12:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBB6B385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CBB6B385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713895973; cv=none; b=YH2E9cf2oT9rqSliRGSsbkjypei6e01aTOrA/lmiUZmpy7l5TExg9uixtDhRP+HJnplKVVDj9BvGIvqRAbxShFiHfKgwcGjtALQi8Ryf8m0zaP8qlKD7Pw8xtIbkVrMHZysDRf25rUfWaNrICV04D4i2IsVkiCH8urbL1uEKPJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713895973; c=relaxed/simple; bh=joqL/QwJyvUZGeV4vCZGDahNmTC7I6DOgEsSs+nJxg8=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=eU9xL6V39F7zHiZSDbY/myuXzDzt58XsbREnGMA2LQDLZZvH9HTi07iJdLjP3ooneWN+nkNoO4eaGstPDOdrqayWvx4LxizYU+52EbDzlcNxfYVkcsACYhTU1xAi/55vMjoZWycMwIwUWe5CrHyS0O0eKsGIIYmlV63byiZYFME= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713895971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dZcChS9xqiRH5fj2fHCmvZNQkFBBfBdh0nvDW7WPYSI=; b=iD0SfI9aa2ZRSYC/JeFsN6Mr8xs40d8V77FcjRhJjmuw6JoYzIcXCAAFSWPkaArZtP2oVF E8l0/5hQL5+U0aP0Es2XoZ7v0pKf/lEsjvzwcGzPKrj+PGoybnwGXQ2GuKa2OcALE6aGzk EhD4MOnS8v4nSdHLVnj737G7gZn8W/Y= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-501-L-CmcFZKO72Pl8gVhv5q9g-1; Tue, 23 Apr 2024 14:12:50 -0400 X-MC-Unique: L-CmcFZKO72Pl8gVhv5q9g-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-69bc71365aaso75251826d6.0 for ; Tue, 23 Apr 2024 11:12:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713895965; x=1714500765; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dZcChS9xqiRH5fj2fHCmvZNQkFBBfBdh0nvDW7WPYSI=; b=vkft4vFRZhmNqjTwV3MU8DY82zzujf3T/Y1N8sCQpn2mNnOHzVIqgN0y3DBIver9xm cTyZ3ivHALu9Hmdr2O4P1A0xu6gwantf9I6QUNFThihJMKORQFc4nLuExuhPMMaPnRy3 OFEPk/Nq4LBLY0whsBMn8++gUQUFFpcYeWyX5H44I+xHuRsQT5/MKGJ1dd3soKjGSfCR +LGFKjyGPWTaWE3B3AmjmIm20ukKKYtUd6tVLu5s6jMyR6LUv85H55GhNCsn7mUIY9oa AB4OSrZXreBaxTmE8ij1IUkSjSnF+d/sL7vgTHC/cLruy6w9XHVavlknHEcwutorqNuh Mc/A== X-Gm-Message-State: AOJu0YxwtiEWCrKzkPm7tTRbi0fdHfRE5dRidozSt0IQn9Wwc/wvZ/PP fJosExsutPozUJkWNNo6lA+RfprBNVXls2N50CcnynAZTBEYa1m3XogCCQEFZrkNnzevTVpuzNx DRZfBoOJtBHbiepXLkWF+vcYsmE5bBrUFhI1bZR3GAjxmsmX4lYflU5CK1HJbrdqvy3SILJGHup aSYvj/QnnMifUE01+ZCsMK91Or7+m8KEYsxWqVfWqr X-Received: by 2002:ad4:4e0a:0:b0:6a0:5978:40fc with SMTP id dl10-20020ad44e0a000000b006a0597840fcmr140710qvb.61.1713895965731; Tue, 23 Apr 2024 11:12:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH84v0XTzo+Kc9FOUF9h8wRpnFrNqtToxkHrRrz5M0C7AaouLl5AJfux75iZDvEPxt8Jx9jJUigioGchRiFip0= X-Received: by 2002:ad4:4e0a:0:b0:6a0:5978:40fc with SMTP id dl10-20020ad44e0a000000b006a0597840fcmr140697qvb.61.1713895965456; Tue, 23 Apr 2024 11:12:45 -0700 (PDT) MIME-Version: 1.0 References: <20240419005035.960853-1-amerey@redhat.com> In-Reply-To: <20240419005035.960853-1-amerey@redhat.com> From: Aaron Merey Date: Tue, 23 Apr 2024 14:12:34 -0400 Message-ID: Subject: Re: [PATCH] loc2stap.cxx: Add partial support for DW_OP_bra in DWARF location lists To: systemtap@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Apr 18, 2024 at 8:50=E2=80=AFPM Aaron Merey wro= te: > > Add support for DW_OP_bra when operand is non-negative. Previously > systemtap would quit probe translation if DW_OP_bra was seen in a > DWARF location list. > > Tested manually on RHEL 8.9 with kernel 4.18.0-513.24.1.el8_9.x86_64. > Scripts containing a vfs.read probe require DW_OP_bra support when > run with this kernel. > > Support for DW_OP_bra negative operands continues to be deferred due > to lack of use as well as being more complex to implement. > > https://sourceware.org/bugzilla/show_bug.cgi?id=3D31496 > --- > loc2stap.cxx | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > > diff --git a/loc2stap.cxx b/loc2stap.cxx > index 53316a480..883993040 100644 > --- a/loc2stap.cxx > +++ b/loc2stap.cxx > @@ -435,9 +435,26 @@ location_context::translate (const Dwarf_Op *expr, c= onst size_t len, > } > break; > > - /* Control flow operations. */ > + /* Control flow operations. */ > + case DW_OP_bra: > + { > + POP(taken) > + if (taken =3D=3D 0) > + break; > + } > + /* FALLTHROUGH */ > + > case DW_OP_skip: > { > + /* A backward branch could lead to an infinite loop. So > + punt it until we find we actually need it. > + > + To support backward branches, we could copy the stack, > + recurse, and place both traces in arms of a > + ternary_expression. */ > + if ((Dwarf_Sword) expr[i].number < 0) > + DIE("backward branch in DW_OP operation not supported"); > + > Dwarf_Off target =3D expr[i].offset + 3 + expr[i].number; > while (i + 1 < len && expr[i + 1].offset < target) > ++i; > @@ -446,13 +463,6 @@ location_context::translate (const Dwarf_Op *expr, c= onst size_t len, > break; > } > > - case DW_OP_bra: > - // ??? Could copy the stack, recurse, and place both > - // traces in arms of a ternary_expression. No point > - // in doing that if this is never used, however. > - DIE ("conditional branches not supported"); > - break; > - > /* Memory access. */ > case DW_OP_deref: > // ??? Target sizeof, not host sizeof. > -- > 2.43.0 Pushed as commit 22e146b57ec Aaron