[lldb-dev] Debug events in synchronous mode?

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Thu Feb 4 11:23:17 PST 2016


In synchronous mode, you should never see events.  The part of lldb that is making the command synchronous is using those events to make the command wait till the action it initiated completes before it returns.  If it is letting process control events leak out, then that is a bug.

If you are running in async mode (and haven't set stop-at-entry in the launch options), then you won't see an event till the process stops for some other reason (e.g. hitting a breakpoint.)  If launch returns with no error, then your process got launched, and you should just wait for it to stop.

Jim

> On Feb 4, 2016, at 1:21 AM, Pavel Labath via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> Hi,
> 
> I am not sure what are the "official" rules, but the general idea is
> that you need not concern yourself too much with events when you are
> in synchronous mode. In synchronous mode, you can be sure that by the
> time target.Launch() returns, the process will be stopped (or dead, or
> something else, you can check process.GetState() to find that out). No
> need to play around with listeners...
> 
> cheers,
> pl
> 
> On 4 February 2016 at 06:41, Jeffrey Tan via lldb-dev
> <lldb-dev at lists.llvm.org> wrote:
>> Hi,
>> 
>> I found that if I am using synchronous mode, some times there are no debug
>> events generated during launch. For example, for the code below,
>> LLDBListenerThread will receive no debug events.
>> 
>> Is this expected? What is the rule of debug events in synchronous mode?
>> 
>> def main():
>>    debugger = lldb.SBDebugger.Create()
>>    debugger.SetAsync(False)
>>    target = debugger.CreateTargetWithFileAndArch(executable_path,
>> lldb.LLDB_ARCH_DEFAULT)
>>    target.BreakpointCreateByName('main')
>> 
>>    listener = lldb.SBListener('Event Listener')
>>    error = lldb.SBError()
>>    process = target.Launch (listener,
>>                             None,      # argv
>>                             None,      # envp
>>                             None,      # stdin_path
>>                             None,      # stdout_path
>>                             None,      # stderr_path
>>                             None,      # working directory
>>                             0,         # launch flags
>>                             False,     # Stop at entry
>>                             error)     # error
>>    print 'Launch result: %s' % str(error)
>>    event_thread = LLDBListenerThread(debugger)
>>    event_thread.start()
>> 
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list