Commit 11ed801d authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging



# gpg: Signature made Mon 29 Jan 2018 15:49:05 GMT
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/tracing-pull-request:
  tracetool: report error on foo() instead of foo(void)
  tracetool: clarify that "formats" means "format strings"
  tracetool: prefix parse errors with line numbers

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 30d9fefe 24f4d3d3
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ class Arguments:
        res = []
        for arg in arg_str.split(","):
            arg = arg.strip()
            if not arg:
                raise ValueError("Empty argument (did you forget to use 'void'?)")
            if arg == 'void':
                continue

@@ -173,7 +175,7 @@ class Event(object):
        props : list of str
            Property names.
        fmt : str, list of str
            Event printing format (or formats).
            Event printing format string(s).
        args : Arguments
            Event arguments.
        orig : Event or None
@@ -237,9 +239,9 @@ class Event(object):
        if "tcg-exec" in props:
            raise ValueError("Invalid property 'tcg-exec'")
        if "tcg" not in props and not isinstance(fmt, str):
            raise ValueError("Only events with 'tcg' property can have two formats")
            raise ValueError("Only events with 'tcg' property can have two format strings")
        if "tcg" in props and isinstance(fmt, str):
            raise ValueError("Events with 'tcg' property must have two formats")
            raise ValueError("Events with 'tcg' property must have two format strings")

        event = Event(name, props, fmt, args)

@@ -263,7 +265,7 @@ class Event(object):
    _FMT = re.compile("(%[\d\.]*\w+|%.*PRI\S+)")

    def formats(self):
        """List of argument print formats."""
        """List conversion specifiers in the argument print format string."""
        assert not isinstance(self.fmt, list)
        return self._FMT.findall(self.fmt)

@@ -300,13 +302,18 @@ def read_events(fobj):
    """

    events = []
    for line in fobj:
    for lineno, line in enumerate(fobj, 1):
        if not line.strip():
            continue
        if line.lstrip().startswith('#'):
            continue

        try:
            event = Event.build(line)
        except ValueError as e:
            arg0 = 'Error on line %d: %s' % (lineno, e.args[0])
            e.args = (arg0,) + e.args[1:]
            raise

        # transform TCG-enabled events
        if "tcg" not in event.properties: