[Lldb-commits] [lldb] 7030623 - [lldb][docs] Add strace example to Debugging doc

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 23 09:05:20 PDT 2023


Author: David Spickett
Date: 2023-10-23T17:04:34+01:00
New Revision: 70306238cf3730fd7ef02170a1fdfa302676ac2b

URL: https://github.com/llvm/llvm-project/commit/70306238cf3730fd7ef02170a1fdfa302676ac2b
DIFF: https://github.com/llvm/llvm-project/commit/70306238cf3730fd7ef02170a1fdfa302676ac2b.diff

LOG: [lldb][docs] Add strace example to Debugging doc

This has been very useful lately debugging remote
connections. In some cases it's probably better
than our own logging.

Added: 
    

Modified: 
    lldb/docs/resources/debugging.rst

Removed: 
    


################################################################################
diff  --git a/lldb/docs/resources/debugging.rst b/lldb/docs/resources/debugging.rst
index 63c88477a848c43..990a95f54e07ff8 100644
--- a/lldb/docs/resources/debugging.rst
+++ b/lldb/docs/resources/debugging.rst
@@ -213,11 +213,26 @@ child processes.
 The same goes for ``printf``. If it's called in a child process you won't see
 the output.
 
-In these cases consider either interactive debugging ``lldb-server`` or
+In these cases consider interactive debugging ``lldb-server`` or
 working out a more specific command such that it does not have to spawn a
 subprocess. For example if you start with ``platform`` mode, work out what
 ``gdbserver`` mode process it spawns and run that command instead.
 
+Another option if you have ``strace`` available is to trace the whole process
+tree and inspect the logs after the session has ended. ::
+
+  $ strace -ff -o log -p $(pidof lldb-server)
+
+This will log all syscalls made by ``lldb-server`` and processes that it forks.
+``-ff`` tells ``strace`` to trace child processes and write the results to a
+separate file for each process, named using the prefix given by ``-o``.
+
+Search the log files for specific terms to find the process you're interested
+in. For example, to find a process that acted as a ``gdbserver`` instance::
+
+  $ grep "gdbserver" log.*
+  log.<N>:execve("<...>/lldb-server", [<...> "gdbserver", <...>) = 0
+
 Remote Debugging
 ----------------
 


        


More information about the lldb-commits mailing list