Issue 169788
Summary If SBDebugger::InitializeWithErrorHandling succeeds, the returned SBError is not marked as valid
Labels lldb
Assignees
Reporter DavidSpickett
    `SBDebugger::InitializeWithErrorHandling` does not set the returned error as valid if it succeeds. The error is marked as success by default construction though.

```
$ cat test_api.cpp 
#include <iostream>
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h"

int main() {
    lldb::SBError err = lldb::SBDebugger::InitializeWithErrorHandling();

    std::cout << "SBError validity: " << err.IsValid() << "\n";
    std::cout << "SBError success: " << err.Success() << "\n";
    std::cout << "SBError fail: " << err.Fail() << "\n";

    if (err.IsValid() && !err.Success())
        std::cout << "Error message: " << err.GetCString() << "\n";

    return 0;
}
```
```
$ cat makefile 
all:
	g++ test_api.cpp -o test_api -I /home/david.spickett/llvm.install/include/ -L /home/david.spickett/llvm.install/lib/ -llldb

run:
	LD_LIBRARY_PATH=/home/david.spickett/llvm.install/lib ./test_api
```
This produces:
```
$ make run
LD_LIBRARY_PATH=/home/david.spickett/llvm.install/lib ./test_api
SBError validity: 0
SBError success: 1
SBError fail: 0
```
I would expect the SBError to be valid and marked as success.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to