From ebc9f7703b3f8a8d5658ea92d13301e0b2f5e97f Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 23 Jan 2019 20:27:16 +1100 Subject: [PATCH] Embed gdb pretty-printing script directly into Kakoune binary This will get stripped correctly, and should make debugging easier. --- src/.gdbinit | 9 --------- src/main.cc | 12 ++++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/.gdbinit b/src/.gdbinit index 9f8da0bf..0feb1444 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -1,11 +1,2 @@ set print pretty break Kakoune::on_assert_failed - -python -sys.path.insert(0, '../gdb/') -import gdb.printing -import kakoune -gdb.printing.register_pretty_printer( - gdb.current_objfile(), - kakoune.build_pretty_printer()) -end diff --git a/src/main.cc b/src/main.cc index 3a1d23fe..cebc78f5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1139,3 +1139,15 @@ int main(int argc, char* argv[]) } return 0; } + +asm(R"( +.pushsection ".debug_gdb_scripts", "MS",@progbits,1 +.byte 4 +.ascii "kakoune-inline-gdb.py\n" +.ascii "import os.path\n" +.ascii "sys.path.insert(0, os.path.dirname(gdb.current_objfile().filename) + '/../share/kak/gdb/')\n" +.ascii "import gdb.printing\n" +.ascii "import kakoune\n" +.ascii "gdb.printing.register_pretty_printer(gdb.current_objfile(), kakoune.build_pretty_printer())\n" +.popsection +)");