--- qemu/scripts/tracetool 2018/04/24 19:04:28 1.1.1.2 +++ qemu/scripts/tracetool 2018/04/24 19:33:07 1.1.1.3 @@ -40,10 +40,38 @@ EOF exit 1 } +# Print a line without interpreting backslash escapes +# +# The built-in echo command may interpret backslash escapes without an option +# to disable this behavior. +puts() +{ + printf "%s\n" "$1" +} + # Get the name of a trace event get_name() { - echo ${1%%\(*} + local name + name=${1%%\(*} + echo "${name##* }" +} + +# Get the given property of a trace event +# 1: trace-events line +# 2: property name +# -> return 0 if property is present, or 1 otherwise +has_property() +{ + local props prop + props=${1%%\(*} + props=${props% *} + for prop in $props; do + if [ "$prop" = "$2" ]; then + return 0 + fi + done + return 1 } # Get the argument list of a trace event, including types and names @@ -92,27 +120,10 @@ get_argc() echo $argc } -# Get the format string for a trace event +# Get the format string including double quotes for a trace event get_fmt() { - local fmt - fmt=${1#*\"} - fmt=${fmt%\"*} - echo "$fmt" -} - -# Get the state of a trace event -get_state() -{ - local str disable state - str=$(get_name "$1") - disable=${str##disable } - if [ "$disable" = "$str" ] ; then - state=1 - else - state=0 - fi - echo "$state" + puts "${1#*)}" } linetoh_begin_nop() @@ -158,7 +169,7 @@ linetoc_end_nop() linetoh_begin_simple() { cat < +#include "trace/stderr.h" + +extern TraceEvent trace_list[]; EOF + + stderr_event_num=0 } linetoh_stderr() @@ -263,29 +271,47 @@ linetoh_stderr() cat <