[lldb-dev] Threading model for Python API

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Mon Aug 5 09:46:09 PDT 2019



> On Aug 5, 2019, at 9:20 AM, Christian Biesinger <cbiesinger at google.com> wrote:
> 
> OK thanks! (If I try to get, for example, the local variables while
> the process is running, will that fail or "succeed" in a weird way?)

You will get an empty list. But if you get the list of variables on thread 1, then thread 2 continues, and back on thread 1 you ask each value in the lldb::SBValueList for their values, you will get fail values or no values when you ask. Mainly common sense kind of stuff, but just something to be aware of.
> 
> Christian
> 
> On Mon, Aug 5, 2019 at 11:15 AM Greg Clayton <clayborg at gmail.com> wrote:
>> 
>> The API is thread safe, but you can run into interesting issues if you don't thread things right. You don't want one thread stepping and another thread resuming. It will work, but you probably will have a tough time figuring out why certain functions return certain values. Also, you don't want one thread resuming a process while another things the process is stopped and tries to get and display local variables.
>> 
>> So yes the API is thread safe, but be careful with how you use things.
>> 
>> Greg
>> 
>>> On Aug 5, 2019, at 8:59 AM, Christian Biesinger via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>>> 
>>> Hi there!
>>> 
>>> I was wondering what the threading model is for the Python API (when
>>> running inside of LLDB, in implementing a command)?
>>> 
>>> For example: If I create a Python thread in my command, how do I
>>> access the LLDB API? Is there an equivalent of gdb's post_event
>>> function to run it on the main thread? Or is the API threadsafe?
>>> 
>>> I tried to look for documentation on this but was unsuccessful.
>>> 
>>> Thanks!
>>> Christian
>>> _______________________________________________
>>> lldb-dev mailing list
>>> lldb-dev at lists.llvm.org
>>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>> 



More information about the lldb-dev mailing list