[lldb-dev] Support for Error Strings in remote protocol
Pavel Labath via lldb-dev
lldb-dev at lists.llvm.org
Thu Jun 22 05:33:37 PDT 2017
On 22 June 2017 at 00:18, Stephane Sezer via lldb-dev
<lldb-dev at lists.llvm.org> wrote:
> What's the specific use case that you're trying to support with error
> messages in the protocol? My initial thought on this is that it's not really
> the debug server's job to generate human-readable error messages and that
> the debugger is better suited to do the job.
I think this really depends on the use case. Take the A (launch)
packet for example. Launching a process can fail for any number of
reasons. Let's just list the main syscalls involved in doing that:
- open (for redirecting stdio)
- chdir
- fork
- execve
And each of these can fail for several reasons. So if you want to pass
full information, you'd need to pass some sort of operation+errno
combination, and the 8-bit address space is quite crowded for that,
particularly if you want it to be backward compatible. As an example,
take a look at this command:
(lldb) process launch -e /non/existing/file
error: process launch failed: 'A' packet returned an error: 8
Wouldn't it be better if it read:
error: process launch failed: failed to open file
'/non/existing/file': No such file or directory
I think it would be hard to get this level of detail for the client
with just numeric error codes, whereas producing this string is
trivial for the server.
Note that it is still the client who decides what error to print to
the user, and if it thinks it has a better error message, it is free
to ignore the one returned by the server.
More information about the lldb-dev
mailing list