[all-commits] [llvm/llvm-project] 015117: [lldb/Host] Improve error messages on unowned read...

Med Ismail Bennani via All-commits all-commits at lists.llvm.org
Mon May 4 08:34:27 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 015117411e11458f9816ba4359246132164a4297
      https://github.com/llvm/llvm-project/commit/015117411e11458f9816ba4359246132164a4297
  Author: Med Ismail Bennani <medismail.bennani at gmail.com>
  Date:   2020-05-04 (Mon, 04 May 2020)

  Changed paths:
    M lldb/source/Commands/CommandObjectTarget.cpp
    M lldb/test/API/commands/target/basic/TestTargetCommand.py

  Log Message:
  -----------
  [lldb/Host] Improve error messages on unowned read files

When trying to read a core file that is not owned by the user running lldb
and that doesn't have read permission on the file, lldb shows a misleading
error message:

```
Unable to find process plug-in for core file
```

This is due to the fact that currently, lldb doesn't check the file
ownership. And when trying to to open and read a core file, the syscall
fails, which prevents a process to be created.

Since lldb already have a portable `open` syscall interface, lets take
advantage of that and delegate the error handling to the syscall
itself. This way, no matter if the file exists or if the user has proper
ownership, lldb will always try to open the file, and behave accordingly
to the error code returned.

rdar://42630030

https://reviews.llvm.org/D78712

Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>




More information about the All-commits mailing list