From patchwork Fri Oct 1 13:33:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12530653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E96D0C433FE for ; Fri, 1 Oct 2021 13:33:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF3C361A6F for ; Fri, 1 Oct 2021 13:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353423AbhJANfn (ORCPT ); Fri, 1 Oct 2021 09:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353560AbhJANfm (ORCPT ); Fri, 1 Oct 2021 09:35:42 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79F6DC06177C for ; Fri, 1 Oct 2021 06:33:58 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id bd28so34784733edb.9 for ; Fri, 01 Oct 2021 06:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4EjK5wzb7SYrY+vgWTVbp0U5AJvVCk4AwWIopyVM5II=; b=QyMl0QpNIWgL3hKhoiQ+7q+SNzftiqB68WMKBsgAboSB9hknYYSAbqq5mjSrlT4q9i g6+gcZyjwiZd8omXgt1bF2dBNbjmFgnRSAfEMjSreQTRpaWiFDKMqhZ89ElhPt/dblAg QCUO4RE6gX3vhatbTMspR/95QCiEGb6X1UO7mbP/BNNI1BDRJDQTrhhv7y71DB7Qn/pm hJEUvjzzC4TInTUPvQDrr9hIn5hKuFukie9/sX4BgS/AeNVOPNfpmJv7l3AlPcHV9Xta 1kYYHLOb63Lkqj5Ru2rdVFLX3p5c01F+rl700CC/QmrhyYw/0qq7KuUtXbCTQn8TFqxj tHVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4EjK5wzb7SYrY+vgWTVbp0U5AJvVCk4AwWIopyVM5II=; b=izZbBgLSzH/rU+sqFjZqDQodxgJ0T9mmBHw04UldooOFe47TV/tnFWLsZjxkmJ3yMq d83TbehpIIh01dTu/iZWPm5UtMH2SkiMIAR+1qrP4x+MtvUtpn3kiBpQXXjtJRPaZBF1 SbYpLI9gqziZWUB0YPJ6Ad7udQDw2Y0/HAKqKTBWlQ2PFyKYlLGkaEew8k2I9EAPPaJg 0E/37MNZyFGU9U+KNueRnMqLXCNhEwZiCRVVyixQHACE8edCEy6P5ywxSIbIcpfT63Cb 6F/fi+qHW5JRt7n6a3VphBepEoVTOiznoyv/+5sozU8y6nNn8+GLn9zEtbwuVG5S6tNb XvCQ== X-Gm-Message-State: AOAM530cq3GHaUPMuVCYvyd8WjtNVr0q5lDukml84cKMxGgyW4bnm/UH hQTHV7VHeTGp/jiWMbcEwBz+8p33cL8= X-Google-Smtp-Source: ABdhPJxWLmo06iCtXUjGZe0innDwg+gcRfESJvMqo1cFLZfyOvJoTxXLxQ3PfXZNeKPErdzkIRayVg== X-Received: by 2002:a05:6402:4d1:: with SMTP id n17mr14846965edw.337.1633095236021; Fri, 01 Oct 2021 06:33:56 -0700 (PDT) Received: from crow.. ([84.40.93.30]) by smtp.gmail.com with ESMTPSA id ne24sm2993250ejc.46.2021.10.01.06.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 06:33:55 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" Subject: [PATCH 1/5] trace-cruncher: Error on fail to destroy Date: Fri, 1 Oct 2021 16:33:42 +0300 Message-Id: <20211001133346.8217-2-y.karadz@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211001133346.8217-1-y.karadz@gmail.com> References: <20211001133346.8217-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Always print an error message in the case when the C object, being wrapped by the Python type failed to destroy. Signed-off-by: Yordan Karadzhov (VMware) --- src/common.h | 7 +++++-- src/ftracepy-utils.c | 4 ++-- src/ftracepy-utils.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/common.h b/src/common.h index abfda1f..697b327 100644 --- a/src/common.h +++ b/src/common.h @@ -54,8 +54,9 @@ static inline void no_free(void *ptr) #define NO_FREE no_free -static inline void no_destroy(void *ptr) +static inline int no_destroy(void *ptr) { + return 0; } #define NO_DESTROY no_destroy @@ -101,7 +102,9 @@ static int py_type##_init(py_type *self, PyObject *args, PyObject *kwargs) \ static void py_type##_dealloc(py_type *self) \ { \ if (self->destroy) \ - obj_destroy(self->ptrObj); \ + if (obj_destroy(self->ptrObj) < 0) \ + printf("fracepy_error: object '%s' failed to destroy\n",\ + c_type); \ ptr_free(self->ptrObj); \ Py_TYPE(self)->tp_free(self); \ } \ diff --git a/src/ftracepy-utils.c b/src/ftracepy-utils.c index ca7f914..e49132d 100644 --- a/src/ftracepy-utils.c +++ b/src/ftracepy-utils.c @@ -1757,9 +1757,9 @@ PyObject *PyKprobe_probe(PyKprobe *self) return PyUnicode_FromString(self->ptrObj->probe); } -void ftracepy_kprobe_destroy(struct ftracepy_kprobe *kp) +int ftracepy_kprobe_destroy(struct ftracepy_kprobe *kp) { - unregister_kprobe(kp->event); + return tracefs_kprobe_clear_probe(TC_SYS, kp-> event, true); } void ftracepy_kprobe_free(struct ftracepy_kprobe *kp) diff --git a/src/ftracepy-utils.h b/src/ftracepy-utils.h index 9f4c4ba..a6133cf 100644 --- a/src/ftracepy-utils.h +++ b/src/ftracepy-utils.h @@ -26,7 +26,7 @@ C_OBJECT_WRAPPER_DECLARE(tracefs_instance, PyTfsInstance) struct ftracepy_kprobe; -void ftracepy_kprobe_destroy(struct ftracepy_kprobe *kp); +int ftracepy_kprobe_destroy(struct ftracepy_kprobe *kp); void ftracepy_kprobe_free(struct ftracepy_kprobe *kp); From patchwork Fri Oct 1 13:33:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12530651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA08CC433EF for ; Fri, 1 Oct 2021 13:33:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA72E619F7 for ; Fri, 1 Oct 2021 13:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231646AbhJANfn (ORCPT ); Fri, 1 Oct 2021 09:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353546AbhJANfm (ORCPT ); Fri, 1 Oct 2021 09:35:42 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53C42C061775 for ; Fri, 1 Oct 2021 06:33:58 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id g7so34118155edv.1 for ; Fri, 01 Oct 2021 06:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B+AmNzEkMuB/aoxmkAsnfhR/Yi68SmIljR8x7H61Kwc=; b=gF9an5DNQB/cO+WnWsHo5XErT1bsf51p7ahf7AXSvGGeEglD9QbmX42BX995UaOqXI SEazlQ8aHf/Tzgrfj7OBxmlDe4tIPSEmwQVg6Dj5Wn9ekuTDIO78dZsgkeMXFuhkT4gy ViR2HBjMC3iQRm3zoTTa3k3BMuB+8R7qLOXLL994zYeKYuhOrF4xnHFCRjF9euilSm74 Y5GUzUuPRN1MXcrF/Dqguy8Lv8ObdhnowDQ466aSALy4T9/TEwIYXsTnqg527rMiCMWk UWIdsldxDtXgJMsnoaujV84OR7r3dCp9sW5VbsH0Jadh8v/XPN3M3lGd0UPu9rK1uQi0 vWZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B+AmNzEkMuB/aoxmkAsnfhR/Yi68SmIljR8x7H61Kwc=; b=3kHgsEo+YPINgyFkQ86XsQRKBPRukB7mPHKaYuCvmF+nFFyOlWku+BPYX81Tk9fv/B fp7N1v2V7JDV3Q+Hf0ru55sur4p18PXbPAqMJVX9dhUO75o5ouFK5/xckP3b/iezjIkI BsOo/tOTFeI5Gq2OSsw4m8XL18qhgX+d0LF4pJyGnYd05Ep/IxP5E98oWn7CnUf9go3H HgGawM0vrbZxPsqqqqBpR4IO3jwnTpOPwsZX+I/abf/hqmFgGdfGJoiZmIo1jjpTflJG WZ+aHKVYoz/dH/MvkadUGJcum8OzYu/gOQnraHGo8RQjgjPBHy86+uR+Q1W6FUTikIPR CZDA== X-Gm-Message-State: AOAM530mqAZWDL8La2JQ5xq47fF/BdXUuYc3euqppjIhMLrGF6OzDiFh 5butzcMwhiiFpMAtg2nVRpUow276BZ8= X-Google-Smtp-Source: ABdhPJz4u1Nqe/Bymfb4SvbnXrOdCvPeYSNrFmNIXQdyrWrnuN1OP3Ydz3SEOCrF3EXFVtqiLDL5ag== X-Received: by 2002:a17:906:3542:: with SMTP id s2mr6542898eja.379.1633095236736; Fri, 01 Oct 2021 06:33:56 -0700 (PDT) Received: from crow.. ([84.40.93.30]) by smtp.gmail.com with ESMTPSA id ne24sm2993250ejc.46.2021.10.01.06.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 06:33:56 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" Subject: [PATCH 2/5] trace-cruncher: Proper type name for the python objects Date: Fri, 1 Oct 2021 16:33:43 +0300 Message-Id: <20211001133346.8217-3-y.karadz@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211001133346.8217-1-y.karadz@gmail.com> References: <20211001133346.8217-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org This name gets printed as part of the error messages. It makes no sense to have it include the 'C' type since the developer that will see the error message will have no idea about the 'C' internals of the Python module. Signed-off-by: Yordan Karadzhov (VMware) --- src/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common.h b/src/common.h index 697b327..b4c66b7 100644 --- a/src/common.h +++ b/src/common.h @@ -63,7 +63,7 @@ static inline int no_destroy(void *ptr) #define STR(x) #x -#define MAKE_TYPE_STR(x) STR(trace.x) +#define MAKE_TYPE_STR(x) STR(ftracepy.x) #define MAKE_DIC_STR(x) STR(libtrace x object) @@ -84,7 +84,7 @@ bool py_type##_Check(PyObject *obj); \ #define C_OBJECT_WRAPPER(c_type, py_type, obj_destroy, ptr_free) \ static PyTypeObject py_type##Type = { \ - PyVarObject_HEAD_INIT(NULL, 0) MAKE_TYPE_STR(c_type) \ + PyVarObject_HEAD_INIT(NULL, 0) MAKE_TYPE_STR(py_type) \ }; \ PyObject *py_type##_New(struct c_type *c_ptr) \ { \ From patchwork Fri Oct 1 13:33:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12530655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71DD0C4332F for ; Fri, 1 Oct 2021 13:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5717A61A58 for ; Fri, 1 Oct 2021 13:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353474AbhJANfn (ORCPT ); Fri, 1 Oct 2021 09:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353417AbhJANfn (ORCPT ); Fri, 1 Oct 2021 09:35:43 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F6C0C061775 for ; Fri, 1 Oct 2021 06:33:59 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id g8so35015044edt.7 for ; Fri, 01 Oct 2021 06:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f/WIocOx46HgtLA2MAA4Oxqaf3Pj2rly+XfLWcKZmA8=; b=LOUXX6lQof8Qr87Z2fpW9r61R0msdxgE80ElVmOGClvOsAVUC7uRgil0dXRZTNK465 gYOBu2VhCtEXwMwRHSi5KeLTEsGt5wz39y2/bAQICrK65TcxX9i41V8ixwm6h62RI/OG OnoY0T2eHXUgi+YXwCjAk4eNtwuSiBud+aECVrCiQfPlPmV20NTQRpeLWwa8tqWu55Os CayChUv0tD49vUsRp7Ont4+BhhK4+dCBrzNJXxRfhZHOWQfHqDwkC7XA77NC5FltHQog +mpa4PdSZEgRu4qxElpiHLA6wWV5pTl1gqy7V0ZyQ4OpNwrvjg86JpWy/Lpz0TJDH+TK qjwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f/WIocOx46HgtLA2MAA4Oxqaf3Pj2rly+XfLWcKZmA8=; b=oJzvA4jejV5mIu2w0hUNoLK1BVnVBf1+tjvz+0MhNg8e/fBVbX0SmW4qD40BUuZAip l7KQwnDAV4UlBimtfAyf2hbgJMBY+YHyLFJuh6VM7UVJNTgXptcsLuTdE0taXcgkYRMj xzIXknfD6LcHfB1cEGqaAQiu7i1zHiM+oz9j1MgdmGd57ym7oGvnGgzAWfhN74MC0R6g 7xaP6cndFwuD5jrZICCjrganDN1so56MmkF32o+mAz2CrKyIf4Vqed1evMkReJCZQq/5 YloiZYyxz664XYb4bTqWgvDaoSveRoziH6quBSDvP2o+RPEnVpIyKWGWelgq02DBRF3w UWyA== X-Gm-Message-State: AOAM532bsZK86cLG9vFN/qa9T22DzupDNkduTijfwiMG/kVWCwh3DHPu hOe1y+U48fHxOyP0gRFXrtTfkAnKH5Y= X-Google-Smtp-Source: ABdhPJy+YKSDY87cbqSKlLidHe6d0Yl7TG5vUpvxIO/vTfIC3crv46eJGQ8eu4rP3z5KwTu5mhWCZA== X-Received: by 2002:aa7:c484:: with SMTP id m4mr14516023edq.123.1633095237478; Fri, 01 Oct 2021 06:33:57 -0700 (PDT) Received: from crow.. ([84.40.93.30]) by smtp.gmail.com with ESMTPSA id ne24sm2993250ejc.46.2021.10.01.06.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 06:33:57 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" Subject: [PATCH 3/5] trace-cruncher: Correct misleading error message Date: Fri, 1 Oct 2021 16:33:44 +0300 Message-Id: <20211001133346.8217-4-y.karadz@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211001133346.8217-1-y.karadz@gmail.com> References: <20211001133346.8217-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Indeed, the callback function can be included from a plugin, but this is an option. In the default case it will be searched in '__main__'. Signed-off-by: Yordan Karadzhov (VMware) --- src/ftracepy-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ftracepy-utils.c b/src/ftracepy-utils.c index e49132d..b0f5e0e 100644 --- a/src/ftracepy-utils.c +++ b/src/ftracepy-utils.c @@ -2039,7 +2039,7 @@ static PyObject *get_callback_func(const char *plugin_name, const char * py_call py_func = PyObject_GetAttrString(py_module, py_callback); if (!py_func || !PyCallable_Check(py_func)) { TfsError_fmt(NULL, - "Failed to import callback from plugin \'%s\'", + "Failed to import callback from \'%s\'", plugin_name); return NULL; } From patchwork Fri Oct 1 13:33:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12530657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D502C43217 for ; Fri, 1 Oct 2021 13:34:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2261961A63 for ; Fri, 1 Oct 2021 13:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353450AbhJANfo (ORCPT ); Fri, 1 Oct 2021 09:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353417AbhJANfo (ORCPT ); Fri, 1 Oct 2021 09:35:44 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5FFEC06177C for ; Fri, 1 Oct 2021 06:33:59 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id dj4so35877306edb.5 for ; Fri, 01 Oct 2021 06:33:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R8icoEkGb41zqL0B3PZP6RAv/SRyfl25n9bUPYsbBTM=; b=Gvi+oFIC+a64ZPimAjun3guoDS5xmlOyq60UR+MeVU0MHigHx4uNGXS5fINVfj7wF/ kqbZ8P709VIRas4ksSH9aRTJ5L8uwECwHZJPqvgrRfXxdFyEHOJa3tGSX12m2ROWJ67/ l1Cwh0FhR3k3sI2/i4UK/MbZXXj5ZEOssVUOle7yJBAO2XOxo+C6L/p/gnMq/nVWQMql ysUQLla82AhtImA6jascKlu5LlyXBwUZ8fUJhQ9ID25WUuYN4TfjN3p9rfTe1NfR4cBf AvneictldyLimPT8vaahIaQayV5xtpsREirhZU7tBmm+TEfNBucadA6CJMhsHyRmYQVo Ezwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R8icoEkGb41zqL0B3PZP6RAv/SRyfl25n9bUPYsbBTM=; b=Z1FHPoYBVBG5YoxK0OJJ+VOJjin0HWDS2wEdBhpHP0v/B96iIAQlN2WFFLHqBW+wzI nJYOOgnJL/AWf+UtE2QbN9VAuOE6FM6tM34UvFsVh1YdSLgIVBBgCUu2Qhl/t9baWDNP zIPhuJ7fyhrIgL12fvJBhhc9SLJo+A8MCuj1FD9sMxDskPkXt5A0pVJcGH0ZUWvkjgH3 lpycTzJPQ3SGWQt0IVdAlZMLjVqFuo09ptCIREegIKH7E3udTai/hOHXSsq/pFjcImBv 0cVAyJSfUtCl0vW5zGuo0m2rmZdqP1F+qh5Ma99etcYV2haWPTskeN9p56RV2Yy/nnNn 7pwA== X-Gm-Message-State: AOAM5325lDBEviH/cir5gwHJ14ayN1R0G8i96TG3fTxDR6KVXccg13E9 wQFNuDDd44sXVl31jigs7NGs1PXsClw= X-Google-Smtp-Source: ABdhPJxA14B0Y855eeCgLayS0i8REU5DDDWEP0rs2b6y5Hy56PM9EqgtMMdkVgHCp4NmOa0lnVHUjA== X-Received: by 2002:a17:907:7ba8:: with SMTP id ne40mr6246452ejc.517.1633095238204; Fri, 01 Oct 2021 06:33:58 -0700 (PDT) Received: from crow.. ([84.40.93.30]) by smtp.gmail.com with ESMTPSA id ne24sm2993250ejc.46.2021.10.01.06.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 06:33:57 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" Subject: [PATCH 4/5] trace-cruncher: Proper labeling of the libtracefs errors Date: Fri, 1 Oct 2021 16:33:45 +0300 Message-Id: <20211001133346.8217-5-y.karadz@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211001133346.8217-1-y.karadz@gmail.com> References: <20211001133346.8217-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org 'TEP_ERROR' is supposed to be used with errors coming from libtraceevent, not from libtracefs. Signed-off-by: Yordan Karadzhov (VMware) --- src/ftracepy-utils.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ftracepy-utils.c b/src/ftracepy-utils.c index b0f5e0e..1a8a136 100644 --- a/src/ftracepy-utils.c +++ b/src/ftracepy-utils.c @@ -68,14 +68,14 @@ static void TfsError_fmt(struct tracefs_instance *instance, vasprintf(&tc_err_log, fmt, args); va_end(args); - PyErr_Format(TEP_ERROR, "%s\ntfs_error: %s", + PyErr_Format(TFS_ERROR, "%s\ntfs_error: %s", tc_err_log, tfs_err_log); tfs_clear_error_log(instance); free(tfs_err_log); free(tc_err_log); } else { - PyErr_FormatV(TEP_ERROR, fmt, args); + PyErr_FormatV(TFS_ERROR, fmt, args); va_end(args); } } @@ -86,11 +86,11 @@ static void TfsError_setstr(struct tracefs_instance *instance, char *tfs_err_log = tfs_error_log(instance, NULL); if (tfs_err_log) { - PyErr_Format(TEP_ERROR, "%s\ntfs_error: %s", msg, tfs_err_log); + PyErr_Format(TFS_ERROR, "%s\ntfs_error: %s", msg, tfs_err_log); tfs_clear_error_log(instance); free(tfs_err_log); } else { - PyErr_SetString(TEP_ERROR, msg); + PyErr_SetString(TFS_ERROR, msg); } } From patchwork Fri Oct 1 13:33:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yordan Karadzhov X-Patchwork-Id: 12530659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10772C433EF for ; Fri, 1 Oct 2021 13:34:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E817661A6F for ; Fri, 1 Oct 2021 13:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353417AbhJANfp (ORCPT ); Fri, 1 Oct 2021 09:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353457AbhJANfp (ORCPT ); Fri, 1 Oct 2021 09:35:45 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C40C0C06177C for ; Fri, 1 Oct 2021 06:34:00 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id r18so34768458edv.12 for ; Fri, 01 Oct 2021 06:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lqLfeCXW8Co0+lShPB+Fd57Z4uhlbTbc6z8AwLR/XZw=; b=SUlcB2sbgthDPH/giQg5bWAZHzaafkNOW+t6DuSpKLj7nXrs/TSSCze+BaiOh5kl+Z Ji/lxbipQmM0UpmiAhZI0C5KS1QFD44w36Fdf00+QSfESnmB3ljezeYodltgpK7RyW88 QcQ3nNXVVjEPTipH532+76thH0JV8cHmeDjcX4eWa/9VmQNBcyhCtcuQoeMx1/mjd8a1 094blY+vCpAlJoAmyFgRyGXbgYxnUvnGPIgweLcHztcYjKLdTXtLuL+2Nsbj2j7y/wHq WsrgPa6m4efr0XqEEWDbsRc9PdI+rDCzXYwngoM3KJWRMwR9pwZKHnOzl8GMc9NzGGwW itbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lqLfeCXW8Co0+lShPB+Fd57Z4uhlbTbc6z8AwLR/XZw=; b=UHYVCxThMNJMR885TNl/WNiTxNXvsrA0mR58Ol+L2rWZuuy9eOJHYx1qw+RDtfc0Ra cZ/ynE2q0M8N295J3AhSNxNH4Qcaxt6Ab1lblIIwXn3MFHNjWRyvuFBUEzWCEYAolSY1 KmktrOEMDh5pL73AiYo+M8Ebh2Y31VBg1WvkEOzRyfsPIaY9pf/2zKBfHAm0S1qJnQx5 rc1SFqKrnNmvy98DdXgQdlScLG3p01Z4biYWRejUWkfP9rVyw48amsV8n6BlIOrQWLt/ qcNo2XPc+/I3HInsJB4/ICmXhYQPglzbhib4S0gdw/XRav1Rvcx5sM2dPqbVoXEZNplR IEHQ== X-Gm-Message-State: AOAM531fTQMVo4Bn5sPmnZQJZ9pnorQ6hhaV2tJ19bfR+VJ8zXLlrIUy ALlx+YDwHUOSbHuLd0AXY+4RKgR4ec0= X-Google-Smtp-Source: ABdhPJwyvRPG4vkXIOXPxOZWIhddbKLtfgCWL8Q5XhUOAHOGxjGebzu/xCMzng7kT3HDFvBln/PMuA== X-Received: by 2002:a05:6402:713:: with SMTP id w19mr6572907edx.366.1633095238907; Fri, 01 Oct 2021 06:33:58 -0700 (PDT) Received: from crow.. ([84.40.93.30]) by smtp.gmail.com with ESMTPSA id ne24sm2993250ejc.46.2021.10.01.06.33.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 06:33:58 -0700 (PDT) From: "Yordan Karadzhov (VMware)" To: linux-trace-devel@vger.kernel.org Cc: "Yordan Karadzhov (VMware)" Subject: [PATCH 5/5] trace-cruncher: Proper labeling of non libtracefs errors Date: Fri, 1 Oct 2021 16:33:46 +0300 Message-Id: <20211001133346.8217-6-y.karadz@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211001133346.8217-1-y.karadz@gmail.com> References: <20211001133346.8217-1-y.karadz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org Those particular errors are internal for trace-cruncher and have nothing to do with libtracefs. The labels must indicate this. Signed-off-by: Yordan Karadzhov (VMware) --- src/ftracepy-utils.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ftracepy-utils.c b/src/ftracepy-utils.c index 1a8a136..d8115f6 100644 --- a/src/ftracepy-utils.c +++ b/src/ftracepy-utils.c @@ -2031,14 +2031,15 @@ static PyObject *get_callback_func(const char *plugin_name, const char * py_call py_name = PyUnicode_FromString(plugin_name); py_module = PyImport_Import(py_name); if (!py_module) { - TfsError_fmt(NULL, "Failed to import plugin \'%s\'", + PyErr_Format(TRACECRUNCHER_ERROR, + "Failed to import plugin \'%s\'", plugin_name); return NULL; } py_func = PyObject_GetAttrString(py_module, py_callback); if (!py_func || !PyCallable_Check(py_func)) { - TfsError_fmt(NULL, + PyErr_Format(TRACECRUNCHER_ERROR, "Failed to import callback from \'%s\'", plugin_name); return NULL; @@ -2169,7 +2170,7 @@ PyObject *PyFtrace_trace_shell_process(PyObject *self, PyObject *args, pid = fork(); if (pid < 0) { - TfsError_setstr(instance, "Failed to fork"); + PyErr_SetString(TRACECRUNCHER_ERROR, "Failed to fork"); return NULL; } @@ -2215,7 +2216,8 @@ PyObject *PyFtrace_trace_process(PyObject *self, PyObject *args, return NULL; if (!PyList_CheckExact(py_argv)) { - TfsError_setstr(instance, "Failed to parse \'argv\' list"); + PyErr_SetString(TRACECRUNCHER_ERROR, + "Failed to parse \'argv\' list"); return NULL; } @@ -2223,7 +2225,7 @@ PyObject *PyFtrace_trace_process(PyObject *self, PyObject *args, pid = fork(); if (pid < 0) { - TfsError_setstr(instance, "Failed to fork"); + PyErr_SetString(TRACECRUNCHER_ERROR, "Failed to fork"); return NULL; }