tep_parse_event() API from traceevent library fails with bad op token { error when parsing print fmt string containing '{' character in unexpected places. There are such format strings in xhci_urb_dequeue, xhci_urb_enqueue, xhci_urb_giveback events from xhci-hcd system: cat events/xhci-hcd/xhci_urb_dequeue/format [...] print fmt: "ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x", REC->epnum, REC->dir_in ? "in" : "out", ({ char *s; switch (REC->type) { case 3: s = "intr"; break; case 0: s = "control"; break; case 2: s = "bulk"; break; case 1: s = "isoc"; break; default: s = "UNKNOWN"; } s; }), REC->urb, REC->pipe, REC->slot_id, REC->actual, REC->length, REC->num_mapped_sgs, REC->num_sgs, REC->stream, REC->flags trace-cmd check-events [...] [xhci-hcd:xhci_urb_enqueue] bad op token { [xhci-hcd:xhci_urb_giveback] bad op token { [xhci-hcd:xhci_urb_dequeue] bad op token { trace-cmd version 2.9.dev (e8fb01140eb2800f9ef419a0f8e5bfeb51292c55+)
This is a kernel fix, and it looks like they did so. The parser is not suppose to be able to parse switch statements. That's what __process_symbols() helper was made for. print fmt: "ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x", REC->epnum, REC->dir_in ? "in" : "out", __print_symbolic(REC->type, { 3, "intr" }, { 0, "control" }, { 2, "bulk" }, { 1, "isoc" }), REC->urb, REC->pipe, REC->slot_id, REC->actual, REC->length, REC->num_mapped_sgs, REC->num_sgs, REC->stream, REC->flags