flow: The type of vni in VxLAN flow should be u32
[vpp.git] / src / vnet / unix / gdb_funcs.c
index 6f0dd20..797cb0e 100644 (file)
@@ -37,6 +37,21 @@ vl (void *p)
   return vec_len (p);
 }
 
+/**
+ * @brief GDB callable function: pvh - Return vector header of vector
+ *
+ * @param *p - void - address of vector
+ *
+ * @return vh - vec_header_t, the vector header
+ *
+ */
+vec_header_t *
+pvh (void *p)
+{
+  return _vec_find (p);
+}
+
+
 /**
  * @brief GDB callable function: pe - call pool_elts - number of elements in a pool
  *
@@ -51,6 +66,20 @@ pe (void *v)
   return (pool_elts (v));
 }
 
+/**
+ * @brief GDB callable function: ph - call pool_header - get pool header.
+ *
+ * @param *p - void - address of pool
+ *
+ * @return pool_header_t
+ *
+ */
+pool_header_t *
+ph (void *p)
+{
+  return pool_header (p);
+}
+
 /**
  * @brief GDB callable function: pifi - call pool_is_free_index - is passed index free?
  *
@@ -209,50 +238,50 @@ gdb_show_traces ()
 
   /* Get active traces from pool. */
 
-  /* *INDENT-OFF* */
-  foreach_vlib_main (
-  ({
-    fmt = "------------------- Start of thread %d %s -------------------\n";
-    s = format (s, fmt, index, vlib_worker_threads[index].name);
-
-    tm = &this_vlib_main->trace_main;
-
-    trace_apply_filter(this_vlib_main);
-
-    traces = 0;
-    pool_foreach (h, tm->trace_buffer_pool,
-    ({
-      vec_add1 (traces, h[0]);
-    }));
-
-    if (vec_len (traces) == 0)
-      {
-        s = format (s, "No packets in trace buffer\n");
-        goto done;
-      }
-
-    /* Sort them by increasing time. */
-    vec_sort_with_function (traces, trace_cmp);
-
-    for (i = 0; i < vec_len (traces); i++)
-      {
-        if (i == max)
-          {
-            fformat (stderr, "Limiting display to %d packets."
-                                 " To display more specify max.", max);
-            goto done;
-          }
-
-        s = format (s, "Packet %d\n%U\n\n", i + 1,
-                         format_vlib_trace, vlib_mains[0], traces[i]);
-      }
-
-  done:
-    vec_free (traces);
-
-    index++;
-  }));
-  /* *INDENT-ON* */
+  foreach_vlib_main ()
+    {
+      fmt = "------------------- Start of thread %d %s -------------------\n";
+      s = format (s, fmt, index, vlib_worker_threads[index].name);
+
+      tm = &this_vlib_main->trace_main;
+
+      trace_apply_filter (this_vlib_main);
+
+      traces = 0;
+      pool_foreach (h, tm->trace_buffer_pool)
+       {
+         vec_add1 (traces, h[0]);
+       }
+
+      if (vec_len (traces) == 0)
+       {
+         s = format (s, "No packets in trace buffer\n");
+         goto done;
+       }
+
+      /* Sort them by increasing time. */
+      vec_sort_with_function (traces, trace_cmp);
+
+      for (i = 0; i < vec_len (traces); i++)
+       {
+         if (i == max)
+           {
+             fformat (stderr,
+                      "Limiting display to %d packets."
+                      " To display more specify max.",
+                      max);
+             goto done;
+           }
+
+         s = format (s, "Packet %d\n%U\n\n", i + 1, format_vlib_trace,
+                     vlib_get_first_main (), traces[i]);
+       }
+
+    done:
+      vec_free (traces);
+
+      index++;
+    }
 
   fformat (stderr, "%v", s);
   vec_free (s);
@@ -273,7 +302,10 @@ show_gdb_command_fn (vlib_main_t * vm,
   vlib_cli_output (vm, "vb(b) returns vnet_buffer(b) [opaque]");
   vlib_cli_output (vm, "vb2(b) returns vnet_buffer2(b) [opaque2]");
   vlib_cli_output (vm, "vbi(b) returns b index");
+  vlib_cli_output (vm,
+                  "vgb(bi) returns vlib_get_buffer(vlib_get_main(), bi)");
   vlib_cli_output (vm, "pe(p) returns pool_elts(p)");
+  vlib_cli_output (vm, "ph(p) returns pool_header(p)");
   vlib_cli_output (vm, "pifi(p, i) returns pool_is_free_index(p, i)");
   vlib_cli_output (vm, "gdb_show_errors(0|1) dumps error counters");
   vlib_cli_output (vm, "gdb_show_session dumps session counters");
@@ -294,6 +326,12 @@ VLIB_CLI_COMMAND (show_gdb_funcs_command, static) = {
 };
 /* *INDENT-ON* */
 
+vlib_buffer_t *
+vgb (u32 bi)
+{
+  return vlib_get_buffer (vlib_get_main (), bi);
+}
+
 vnet_buffer_opaque_t *
 vb (void *vb_arg)
 {