[lldb-dev] Returning multiple values in Python API function

Greg Clayton via lldb-dev lldb-dev at lists.llvm.org
Fri Oct 21 15:30:48 PDT 2016

> On Oct 21, 2016, at 1:03 PM, Francis Ricci via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> Hi all,
> I'm looking to add Platform::LaunchGDBServer() to the SBPlatform API,
> but it requires two return values - an lldb::pid_t and a string url.
> Internally, we just pass by reference, but we can't do that in the
> API. Any suggestions on how to do this, since we can't pass primitives
> by reference from Python?
> My current thinking was to use the pid_t as the return value, and then
> figure out a way to communicate the string information as an "out"
> function parameter. Ideas there included using an SBStream&, as the
> GetDescription() functions do, but that doesn't seem optimal.
> In standard Python, we'd just use a tuple return value, but I don't
> see any way to do that using the swig interface.
> The reasoning behind adding this API function is to prevent the
> platform-mode GdbRemote tests from launching the gdbserver using an
> 'A' packet instead of the standard 'qLaunchGDBServer' packet.

I am still unclear as to why you want this? An lldb-server that is launched in platform mode shouldn't use the 'A' packet at all. Can you elaborate on why you need this more? Why do we need to prevent it from using an 'A' packet in the first place? What is leading to this happening? Why do you want to launch on manually?


More information about the lldb-dev mailing list