qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v1 6/7] scripts/tracetool: don't barf validating TCG types


From: Alex Bennée
Subject: [PATCH v1 6/7] scripts/tracetool: don't barf validating TCG types
Date: Wed, 5 May 2021 10:22:58 +0100

TCG types will be transformed into the appropriate host types later on
in the tool. For example adding the following trace point:

  tcg goto_ptr(TCGv_ptr ptr) "", "ptr=%p"

would trigger:

  ValueError: Error at /home/alex/lsrc/qemu.git/./trace-events:149: Argument 
type 'TCGv_ptr' is not allowed. Only standard C types and fixed size integer 
types should be used. struct, union, and other complex pointer types should be 
declared as 'void *'

Rather than expand ALLOWED_TYPES just directly handle TCGv types in 
validate_type.

Fixes: 73ff061032 ("trace: only permit standard C types and fixed size integer 
types")
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Matheus Ferst <matheus.ferst@eldorado.org.br>
Message-Id: <20210406165307.5993-1-alex.bennee@linaro.org>

---
v2
  - do workaround directly in validate_type
---
 scripts/tracetool/__init__.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 5bc94d95cf..ce5fd23191 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -87,10 +87,9 @@ def out(*lines, **kwargs):
     "ssize_t",
     "uintptr_t",
     "ptrdiff_t",
-    # Magic substitution is done by tracetool
-    "TCGv",
 ]
 
+
 def validate_type(name):
     bits = name.split(" ")
     for bit in bits:
@@ -99,6 +98,10 @@ def validate_type(name):
             continue
         if bit == "const":
             continue
+        # Magic substitution of TCGv types will be done later
+        # using tracetool.transform.TCG_2_HOST
+        if bit.startswith("TCGv") and bit != "TCGv_vec":
+            continue
         if bit not in ALLOWED_TYPES:
             raise ValueError("Argument type '%s' is not allowed. "
                              "Only standard C types and fixed size integer "
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]