summary refs log tree commit diff stats
path: root/scripts/tracetool/format/log_stap.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-02-01 16:28:00 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-02-01 16:28:00 +0000
commitcf7ca7d5b9faca13f1f8e3ea92cfb2f741eb0c0e (patch)
tree8ad159f55a3d842a3051a9a55ab01e90e3741af5 /scripts/tracetool/format/log_stap.py
parent74208cd252c5da9d867270a178799abd802b9338 (diff)
parent0dfb3ca73c54fc105ab78e37e31ab05bed1360aa (diff)
downloadfocaccia-qemu-cf7ca7d5b9faca13f1f8e3ea92cfb2f741eb0c0e.tar.gz
focaccia-qemu-cf7ca7d5b9faca13f1f8e3ea92cfb2f741eb0c0e.zip
Merge remote-tracking branch 'remotes/stefanha-gitlab/tags/tracing-pull-request' into staging
Pull request

# gpg: Signature made Mon 01 Feb 2021 15:46:52 GMT
# gpg:                using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha-gitlab/tags/tracing-pull-request:
  trace: update docs with meson build information
  trace: document how to specify multiple --trace patterns
  simpletrace: build() missing 2 required positional arguments
  trace: make the 'log' backend timestamp configurable
  error: rename error_with_timestamp to message_with_timestamp
  trace: add meson custom_target() depend_files for tracetool
  tracetool: also strip %l and %ll from systemtap format strings
  tracetool: fix "PRI" macro decoding
  trace: recommend "log" backend for getting started with tracing
  tracing: convert documentation to rST
  trace: fix simpletrace doc mismerge

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'scripts/tracetool/format/log_stap.py')
-rw-r--r--scripts/tracetool/format/log_stap.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/tracetool/format/log_stap.py b/scripts/tracetool/format/log_stap.py
index b486beb672..0b6549d534 100644
--- a/scripts/tracetool/format/log_stap.py
+++ b/scripts/tracetool/format/log_stap.py
@@ -54,6 +54,7 @@ def c_fmt_to_stap(fmt):
             else:
                 if state == STATE_MACRO:
                     bits.append(c_macro_to_format(macro))
+                    macro = ""
                 state = STATE_LITERAL
         elif fmt[i] == ' ' or fmt[i] == '\t':
             if state == STATE_MACRO:
@@ -77,7 +78,12 @@ def c_fmt_to_stap(fmt):
     elif state == STATE_LITERAL:
         bits.append(literal)
 
-    fmt = re.sub("%(\d*)z(x|u|d)", "%\\1\\2", "".join(bits))
+    # All variables in systemtap are 64-bit in size
+    # The "%l" integer size qualifier is thus redundant
+    # and "%ll" is not valid at all. Similarly the size_t
+    # based "%z" size qualifier is not valid. We just
+    # strip all size qualifiers for sanity.
+    fmt = re.sub("%(\d*)(l+|z)(x|u|d)", "%\\1\\3", "".join(bits))
     return fmt
 
 def generate(events, backend, group):