[lldb-dev] Threading model for Python API
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@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
Re: [lldb-dev] Threading model for Python API
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 > 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@lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev ___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
Re: [lldb-dev] Threading model for Python API
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?) Christian On Mon, Aug 5, 2019 at 11:15 AM Greg Clayton 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 > > 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@lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev > ___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
Re: [lldb-dev] Threading model for Python API
> On Aug 5, 2019, at 9:20 AM, Christian Biesinger 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 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 >>> 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@lists.llvm.org >>> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev >> ___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
[lldb-dev] [Bug 42895] New: Segfault on `p $0`
https://bugs.llvm.org/show_bug.cgi?id=42895 Bug ID: 42895 Summary: Segfault on `p $0` Product: lldb Version: 8.0 Hardware: PC OS: Linux Status: NEW Severity: enhancement Priority: P Component: All Bugs Assignee: lldb-dev@lists.llvm.org Reporter: whitequ...@whitequark.org CC: jdevliegh...@apple.com, llvm-b...@lists.llvm.org Created attachment 22342 --> https://bugs.llvm.org/attachment.cgi?id=22342&action=edit Communication with GDB stub I am using LLDB 8 from Debian. To reproduce: (lldb) gdb-remote 1234 Process 1 stopped * thread #1, stop reason = signal SIGTRAP frame #0: 0x (lldb) p $0 (lldb) p $0 Thread 1 "lldb-8" received signal SIGSEGV, Segmentation fault. EvaluateExpression () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Target/Target.cpp:2389 2389/build/llvm-toolchain-8-8.0.1/tools/lldb/source/Target/Target.cpp: No such file or directory. (gdb) bt #0 EvaluateExpression () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Target/Target.cpp:2389 #1 0x72bcc196 in EvaluateExpression () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Commands/CommandObjectExpression.cpp:441 #2 0x72bcd0e8 in DoExecute () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Commands/CommandObjectExpression.cpp:658 #3 0x7277692f in Execute () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Interpreter/CommandObject.cpp:997 #4 0x7276ddf2 in HandleCommand () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Interpreter/CommandInterpreter.cpp:1761 #5 0x72771531 in IOHandlerInputComplete () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Interpreter/CommandInterpreter.cpp:2801 #6 0x726c63e1 in Run () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Core/IOHandler.cpp:558 #7 0x726abb86 in ExecuteIOHandlers () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Core/Debugger.cpp:988 #8 0x72772376 in RunCommandInterpreter () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/Interpreter/CommandInterpreter.cpp:3003 #9 0x72561121 in RunCommandInterpreter () at /build/llvm-toolchain-8-8.0.1/tools/lldb/source/API/SBDebugger.cpp:934 #10 0x00407131 in MainLoop () at /build/llvm-toolchain-8-8.0.1/tools/lldb/tools/driver/Driver.cpp:756 #11 0x00407d51 in main () at /build/llvm-toolchain-8-8.0.1/tools/lldb/tools/driver/Driver.cpp:936 Communication with GDB stub is attached. This is a MIPS target and I was trying to get the value of register $0. -- You are receiving this mail because: You are the assignee for the bug.___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
[lldb-dev] [Bug 42895] Segfault on `p $0`
https://bugs.llvm.org/show_bug.cgi?id=42895 Davide Italiano changed: What|Removed |Added Assignee|lldb-dev@lists.llvm.org |teempe...@gmail.com -- You are receiving this mail because: You are the assignee for the bug.___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
[lldb-dev] [Bug 21746] -var-update is unable to show updates for all registered varobjects
https://bugs.llvm.org/show_bug.cgi?id=21746 Jonas Devlieghere changed: What|Removed |Added Resolution|--- |MOVED Status|NEW |RESOLVED CC||jdevliegh...@apple.com --- Comment #1 from Jonas Devlieghere --- lldb-mi was moved to a downstream repository: https://github.com/lldb-tools/lldb-mi -- You are receiving this mail because: You are the assignee for the bug.___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
[lldb-dev] [Bug 42895] Segfault on `p $0`
https://bugs.llvm.org/show_bug.cgi?id=42895 Davide Italiano changed: What|Removed |Added Assignee|teempe...@gmail.com |lldb-dev@lists.llvm.org --- Comment #3 from Davide Italiano --- (In reply to Jim Ingham from comment #1) > $ is the space reserved in the expression parser for result variables. > I don't think it is a good idea to name your registers $0... If you are > going to do that, then you probably need to teach the > ClangPersistentVariables to start above the numbers you've taken over for > registers. But I think it would be less confusing if you chose a prefix for > registers ($r0 or whatever). LLDB shouldn't segfault regardless. Raphael fixed a similar bug recently, as newer C/C++ standards allow identifiers to start with dollar sign, e.g. $0. So, this happens to be an incarnation of a larger problem. Raphael, do you have ideas on how to fix this? -- You are receiving this mail because: You are the assignee for the bug.___ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev