[lldb-dev] Connecting to lldb-rpc-server

Sean Callanan via lldb-dev lldb-dev at lists.llvm.org
Fri Oct 7 13:40:48 PDT 2016


Once you have Python commands, could you make them into a simple RPC service and set up a new socket connection to your program from the LLDB side, all implemented in Python?

Sean

> On Oct 7, 2016, at 12:29 PM, Jim Ingham via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> Enrico is right.  At present, each connection to the lldb-rpc-server gets its own SBDebugger, so you wouldn't be able to talk to the debugger that Xcode is using for its process.
> 
> Even if that was changed, then you'd run into other problems, for instance, at present only one Listener can wait for process events from the debugger, so you would not be able to control execution or coordinate with Xcode's running of the process.  But this is probably just the tip of the iceberg of things that would go wrong if you try to do this.  
> 
> If you have lots of resources to devote to hacking on lldb itself, I'm sure you could make this work, but this is a very tricky part of lldb, so the engineering work would be non-trivial to say the least.  I don't know your circumstances, but I doubt it would end up being worthwhile for you.
> 
> Enrico's suggestion of making Python commands to do the job is probably the best way to go.
> 
> Note, it used to be tricky to get a plain command tool (lldb-rpc-server) to connect to the Window Server and put up UI.  I haven't tried that since I worked on Tcl/Tk way back in the day, so it may be easier now.  But you should probably also experiment with that to make sure that's possible before you go too far down this route.
> 
> Jim
> 
> 
>> On Oct 7, 2016, at 12:05 PM, Rex Fenley via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>> 
>> https://media4.giphy.com/media/l2Je27KfKp8x71qAo/200.gif
>> 
>> On Fri, Oct 7, 2016 at 12:01 PM, Enrico Granata <egranata at apple.com> wrote:
>> It is my understanding that this is not possible in the current architecture
>> 
>>> On Oct 7, 2016, at 11:55 AM, Rex Fenley <rex at remind101.com> wrote:
>>> 
>>> We expect to have a rich user experience as this tool progresses, using Python to generate UI will limit our development process. It would be much simpler if we could communicate with Xcode's lldb directly from our application.
>>> 
>>> On Fri, Oct 7, 2016 at 11:33 AM, Enrico Granata <egranata at apple.com> wrote:
>>> I can see a couple of avenues for your use case:
>>> 
>>> - you can write custom LLDB commands (obligatory reference: http://lldb.llvm.org/python-reference.html) and have your users type these via the console instead of by clicking buttons
>>> - you could write a Python script that pops up extra UI and have your buttons run as part of LLDB that way. I have admittedly never tried to do this, and it might require some tinkering, but in theory I believe it should be possible
>>> 
>>> Personally, I'd rather much have console commands I can type instead of a magic separate UI that might even be hidden underneath other windows or hiding useful information unless I drag it out of the way, but then it's annoying to reach for when I need it, ..., but that's me...
>>> 
>>>> On Oct 7, 2016, at 11:27 AM, Rex Fenley <rex at remind101.com> wrote:
>>>> 
>>>> I'm trying to build a separate debugging tool that can be used in unison with Xcode it will provide buttons that are shortcuts to lldb scripts we write.
>>>> 
>>>> On Fri, Oct 7, 2016 at 10:45 AM, Enrico Granata <egranata at apple.com> wrote:
>>>> I am gonna echo Kate's question, but delve one level deeper
>>>> 
>>>> Why do you want to send commands to LLDB from a different process?
>>>> 
>>>> We have a bunch of different extension points in LLDB, so it's possible that what you're trying to do is actually already possible
>>>> 
>>>>> On Oct 7, 2016, at 10:41 AM, Rex Fenley via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>>>>> 
>>>>> Hi Kate,
>>>>> 
>>>>> I'm trying to connect to the running instance of lldb in Xcode to send commands to it from a different process :)
>>>>> 
>>>>> On Fri, Oct 7, 2016 at 10:27 AM, Kate Stone <k8stone at apple.com> wrote:
>>>>> The RPC mechanism used in Xcode 8 is not a part of the open source LLDB project and should be treated as an implementation detail of Xcode.  What are you trying to accomplish?
>>>>> 
>>>>> Kate Stone k8stone at apple.com
>>>>>  Xcode Low Level Tools
>>>>> 
>>>>>> On Oct 6, 2016, at 6:11 PM, Rex Fenley via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>>>>>> 
>>>>>> Hi! I'm trying to connect to Xcode's lldb rpc server but I'm having trouble.
>>>>>> 
>>>>>> This doesn't seem to work to list the hosts.
>>>>>> rpcinfo -p lldb-rpc-server
>>>>>> 
>>>>>> Can't contact rpcbind on lldb-rpc-server
>>>>>> 
>>>>>> 
>>>>>> rpcinfo: RPC: Unknown host
>>>>>> 
>>>>>> Am I doing this correctly?
>>>>>> 
>>>>>> -- 
>>>>>> Rex Fenley  |  IOS DEVELOPER
>>>>>> 
>>>>>> 
>>>>>> Remind.com |  BLOG  |  FOLLOW US  |  LIKE US
>>>>>> _______________________________________________
>>>>>> lldb-dev mailing list
>>>>>> lldb-dev at lists.llvm.org
>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Rex Fenley  |  IOS DEVELOPER
>>>>> 
>>>>> 
>>>>> Remind.com |  BLOG  |  FOLLOW US  |  LIKE US
>>>>> _______________________________________________
>>>>> lldb-dev mailing list
>>>>> lldb-dev at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>>>> 
>>>> 
>>>> Thanks,
>>>> - Enrico
>>>> 📩 egranata@.com ☎️ 27683
>>>> 
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Rex Fenley  |  IOS DEVELOPER
>>>> 
>>>> 
>>>> Remind.com |  BLOG  |  FOLLOW US  |  LIKE US
>>> 
>>> 
>>> Thanks,
>>> - Enrico
>>> 📩 egranata@.com ☎️ 27683
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Rex Fenley  |  IOS DEVELOPER
>>> 
>>> 
>>> Remind.com |  BLOG  |  FOLLOW US  |  LIKE US
>> 
>> 
>> Thanks,
>> - Enrico
>> 📩 egranata@.com ☎️ 27683
>> 
>> 
>> 
>> 
>> -- 
>> Rex Fenley  |  IOS DEVELOPER
>> 
>> 
>> Remind.com |  BLOG  |  FOLLOW US  |  LIKE US
>> _______________________________________________
>> 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