# TODOs: # figure out how to add the information about the death signal to stacks.isc # optional features? # dlz, sdb, dbus # other binaries besides named? # *-confgen, dnssec-*, nsupdate, named-journalprint, rndc, named-check*, check-tool, dig # isc_dump_adbs (using view.adb) # isc_dump_caches (using view.cache and view.acache?) # isc_dump_events (using ?) # ./lib/isc/task.c: event = isc_event_allocate(task->manager->mctx, # ./lib/isc/timer.c: event = (isc_timerevent_t *)isc_event_allocate(manager->mctx, # ./lib/isc/win32/app.c: event = isc_event_allocate(mctx, cloned_task, ISC_APPEVENT_SHUTDOWN, # ./lib/isc/win32/socket.c: ev = (isc_socketevent_t *)isc_event_allocate(sock->manager->mctx, # ./lib/isc/win32/socket.c: isc_event_allocate(manager->mctx, task, ISC_SOCKEVENT_NEWCONN, # ./lib/isc/win32/socket.c: cdev = (isc_socket_connev_t *)isc_event_allocate(manager->mctx, sock, # ./lib/isc/unix/app.c: event = isc_event_allocate(mctx, cloned_task, ISC_APPEVENT_SHUTDOWN, # ./lib/isc/unix/socket.c: ev = (isc_socketevent_t *)isc_event_allocate(sock->manager->mctx, # ./lib/isc/unix/socket.c: isc_event_allocate(manager->mctx, task, ISC_SOCKEVENT_NEWCONN, # ./lib/isc/unix/socket.c: dev = (isc_socket_connev_t *)isc_event_allocate(manager->mctx, sock, # ./lib/dns/cache.c: isc_event_allocate(cache->mctx, cleaner, # ./lib/dns/cache.c: isc_event_allocate(cache->mctx, cleaner, # ./lib/dns/lookup.c: ievent = isc_event_allocate(mctx, lookup, DNS_EVENT_LOOKUPDONE, # ./lib/dns/client.c: isc_event_allocate(mctx, clone, DNS_EVENT_CLIENTRESDONE, # ./lib/dns/client.c: isc_event_allocate(client->mctx, clone, # ./lib/dns/client.c: isc_event_allocate(client->mctx, clone, DNS_EVENT_UPDATEDONE, # ./lib/dns/acache.c: isc_event_allocate(acache->mctx, cleaner, # ./lib/dns/acache.c: isc_event_allocate(acache->mctx, cleaner, # ./lib/dns/request.c: isc_event_allocate(mctx, task, DNS_EVENT_REQUESTDONE, # ./lib/dns/request.c: isc_event_allocate(mctx, task, DNS_EVENT_REQUESTDONE, # ./lib/dns/rbtdb.c: event = isc_event_allocate(rbtdb->common.mctx, # ./lib/dns/rbtdb.c: ev = isc_event_allocate(rbtdb->common.mctx, NULL, # ./lib/dns/rbtdb.c: event = isc_event_allocate(rbtdb->common.mctx, NULL, # ./lib/dns/dispatch.c: disp->ctlevent = isc_event_allocate(mgr->mctx, disp, # ./lib/dns/dispatch.c: disp->ctlevent = isc_event_allocate(mgr->mctx, disp, # ./lib/dns/dispatch.c: isc_event_allocate(disp->mgr->mctx, NULL, # ./lib/dns/validator.c: isc_event_allocate(view->mctx, task, # ./lib/dns/zone.c: isc_event_t *e = isc_event_allocate(zone->mctx, NULL, # ./lib/dns/zone.c: e = isc_event_allocate(notify->mctx, NULL, # ./lib/dns/zone.c: e = isc_event_allocate(zone->mctx, NULL, DNS_EVENT_ZONE, # ./lib/dns/zone.c: e = isc_event_allocate(zmgr->mctx, zmgr, # ./lib/dns/zone.c: io->event = isc_event_allocate(zmgr->mctx, task, DNS_EVENT_IOREADY, # ./lib/dns/master.c: event = isc_event_allocate(lctx->mctx, NULL, # ./lib/dns/resolver.c: isc_event_allocate(fctx->res->mctx, clone, DNS_EVENT_FETCHDONE, # ./lib/dns/masterdump.c: event = isc_event_allocate(dctx->mctx, NULL, DNS_EVENT_DUMPQUANTUM, # ./bin/named/server.c: isc_event_allocate(ns_g_mctx, server, # ./bin/named/client.c: isc_event_allocate(client->mctx, client, # ./bin/named/client.c: isc_event_allocate(client->mctx, client, # ./bin/named/update.c: isc_event_allocate(client->mctx, client, DNS_EVENT_UPDATE, # ./bin/named/update.c: isc_event_allocate(client->mctx, client, DNS_EVENT_UPDATE, # isc_dump_mems (using ?) # ./lib/dns/client.c: result = isc_mem_create(0, 0, &mctx); # ./lib/dns/lib.c: result = isc_mem_create(0, 0, &dns_g_mctx); # ./lib/dns/name.c: result = isc_mem_create2(0, 0, &thread_key_mctx, 0); # ./lib/dns/view.c: result = isc_mem_create(0, 0, &mctx); # ./lib/dns/resolver.c: result = isc_mem_create(0, 0, &res->buckets[i].mctx); # ./lib/dns/dst_api.c: result = isc_mem_createx2(0, 0, default_memalloc, default_memfree, # ./bin/named/server.c: CHECK(isc_mem_create(0, 0, &cmctx)); # ./bin/named/server.c: CHECK(isc_mem_create(0, 0, &cmctx)); # ./bin/named/server.c: CHECK(isc_mem_create(0, 0, &hmctx)); # ./bin/named/client.c: result = isc_mem_create(0, 0, mctxp); # ./bin/named/client.c: result = isc_mem_create(0, 0, &clientmctx); # ./bin/named/main.c: result = isc_mem_create(0, 0, &ns_g_mctx); # ./bin/named/main.c: ns_main_earlyfatal("isc_mem_create() failed: %s", # isc_dump_threads (using ?) # ./lib/isc/task.c: if (isc_thread_create(run, manager, # ./lib/isc/timer.c: if (isc_thread_create(run, manager, &manager->thread) != # ./lib/isc/timer.c: "isc_thread_create() %s", # ./lib/isc/unix/socket.c: if (isc_thread_create(watcher, manager, &manager->watcher) != # ./lib/isc/unix/socket.c: "isc_thread_create() %s", # isc_dump_config (using ?) # isc_dump_everything # verify that I have all of the types already implemented # more flexible logging # rndc # stats* # dumpdb* # secroots # status # tsig-list define _dns_name_format set $__namebuf = "" set $__i = 0 while $arg0->ndata[$__i] != 0 set $__n = $arg0->ndata[$__i] set $__c = $__i while $__c < $__i + $__n set $__c = $__c + 1 printf "%c", $arg0->ndata[$__c] end printf "." set $__i = $__c + 1 end end document _dns_name_format _dns_name_format (dns_name_t *) parses the name out of the passed dns_name_t and printfs it with no preamble or trailing decorations (e.g. newlines). No type checking is done -- GIGO end define dns_name_format printf "name = '" _dns_name_format $arg0 printf "'\n" end document dns_name_format dns_name_format (dns_name_t *) wraps some text around _dns_name_format to make it suitable to call on its own (i.e. it adds a newline and a preamble) end define isc_dump_log_setup set logging overwrite on set logging redirect on set logging on end document isc_dump_log_setup isc_dump_log_setup Helper function for isc_dump_* family of functions. Turns on shared options, assumes the filename is set elsewhere. end define isc_dump_log_cleanup set logging off set logging redirect off set logging overwrite off end document isc_dump_log_cleanup isc_dump_log_cleanup Helper function for isc_dump_* family of functions. Stop logging and restore sending output to stdout end define isc_dump_clients set $this_interface = ns_g_server->interfacemgr->interfaces.head set logging file clients.isc isc_dump_log_setup print ns_g_server->interfacemgr while $this_interface != 0 print $this_interface->name print "active" set $this_client = $this_interface->clientmgr->active.head while $this_client != 0 print $this_client print *$this_client set $this_client = $this_client->link.next end print "recursing" set $this_client = $this_interface->clientmgr->recursing.head while $this_client != 0 print $this_client print *$this_client set $this_client = $this_client->rlink.next end print "inactive" set $this_client = $this_interface->clientmgr->inactive.head while $this_client != 0 print $this_client print *$this_client set $this_client = $this_client->ilink.next end print $this_client set $this_interface = $this_interface->link.next end print $this_interface isc_dump_log_cleanup end document isc_dump_clients isc_dump_clients Walks all of the clients linked to by ->active, ->recursing, and ->inactive of ->clientmgr of all of the interfaces linked to from ns_g_server->interfacemgr->interfaces and dumps them (in text) to clients.isc. end define isc_dump_dispatchers set $this_dispatcher = ns_g_dispatchmgr->list.head set logging file dispatchers.isc isc_dump_log_setup while $this_dispatcher != 0 print $this_dispatcher print *$this_dispatcher set $this_dispatcher = $this_dispatcher->link.next end print $this_dispatcher isc_dump_log_cleanup end document isc_dump_dispatchers isc_dump_dispatchers Walks all of the dispatchers linked to by ns_g_dispatcher and dumps them (in text) to dispatchers.isc. end define isc_dump_interfaces set $this_interface = ns_g_server->interfacemgr->interfaces.head set logging file interfaces.isc isc_dump_log_setup print ns_g_server->interfacemgr print *ns_g_server->interfacemgr while $this_interface != 0 print $this_interface print *$this_interface set $this_interface = $this_interface->link.next end print $this_interface isc_dump_log_cleanup end document isc_dump_interfaces isc_dump_interfaces Walks all of the interfaces linked to by ns_g_server->interfacemgr->interfaces and dumps them (in text) to interfaces.isc. end define isc_dump_resolvers set $this_view = ns_g_server->viewlist.head set logging file resolvers.isc isc_dump_log_setup while $this_view != 0 print $this_view->resolver print *$this_view->resolver set $this_view = $this_view->link.next end print $this_view isc_dump_log_cleanup end document isc_dump_resolvers isc_dump_resolvers Walks all of the resolvers linked to by ->resolver of all of the views linked to by ns_g_server->viewlist and dumps them (in text) to resolvers.isc. end define isc_dump_server set logging file server.isc isc_dump_log_setup print ns_g_server print *ns_g_server print ns_g_server->nsstats print *ns_g_server->nsstats->counters@ns_g_server->nsstats->ncounters print ns_g_server->rcvquerystats->counters print *ns_g_server->rcvquerystats->counters->counters@ns_g_server->rcvquerystats->counters->ncounters print ns_g_server->opcodestats print *ns_g_server->opcodestats->counters->counters@ns_g_server->opcodestats->counters->ncounters print ns_g_server->zonestats print *ns_g_server->zonestats->counters@ns_g_server->zonestats->ncounters print ns_g_server->resolverstats print *ns_g_server->resolverstats->counters@ns_g_server->resolverstats->ncounters print ns_g_server->sockstats print *ns_g_server->sockstats->counters@ns_g_server->sockstats->ncounters print (ns_server_t *)0 isc_dump_log_cleanup end document isc_dump_server isc_dump_server Dumps (in text) ns_g_server and the counters from ns_g_server->nsstats, ns_g_server->rcvquerystats->counters, ns_g_server->opcodestats->counters, ns_g_server->zonestats, ns_g_server->resolverstats, and ns_g_server->sockstats. end define isc_dump_sockets set $this_socket = ((isc__socketmgr_t *)ns_g_socketmgr)->socklist.head set logging file sockets.isc isc_dump_log_setup print ns_g_socketmgr print *(isc__socketmgr_t *)ns_g_socketmgr while $this_socket != 0 print $this_socket print *$this_socket set $this_socket = $this_socket->link.next end print $this_socket isc_dump_log_cleanup end document isc_dump_sockets isc_dump_sockets Walks all of the sockets linked to by ns_g_socketmgr and dumps them (in text) to sockets.isc. end define isc_dump_tasks set $this_task = ((isc__taskmgr_t *)ns_g_taskmgr)->tasks.head set logging file tasks.isc isc_dump_log_setup print ns_g_taskmgr print *(isc__taskmgr_t *)ns_g_taskmgr while $this_task != 0 print $this_task print *$this_task set $this_task = $this_task->link.next end print $this_task isc_dump_log_cleanup end document isc_dump_tasks isc_dump_tasks Walks all of the tasks linked to by ns_g_taskmgr and dumps them (in text) to tasks.isc. end define isc_dump_timers set $this_timer = ((isc__timermgr_t *)ns_g_timermgr)->timers.head set logging file timers.isc isc_dump_log_setup print ns_g_timermgr print *(isc__timermgr_t *)ns_g_timermgr while $this_timer != 0 print $this_timer print *$this_timer set $this_timer = $this_timer->link.next end print $this_timer isc_dump_log_cleanup end document isc_dump_timers isc_dump_timers Walks all of the timers linked to by ns_g_timermgr and dumps them (in text) to timers.isc. end define isc_dump_views set $this_view = ns_g_server->viewlist.head set logging file views.isc isc_dump_log_setup while $this_view != 0 print $this_view print *$this_view set $this_view = $this_view->link.next end print $this_view isc_dump_log_cleanup end document isc_dump_views isc_dump_views Walks all of the views linked to by ns_g_server->viewlist and dumps them (in text) to views.isc. end define isc_dump_zones set $this_zone = ns_g_server->zonemgr->zones.head set logging file zones.isc isc_dump_log_setup print ns_g_server->zonemgr print *ns_g_server->zonemgr while $this_zone != 0 print $this_zone print *$this_zone set $this_zone = $this_zone->link.next end print $this_zone isc_dump_log_cleanup end document isc_dump_zones isc_dump_zones Walks all of the zones linked to by ns_g_server->zonemgr->zones and dumps them (in text) to zones.isc. end define isc_dump_normal_things isc_dump_stacks isc_dump_clients isc_dump_dispatchers isc_dump_interfaces isc_dump_resolvers isc_dump_server isc_dump_sockets isc_dump_tasks isc_dump_timers isc_dump_views isc_dump_zones end document isc_dump_normal_things isc_dump_normal_things Calls (in order) isc_dump_stacks, isc_dump_clients, isc_dump_dispatchers, isc_dump_interfaces, isc_dump_resolvers, isc_dump_server, isc_dump_sockets, isc_dump_tasks, isc_dump_timers, isc_dump_views, and isc_dump_zones. end define isc_dump_stacks set logging file stacks.isc isc_dump_log_setup info threads thread apply all where full isc_dump_log_cleanup end document isc_dump_stacks isc_dump_stacks Writes a full backtrace of all threads, including local variables, to stacks.isc. end define rndc_recursing set $this_interface = ns_g_server->interfacemgr->interfaces.head if $arg0 set logging file named.gdb.recursing isc_dump_log_setup end while $this_interface != 0 set $this_client = $this_interface->clientmgr->recursing.head while $this_client != 0 printf "; client " if $this_client->peeraddr_valid set $this_af = $this_client->peeraddr.type.sa.sa_family # hopefully the AF_* constants are portable... if $this_af == 2 # IPv4, probably most common set $this_t = (unsigned char*)(&($this_client->peeraddr.type.sin.sin_addr)) # may have problems with endian printf "%d.%d.%d.%d#%u", $this_t[0], $this_t[1], $this_t[2], $this_t[3], $this_client->peeraddr.type.sin.sin_port else if $this_af == 10 # IPv6, probably next most common set $this_t = (unsigned char*)(&($this_client->peeraddr.type.sin6.sin6_addr)) # this may not be portable... printf "%x:%x:%x:%x:%x:%x:%x:%x", ($this_t[0] << 8 | $this_t[1]), ($this_t[2] << 8 | $this_t[3]), ($this_t[4] << 8 | $this_t[5]), ($this_t[6] << 8 | $this_t[7]), ($this_t[8] << 8 | $this_t[9]), ($this_t[10] << 8 | $this_t[11]), ($this_t[12] << 8 | $this_t[13]), ($this_t[14] << 8 | $this_t[15]), if sizeof($this_client->peeraddr.type.sin6) == 28 # we're guessing based on size printf "%%%u", $this_client->peeraddr.type.sin6.sin6_scope_id end # IPv6 zone goes here printf "#%u", $this_client->peeraddr.type.sin6.sin6_port else if $this_af == 1 # unix domain socket printf "%s", $this_client->peeraddr.type.sunix.sun_path else # unknown printf "(unknown af %d) %p", $this_af, $this_client end end end else printf "(!peeraddr_valid)%p", $this_client end printf ": view " if $this_client->view != 0 printf "%s", $this_client->view->name else printf "" end printf ": id %u '", $this_client->message->id if $this_client->query.qname != 0 && $this_client->query.qname->ndata != 0 _dns_name_format $this_client->query.qname else printf "" end set $this_rdata = $this_client->query.qname->list.head if $this_rdata == 0 && $this_client->query.origqname != 0 set $this_rdata = $this_client->query.origqname->list.head end if $this_rdata != 0 printf "/%d/%d'", $this_rdata->type, $this_rdata->rdclass else printf "/-/-'" end if $this_client->query.origqname != 0 && $this_client->query.origqname != $this_client->query.qname printf " for " _dns_name_format $this_client->query.origqname end printf " requesttime %d\n", $this_client->requesttime set $this_client = $this_client->rlink.next end set $this_interface = $this_interface->link.next end if $arg0 isc_dump_log_cleanup end end document rndc_recursing rndc_recursing to_file Dump the queries that are currently recursing in a format similar to that used by the 'rndc recursing' command. Dumps them to the file 'named.gdb.recursing' if 'to_file' is true, else to the screen. end # vim: filetype=gdb