1 # GDB macros for use with Quagga.
3 # Macros in this file are specific to ospfd/. Definitions here depend on the
4 # lib.txt macros file, which must also be loaed.
6 # The macro file can be loaded with 'source <filename>'. They can then be
7 # called by the user. Macros that explore more complicated structs generally
8 # take pointer arguments.
10 define dump_ospf_lsa_flags
42 define dump_ospf_lsa_data
43 set $lsad = (struct lsa_header *)$arg0
45 echo ID / AdvRtr: \t\t
46 dump_s_addr &$lsad->id.s_addr
48 dump_s_addr &$lsad->adv_router.s_addr
51 def_ntohs &$lsad->ls_age
52 printf "Type: %2u Age: %4u,", $lsad->type, $_
54 def_ntohs &$lsad->length
55 printf " length: %2u", $_
57 def_ntohl &$lsad->ls_seqnum
58 printf " Seqnum: 0x%08x", $_
60 def_ntohs &$lsad->checksum
61 printf " csum: 0x%04x\n", $_
64 def_ntohs &$lsad->ls_age
68 set $lsa = (struct ospf_lsa *)$arg0
72 dump_ospf_lsa_data $lsa->data
74 set $relage = $_ + (relative_time.tv_sec - $lsa->tv_recv.tv_sec)
75 printf "Relative age: %4u\n", $relage
77 dump_ospf_lsa_flags $lsa->flags
80 dump_timeval &$lsa->tv_recv
82 dump_timeval &$lsa->tv_orig
85 printf "lock %2u", $lsa->lock
86 printf " stat %2d", $lsa->stat
87 printf " rtx count: %u", $lsa->retransmit_counter
88 printf " rfsh list: %d", $lsa->refresh_list
93 set $node = (struct route_node *)$arg0
94 set $top = (struct route_node *)$arg0
100 if ($node->info != 0)
101 dump_ospf_lsa $node->info
102 set $visited = $visited + 1
105 walk_route_table_next $top $node
108 # we've gotten back to the top, finish
113 printf "Visited: %u\n", $visited
116 document walk_ospf_lsdb
117 Walk through an OSPF LSDB (or subset thereof) and dump all the LSAs
120 Argument: A (struct route_node *) pointing to the top of the
121 LSDB route-table which should be dumped.
124 define ospf_backbone_lsdb_top
127 set $ospf = ospf_master->ospf->head->data
129 output/x ((struct ospf *)$ospf)->backbone->lsdb->type[$type]->db->top
132 document ospf_backbone_lsdb_top
133 Dump location of the LSDB in the backbone area for the given LSA type
135 Argument: Integer LSA type