vlib: fix gdb_show_traces()
When using gdb_show_traces() in debug mode, don't assert if workers are not parked, as it is typically called from gdb. Type: fix Change-Id: Iabf175d96dc152da4d1abfbce9ccc9020d0b5d61 Signed-off-by: Benoît Ganne <bganne@cisco.com>
This commit is contained in:
parent
282f2ecd8e
commit
fa500e9854
@ -200,7 +200,7 @@ vlib_smp_unsafe_warning (void)
|
||||
}
|
||||
|
||||
always_inline int
|
||||
__foreach_vlib_main_helper (vlib_main_t *ii, vlib_main_t **p)
|
||||
__foreach_vlib_main_helper (vlib_main_t *ii, vlib_main_t **p, int checks)
|
||||
{
|
||||
vlib_main_t *vm;
|
||||
u32 index = ii - (vlib_main_t *) 0;
|
||||
@ -209,15 +209,17 @@ __foreach_vlib_main_helper (vlib_main_t *ii, vlib_main_t **p)
|
||||
return 0;
|
||||
|
||||
*p = vm = vlib_global_main.vlib_mains[index];
|
||||
ASSERT (index == 0 || vm->parked_at_barrier == 1);
|
||||
ASSERT (!checks || index == 0 || vm->parked_at_barrier == 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define foreach_vlib_main() \
|
||||
#define foreach_vlib_main__(checks) \
|
||||
for (vlib_main_t *ii = 0, *this_vlib_main; \
|
||||
__foreach_vlib_main_helper (ii, &this_vlib_main); ii++) \
|
||||
__foreach_vlib_main_helper (ii, &this_vlib_main, checks); ii++) \
|
||||
if (this_vlib_main)
|
||||
|
||||
#define foreach_vlib_main() foreach_vlib_main__ (1)
|
||||
|
||||
#define foreach_sched_policy_posix \
|
||||
_ (SCHED_OTHER, OTHER, "other") \
|
||||
_ (SCHED_FIFO, FIFO, "fifo") \
|
||||
|
@ -238,44 +238,44 @@ gdb_show_traces ()
|
||||
|
||||
/* Get active traces from pool. */
|
||||
|
||||
foreach_vlib_main ()
|
||||
{
|
||||
fmt = "------------------- Start of thread %d %s -------------------\n";
|
||||
s = format (s, fmt, index, vlib_worker_threads[index].name);
|
||||
foreach_vlib_main__ (0 /* no checks */)
|
||||
{
|
||||
fmt = "------------------- Start of thread %d %s -------------------\n";
|
||||
s = format (s, fmt, index, vlib_worker_threads[index].name);
|
||||
|
||||
tm = &this_vlib_main->trace_main;
|
||||
tm = &this_vlib_main->trace_main;
|
||||
|
||||
trace_apply_filter (this_vlib_main);
|
||||
trace_apply_filter (this_vlib_main);
|
||||
|
||||
traces = 0;
|
||||
pool_foreach (h, tm->trace_buffer_pool)
|
||||
{
|
||||
vec_add1 (traces, h[0]);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
/* 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;
|
||||
}
|
||||
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]);
|
||||
}
|
||||
s = format (s, "Packet %d\n%U\n\n", i + 1, format_vlib_trace,
|
||||
vlib_get_first_main (), traces[i]);
|
||||
}
|
||||
|
||||
done:
|
||||
vec_free (traces);
|
||||
|
Loading…
x
Reference in New Issue
Block a user