Skip to content

If SBDebugger::InitializeWithErrorHandling succeeds, the returned SBError is not marked as valid #169788

@DavidSpickett

Description

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions