diff options
author | Damjan Marion <damarion@cisco.com> | 2021-03-26 11:38:01 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2021-03-26 16:35:22 +0100 |
commit | 92ccf9bcd2692b4b415f31044560c735d639a35c (patch) | |
tree | f5308e25329d6853921b7ea4a74d5c3b6f149b25 /src/vnet/unix | |
parent | fd8deb48c7ad63b47c5d7465ceefcadef0316f93 (diff) |
vlib: convert foreach_vlib_main macro to be more gdb and clang-format friendly
Type: improvement
Change-Id: I1152e58d7bfcb3c4347147f87a834d45ad51cdfe
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/unix')
-rw-r--r-- | src/vnet/unix/gdb_funcs.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/vnet/unix/gdb_funcs.c b/src/vnet/unix/gdb_funcs.c index ce8db3a8ae3..797cb0eb7d1 100644 --- a/src/vnet/unix/gdb_funcs.c +++ b/src/vnet/unix/gdb_funcs.c @@ -238,51 +238,51 @@ 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]); + 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++; } - 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++; - })); - /* *INDENT-ON* */ - fformat (stderr, "%v", s); vec_free (s); } |