From: Ethan Jackson Date: Fri, 12 Aug 2011 21:10:15 +0000 (-0700) Subject: ofproto-dpif: Print register values in trace. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb9e1c2613587b9b08ca849b6af5ccae2b2d9227;p=openvswitch ofproto-dpif: Print register values in trace. I found this patch useful in tracking down a bug recently. --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index fdef4afa..a6e1782e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4018,6 +4018,20 @@ trace_format_flow(struct ds *result, int level, const char *title, ds_put_char(result, '\n'); } +static void +trace_format_regs(struct ds *result, int level, const char *title, + struct ofproto_trace *trace) +{ + size_t i; + + ds_put_char_multiple(result, '\t', level); + ds_put_format(result, "%s:", title); + for (i = 0; i < FLOW_N_REGS; i++) { + ds_put_format(result, " reg%zu=0x%"PRIx32, i, trace->flow.regs[i]); + } + ds_put_char(result, '\n'); +} + static void trace_resubmit(struct action_xlate_ctx *ctx, struct rule_dpif *rule) { @@ -4026,6 +4040,7 @@ trace_resubmit(struct action_xlate_ctx *ctx, struct rule_dpif *rule) ds_put_char(result, '\n'); trace_format_flow(result, ctx->recurse + 1, "Resubmitted flow", trace); + trace_format_regs(result, ctx->recurse + 1, "Resubmitted regs", trace); trace_format_rule(result, ctx->table_id, ctx->recurse + 1, rule); }