aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen_trace_header.awk37
1 files changed, 28 insertions, 9 deletions
diff --git a/scripts/gen_trace_header.awk b/scripts/gen_trace_header.awk
index 6b99966..75f4f02 100644
--- a/scripts/gen_trace_header.awk
+++ b/scripts/gen_trace_header.awk
@@ -1,28 +1,47 @@
BEGIN {
COUNT = split(" " SYMBOLS_LIST, SYMBOLS);
+
+ if (MODE == "gen") {
+ for (x in SYMBOLS) {
+ s = SYMBOLS[x]
+ print "SB_" s " = SYS_" s
+ }
+ exit(0);
+ }
}
+function out(name, val)
{
- if ($1 != "#define" || $2 !~ /^SYS_/)
+ name = toupper(name)
+ print "#define SB_SYS" syscall_prefix "_" name " " val;
+ print "S(" name ")";
+}
+
+{
+ # found: SB_func = #
+ # not found: SB_func = SYS_func
+ if ($1 !~ /^SB_/)
+ next;
+ if ($3 ~ /^SYS_/)
next;
- sub(/^SYS_/, "", $2);
+ sub(/^SB_/, "", $1);
for (i = 1; i <= COUNT; ++i)
- if (SYMBOLS[i] == $2) {
+ if (SYMBOLS[i] == $1) {
SYMBOLS[i] = "";
break;
}
- print "S(" $2 ")";
+ out($1, $3);
}
END {
- for (x in SYMBOLS) {
- s = SYMBOLS[x];
- if (s != "") {
- print "#define SYS_" s " SB_NR_UNDEF";
- print "S(" s ")";
+ if (MODE != "gen") {
+ for (x in SYMBOLS) {
+ s = SYMBOLS[x];
+ if (s != "")
+ out(s, "SB_NR_UNDEF");
}
}
}