Stratus3D

A blog on software engineering by Trevor Brown

The Meaning of Dbg Function Names

If you’ve ever used the dbg module in Erlang you’ve seen the esoteric names of the functions it exports. I recently watched Jeffery Utter’s excellent ElixirConf talk on Debugging Live Systems on the BEAM. In the talk when he covers the dbg:tpl/3 function he guesses that it might stand for "tuple". This reminded me that I didn’t know what most of the functions names in the dbg module stood for, even though I learned how to use dbg years ago. This got me searching for the meanings behind the dbg function names.

Searching

First I did some Google searches hoping to find some StackOverflow answers or perhaps some old threads on the Erlang questions mailing list. The searches I tried turned up no results, so I looked at the Erlang Git repository and found earliest commit of the dbg.erl file. The commit message didn’t contain anything useful, and the comments in the module source code weren’t any more helpful than the ones present in the latest version of the code. I decided to try to figure out the meanings of the function names on my own.

After reading through the dbg API documentation it was clear to me that the function names were acronyms (except for the ones that aren’t like get_tracer/0 and stop/0). For example, p clearly stood for process. Some of the acrynoms were not so obvious. I wrote a list of what I thought each acronym meant and posted the list on the erlang-questions mailing list. I got some good feedback, and Lucas Larsson confirmed my assumptions.

Meanings

Here is a complete list of dbg function name acronyms.

Function Name Meaning

c/3,4

call

cn/1

clear node

ctp/0,1,2,3

clear trace pattern

ctpe/1

clear trace pattern event

ctpg/0,1,2,3

clear trace pattern global

ctpl/0,1,2,3

clear trace pattern local

dtp/0,1

delete trace pattern

h/0,1

help

i/0

information

ln/0

list nodes

ltp/0

list trace patterns

n/1

node

p/1

process

rtp/1

read trace pattern

tp/2,3,4

trace pattern

tpe/2

trace pattern event

tpl/2,3,4

trace pattern local

wtp/1

write trace pattern

Conclusion

I find this list of definitions makes it much easier for me to remember the function names. It’s easier for me to remember "clear trace patterns for local function calls" that it is for me to remember ctpl. After discussing this on the mailing list I opened up a PR to add this information to the documentation. Hopefully this info will make the dbg API seem a little less esoteric to newcomers.