summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLluís Vilanova <vilanova@ac.upc.edu>2016-02-25 17:43:04 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:46:50 -0600
commit7a9fa42daa138ec954a19558dcf7c9e90698a023 (patch)
tree83bc2cc512cb83ddf317af9cbfbe59b8fb4db22d /scripts
parent92fa45f087d08de65ddc42c2b535fd81f207c5cf (diff)
downloadhqemu-7a9fa42daa138ec954a19558dcf7c9e90698a023.zip
hqemu-7a9fa42daa138ec954a19558dcf7c9e90698a023.tar.gz
trace: Extend API to manage event arguments
Lets the user manage event arguments as a list, and simplifies argument concatenation. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 145641858432.30295.3069911069472672646.stgit@localhost Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/tracetool/__init__.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 181675f..0663e7f 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -50,9 +50,14 @@ class Arguments:
Parameters
----------
args :
- List of (type, name) tuples.
+ List of (type, name) tuples or Arguments objects.
"""
- self._args = args
+ self._args = []
+ for arg in args:
+ if isinstance(arg, Arguments):
+ self._args.extend(arg._args)
+ else:
+ self._args.append(arg)
def copy(self):
"""Create a new copy."""
@@ -83,6 +88,12 @@ class Arguments:
res.append((arg_type, identifier))
return Arguments(res)
+ def __getitem__(self, index):
+ if isinstance(index, slice):
+ return Arguments(self._args[index])
+ else:
+ return self._args[index]
+
def __iter__(self):
"""Iterate over the (type, name) pairs."""
return iter(self._args)
OpenPOWER on IntegriCloud