ofproto-dpif: Print register values in trace.
authorEthan Jackson <ethan@nicira.com>
Fri, 12 Aug 2011 21:10:15 +0000 (14:10 -0700)
committerEthan Jackson <ethan@nicira.com>
Fri, 12 Aug 2011 22:30:35 +0000 (15:30 -0700)
I found this patch useful in tracking down a bug recently.

ofproto/ofproto-dpif.c

index fdef4af..a6e1782 100644 (file)
@@ -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);
 }