Skip to content

Commit 2d1cf5e

Browse files
committed
Add 'selected' and 'dummy' for target
1 parent c9f3a68 commit 2d1cf5e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lldb/source/Plugins/Protocol/MCP/Resource.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ using namespace lldb_private::mcp;
1414

1515
namespace {
1616
struct DebuggerResource {
17-
uint64_t debugger_id;
17+
uint64_t debugger_id = 0;
1818
std::string name;
19-
uint64_t num_targets;
19+
uint64_t num_targets = 0;
2020
};
2121

2222
llvm::json::Value toJSON(const DebuggerResource &DR) {
@@ -28,16 +28,20 @@ llvm::json::Value toJSON(const DebuggerResource &DR) {
2828
}
2929

3030
struct TargetResource {
31-
size_t debugger_id;
32-
size_t target_idx;
31+
size_t debugger_id = 0;
32+
size_t target_idx = 0;
33+
bool selected = false;
34+
bool dummy = false;
3335
std::string arch;
3436
std::string path;
3537
std::string platform;
3638
};
3739

3840
llvm::json::Value toJSON(const TargetResource &TR) {
3941
llvm::json::Object Result{{"debugger_id", TR.debugger_id},
40-
{"target_idx", TR.target_idx}};
42+
{"target_idx", TR.target_idx},
43+
{"selected", TR.selected},
44+
{"dummy", TR.dummy}};
4145
if (!TR.arch.empty())
4246
Result.insert({"arch", TR.arch});
4347
if (!TR.path.empty())
@@ -194,6 +198,8 @@ DebuggerResourceProvider::ReadTargetResource(llvm::StringRef uri,
194198
target_resource.debugger_id = debugger_id;
195199
target_resource.target_idx = target_idx;
196200
target_resource.arch = target_sp->GetArchitecture().GetTriple().str();
201+
target_resource.dummy = target_sp->IsDummyTarget();
202+
target_resource.selected = target_sp == debugger_sp->GetSelectedTarget();
197203

198204
if (Module *exe_module = target_sp->GetExecutableModulePointer())
199205
target_resource.path = exe_module->GetFileSpec().GetPath();

0 commit comments

Comments
 (0)