extern void printaddr_ull(unsigned long long);
extern void printxvals(const uint64_t, const char *, const struct xlat *, ...)
ATTRIBUTE_SENTINEL;
+extern void printxval_searchn(const struct xlat *xlat, size_t xlat_size,
+ uint64_t val, const char *dflt);
+#define printxval_search(xlat__, val__, dflt__) \
+ printxval_searchn(xlat__, ARRAY_SIZE(xlat__), val__, dflt__)
extern long long getarg_ll(struct tcb *tcp, int argn);
extern unsigned long long getarg_ull(struct tcb *tcp, int argn);
extern int printargs(struct tcb *);
va_end(args);
}
+/*
+ * Print entry in sorted struct xlat table, if it is there.
+ */
+void
+printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
+ const char *dflt)
+{
+ const char *s = xlat_search(xlat, xlat_size, val);
+
+ if (s) {
+ tprints(s);
+ } else {
+ tprintf("%#" PRIx64, val);
+ if (dflt)
+ tprintf(" /* %s */", dflt);
+ }
+}
+
/*
* Fetch 64bit argument at position arg_no and
* return the index of the next argument.