back to topotato report
topotato coverage report
Current view: top level - lib - debug.c (source / functions) Hit Total Coverage
Test: test_bgp_ecmp_enhe.py::BGP_Unnumbered_ECMP Lines: 11 19 57.9 %
Date: 2023-11-16 17:19:14 Functions: 2 6 33.3 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0-or-later
       2             : /*
       3             :  * Debugging utilities.
       4             :  * Copyright (C) 2018  Cumulus Networks, Inc.
       5             :  * Quentin Young
       6             :  */
       7             : #include <zebra.h>
       8             : #include "typesafe.h"
       9             : #include "debug.h"
      10             : #include "command.h"
      11             : 
      12             : static struct debug_cb_list_head cb_head;
      13             : 
      14           0 : DECLARE_LIST(debug_cb_list, struct debug_callbacks, item);
      15             : 
      16             : /* All code in this section should be reentrant and MT-safe */
      17             : 
      18           0 : DEFUN_NOSH(debug_all, debug_all_cmd, "[no] debug all",
      19             :            NO_STR DEBUG_STR "Toggle all debugging output\n")
      20             : {
      21           0 :         struct debug_callbacks *cb;
      22             : 
      23           0 :         bool set = !strmatch(argv[0]->text, "no");
      24           0 :         uint32_t mode = DEBUG_NODE2MODE(vty->node);
      25             : 
      26           0 :         frr_each (debug_cb_list, &cb_head, cb)
      27           0 :                 cb->debug_set_all(mode, set);
      28             : 
      29           0 :         return CMD_SUCCESS;
      30             : }
      31             : 
      32             : /* ------------------------------------------------------------------------- */
      33             : 
      34           4 : void debug_init(struct debug_callbacks *cb)
      35             : {
      36           4 :         static bool inited = false;
      37             : 
      38           4 :         if (!inited) {
      39           4 :                 inited = true;
      40           4 :                 debug_cb_list_init(&cb_head);
      41             :         }
      42             : 
      43           4 :         debug_cb_list_add_head(&cb_head, cb);
      44           4 : }
      45             : 
      46           4 : void debug_init_cli(void)
      47             : {
      48           4 :         install_element(ENABLE_NODE, &debug_all_cmd);
      49           4 :         install_element(CONFIG_NODE, &debug_all_cmd);
      50           4 : }

Generated by: LCOV version v1.16-topotato