summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2019-01-23 20:27:16 +1100
committerMaxime Coste <mawww@kakoune.org>2019-01-23 20:27:16 +1100
commitebc9f7703b3f8a8d5658ea92d13301e0b2f5e97f (patch)
tree5c4061e5d6f0979c1ae86a9a92a3beccf4051ced
parent1b469f4c007c6eac1cb4656017759373e5372f3f (diff)
Embed gdb pretty-printing script directly into Kakoune binary
This will get stripped correctly, and should make debugging easier.
-rw-r--r--src/.gdbinit9
-rw-r--r--src/main.cc12
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
+)");