[PATCH] LLDB: Don't crash when creating a SBTarget programmatically

Michail Pishchagin mblsha at gmail.com
Thu Sep 12 05:57:32 PDT 2013


Hi, this is my first patch, hopefully I've done it the right way :-)

I'm automatically attaching to child processes by a custom breakpoint
action written in Python:

def breakpoint_callback(frame, bp_loc, dict):
    old_target = lldb.target
    # If we just use lldb.process here, it won't continue afterwards :-(
    thread = frame.GetThread()
    old_process = thread.GetProcess()

    handle = int(frame.FindVariable("handle").GetValue())
    # After we attach to PID it will automatically switch to correct
executable
    exe = old_target.GetExecutable().fullpath
    new_target = lldb.debugger.CreateTarget(exe)  # <-- crash here

I'm not using any remote sessions, everything is local. And my fix makes it
work correctly.

-Michail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130912/f17c69cf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dont-crash-when-creating-targets.diff
Type: application/octet-stream
Size: 620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130912/f17c69cf/attachment.obj>


More information about the llvm-commits mailing list