[Lldb-commits] [PATCH] D93895: Implement vAttachWait in lldb-server

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 5 14:44:12 PST 2021

clayborg added a comment.

In D93895#2480578 <https://reviews.llvm.org/D93895#2480578>, @augusto2112 wrote:

> I think I get your point. If we pass the extra options in the packet, the validation on older lldb-server versions will reject the message.
>> Another option would be to have lldb-server check for environment variables for default values for --waitfor-interval and --waitfor-duration. If they are set, they become the new default values. Of course a user can launch the lldb-server manually with the options set a different way and then attach with "process connect ..." if required. But this would provide an alternate way for users to control the polling and timeout.
> I'll defer to you guys, since you're a lot more knowledgeable on lldb than I am :)
> I do have another possible solution we could consider: can we create a new message, similar to `qVAttachOrWaitSupported`, that queries if these extra options are supported or not. Something like `qVAttachWaitExtraOptionsSupported`. We might even consider returning something akin to a "version number", so if we support more options in the future we can bump up the number.
> Let me know what you think (again, I'm fine doing it either way).

Yeah, I was thinking it might be nice to have a better attach + wait packet.

We have added new JSON packets in the past that are more flexible and allows us to specify arguments using a JSON dictionary. Currently the vAttachWait or vAttachOrWait packets have a hard coded single process name argument that is appended as hex ASCII so for "a.out":


But we could make a new "jAttachWait" that could be something like:

  jAttachWait:{"executable":"a.out", "waitfor-interval-usec": 1000, "waitfor-duration-sec": 20}

Then the question becomes where the values for "waitfor-interval-usec" and "waitfor-duration-sec" come from. Since "process attach" has to work for any process plug-in (there are many in "lldb/source/Plugins/Process"), if we add any options to "process attach", each of the plug-ins in "lldb/source/Plugins/Process" would need to handle those options. It might be better to add new settings for the GDB remote plug-in (AKA: ProcessGDBRemote). There are global settings already for this plug-in:

  (lldb) settings show
  plugin.process.gdb-remote.packet-timeout (unsigned) = 5
  plugin.process.gdb-remote.target-definition-file (file) = 
  plugin.process.gdb-remote.use-g-packet-for-reading (boolean) = false
  plugin.process.gdb-remote.use-libraries-svr4 (boolean) = true

We would easily add new settings to lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td:

  plugin.process.gdb-remote.waitfor-interval-usec (unsigned) = 1000
  plugin.process.gdb-remote.waitfor-duration-sec (unsigned) = 20

And then use these in the new JSON packet as arguments.

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list