Skip to content

Instantly share code, notes, and snippets.

@LarryRuane
Last active July 9, 2021 21:23
Show Gist options
  • Save LarryRuane/04e90bd233ef75e7b477e0e47111d6ce to your computer and use it in GitHub Desktop.
Save LarryRuane/04e90bd233ef75e7b477e0e47111d6ce to your computer and use it in GitHub Desktop.
zcash debugging tips and tricks

debugging cheat sheet

recommended ~/.gdbinit settings

set print pretty
set height 0
set print elements unlimited
set history save on

set history save on appends your typed commands into .gdb_history on exit, set logging on appends gdb output into gdb.txt as you go. Enable runtime debug checking (-O0 when PR 4754 merges)

make clean
CONFIGURE_FLAGS=--enable-debug zcutil/build.sh -j8

Until 4754 merges, manually edit src/Makefile, change O1, O2, O3 to O0. If you're interested in a particular source file, touch src/init.cpp; make. Add calls to LogPrintf("@@@ ...\n"); or std::cout << "@@@ " << variable << '\n';

Quite a few classes have a ToString() method, look for examples like uint256 for hashes

python functional tests (qa/rpc-tests):

import pdb; pdb.set_trace() # to set a debugger breakpoint in functional (python) test
import pprint; pp = pprint.PrettyPrinter(indent=4); pp.pprint(var) # dictionaries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment