[Lldb-commits] [lldb] r259396 - Add a note on how to create an empty target and use it to attach to

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 1 12:05:37 PST 2016


Author: jingham
Date: Mon Feb  1 14:05:37 2016
New Revision: 259396

URL: http://llvm.org/viewvc/llvm-project?rev=259396&view=rev
Log:
Add a note on how to create an empty target and use it to attach to
processes whose executables you don't know up front.

Modified:
    lldb/trunk/scripts/interface/SBDebugger.i

Modified: lldb/trunk/scripts/interface/SBDebugger.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBDebugger.i?rev=259396&r1=259395&r2=259396&view=diff
==============================================================================
--- lldb/trunk/scripts/interface/SBDebugger.i (original)
+++ lldb/trunk/scripts/interface/SBDebugger.i Mon Feb  1 14:05:37 2016
@@ -105,6 +105,16 @@ if target:
         else:
             print('Unexpected process state: %s, killing process...' % debugger.StateAsCString (state))
             process.Kill()
+
+Sometimes you need to create an empty target that will get filled in later.  The most common use for this
+is to attach to a process by name or pid where you don't know the executable up front.  The most convenient way
+to do this is:
+
+target = debugger.CreateTarget('')
+error = lldb.SBError()
+process = target.AttachToProcessWithName(debugger.GetListener(), 'PROCESS_NAME', False, error)
+
+or the equivalent arguments for AttachToProcessWithID.
 ") SBDebugger;
 class SBDebugger
 {




More information about the lldb-commits mailing list