X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fvnet%2Funix%2Fgdb_funcs.c;h=40d0d66347279d8d6169ceb62213495df525112a;hb=ad0c77f163472e0715c167aec59a26bcd34d649b;hp=cfb4b24780087fea4e1cf3219587244200520b2d;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/unix/gdb_funcs.c b/src/vnet/unix/gdb_funcs.c index cfb4b247800..40d0d663472 100644 --- a/src/vnet/unix/gdb_funcs.c +++ b/src/vnet/unix/gdb_funcs.c @@ -20,8 +20,8 @@ #include #include - - +#include +#include /** * @brief GDB callable function: vl - Return vector length of vector @@ -135,6 +135,47 @@ void vlib_runtime_index_to_node_name (u32 index) fformat(stderr, "node runtime index %d name %s\n", index, nm->nodes[index]->name); } +void gdb_show_errors (int verbose) +{ + extern vlib_cli_command_t vlib_cli_show_errors; + unformat_input_t input; + vlib_main_t * vm = vlib_get_main(); + + if (verbose == 0) + unformat_init_string (&input, "verbose 0", 9); + else if (verbose == 1) + unformat_init_string (&input, "verbose 1", 9); + else + { + fformat(stderr, "verbose not 0 or 1\n"); + return; + } + + vlib_cli_show_errors.function (vm, &input, 0 /* cmd */); + unformat_free (&input); +} + +void gdb_show_session (int verbose) +{ + extern vlib_cli_command_t vlib_cli_show_session_command; + unformat_input_t input; + vlib_main_t * vm = vlib_get_main(); + + if (verbose == 0) + unformat_init_string (&input, "verbose 0", 9); + else if (verbose == 1) + unformat_init_string (&input, "verbose 1", 9); + else if (verbose == 2) + unformat_init_string (&input, "verbose 2", 9); + else + { + fformat(stderr, "verbose not 0 - 2\n"); + return; + } + + vlib_cli_show_session_command.function (vm, &input, 0 /* cmd */); + unformat_free (&input); +} /** * @brief GDB callable function: show_gdb_command_fn - show gdb @@ -149,8 +190,12 @@ show_gdb_command_fn (vlib_main_t * vm, vlib_cli_command_t * cmd) { vlib_cli_output (vm, "vl(p) returns vec_len(p)"); + 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, "pe(p) returns pool_elts(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"); vlib_cli_output (vm, "debug_hex_bytes (ptr, n_bytes) dumps n_bytes in hex"); vlib_cli_output (vm, "vlib_dump_frame_ownership() does what it says"); vlib_cli_output (vm, "vlib_runtime_index_to_node_name (index) prints NN"); @@ -164,6 +209,27 @@ VLIB_CLI_COMMAND (show_gdb_funcs_command, static) = { .function = show_gdb_command_fn, }; +vnet_buffer_opaque_t *vb (void *vb_arg) +{ + vlib_buffer_t *b = (vlib_buffer_t *)vb_arg; + vnet_buffer_opaque_t *rv; + + rv = vnet_buffer (b); + + return rv; +} + +vnet_buffer_opaque2_t *vb2 (void *vb_arg) +{ + vlib_buffer_t *b = (vlib_buffer_t *)vb_arg; + vnet_buffer_opaque2_t *rv; + + rv = vnet_buffer2(b); + + return rv; +} + + /* Cafeteria plan, maybe you don't want these functions */ clib_error_t * gdb_func_init (vlib_main_t * vm) { return 0; }