[all-commits] [llvm/llvm-project] 73b2d6: [lldb][FreeBSD] Fix crash when execve fails with a...

David Spickett via All-commits all-commits at lists.llvm.org
Fri Mar 8 09:15:37 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 73b2d672c1c8318cd16a02812c39ae3997b9dbcd
      https://github.com/llvm/llvm-project/commit/73b2d672c1c8318cd16a02812c39ae3997b9dbcd
  Author: David Spickett <david.spickett at linaro.org>
  Date:   2024-03-08 (Fri, 08 Mar 2024)

  Changed paths:
    M lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp

  Log Message:
  -----------
  [lldb][FreeBSD] Fix crash when execve fails with asserts enabled

535da10842c7309e9eeaf9828cf6bb034fecaf16 introduced a check, when execve fails,
to see if we are allowed to trace programs at all.

Unfortunately because we like to call Status vars "error" and "status"
in various combinations, one got misnamed. This lead to lldb-server trying
to make an error value out of a success value when you did the following:

```
$ ./bin/lldb-server gdbserver 127.0.0.1:1234 -- is_not_a_file
Assertion failed: (Err && "Cannot create Expected<T> from Error success value."), function Expected...
```

This happened because the execve fails, but the check whether we can
trace says yes we can trace, but then we use the Status from the check
to create the return value. That Status is in fact a success value not
the failed Status we got from the execve attempt.

With the name corrected you now get:
```
$ ./bin/lldb-server gdbserver 127.0.0.1:1234 -- is_not_a_file
error: failed to launch 'is_not_a_file': execve failed: No such file or directory
```

Which is what we expect to see. This also fixes the test `TestGDBRemoteLaunch.py`
when asserts are enabled.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list