[tracker/sam/functional-tests-quiet: 4/15] Add HACKING.md, document how to attach debugger to daemons.



commit 14ae74c798fbc1df4aceb445dac1fefe2e28d0c3
Author: Sam Thursfield <sam afuera me uk>
Date:   Thu Aug 29 17:30:23 2019 +0300

    Add HACKING.md, document how to attach debugger to daemons.

 HACKING.md | 17 +++++++++++++++++
 README.md  |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/HACKING.md b/HACKING.md
new file mode 100644
index 000000000..89ef319ce
--- /dev/null
+++ b/HACKING.md
@@ -0,0 +1,17 @@
+# Attaching a debugger to Tracker daemons
+
+Tracker daemons are not started directly. Instead they are started by the D-Bus
+daemon by request. When using tracker-sandbox or the functional-tests, it's
+difficult to start the daemon manually under `gdb`.
+
+Instead, we recommend adding a 10 second timeout at the top of the daemon's
+main() function. In Vala code, try this:
+
+    print("Pausing to attach debugger. Run: gdb attach %i\n", Posix.getpid());
+    Posix.usleep(10 * 1000 * 1000);
+    print("Waking up again\n");
+
+Run the test, using the `meson build --timeout-multiplier=10000`
+option to avoid your process being killed by the test runner. When you see
+the 'Pausing' message, run the `gdb attach``command in another terminal within
+10 seconds.
diff --git a/README.md b/README.md
index f1ec0f855..c94639b87 100644
--- a/README.md
+++ b/README.md
@@ -131,4 +131,4 @@ interactive shell inside the sandbox. From here you can use debugging tools
 such as GDB.
 
 For more information about developing Tracker, look at
-https://wiki.gnome.org/Projects/Tracker.
+https://wiki.gnome.org/Projects/Tracker and HACKING.md.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]