Skip to content
Johannes Altmanninger edited this page Jul 8, 2022 · 4 revisions

C++ tooling setup

If you want to use Clang tools (e.g. clangd via kak-lsp) to hack on Kakoune's C++ sources. you'll need to create a compile_commands.json file so the Clang tool will use the correct build flags.

One solution is to wrap your make invocations with bear:

bear -- make debug=yes clean all

Another solution is to teach the build system to output compile_commands.json.

GDB

For debugging interactive scenarios that don't have tests yet you can usegdbserver:

gdbserver :2345 src/kak; reset

(If Kakoune crashes, it might not be able to reset terminal modes. The reset takes care of that.)

Then, connect to gdbserver from another terminal

gdb -ex 'target remote :2345' -ex 'source src/.gdbinit'

If you are in the src/ directory, then src/.gdbinit should be loaded automatically.

The Kakoune binary includes GDB pretty printers which should be picked up by GDB. Unfortunately, gdbserver ignores them. As a workaround, you can load the pretty printers by adding this snippet in your gdbinit file:

python
sys.path.insert(0, '/path/to/kakoune/gdb/')
import gdb.printing
import kakoune
gdb.printing.register_pretty_printer(
        gdb.current_objfile(),
        kakoune.build_pretty_printer())
end

Clone this wiki locally