Skip to content

Commit 28fa2a9

Browse files
committed
Show selected target, update unit test for API change
1 parent a3bfe38 commit 28fa2a9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,15 @@ DebuggerListTool::Call(const protocol::ToolArguments &args) {
130130

131131
os << "- debugger " << i << '\n';
132132

133-
const TargetList &target_list = debugger_sp->GetTargetList();
133+
TargetList &target_list = debugger_sp->GetTargetList();
134134
const size_t num_targets = target_list.GetNumTargets();
135135
for (size_t j = 0; j < num_targets; ++j) {
136136
lldb::TargetSP target_sp = target_list.GetTargetAtIndex(j);
137137
if (!target_sp)
138138
continue;
139139
os << " - target " << j;
140+
if (target_sp == target_list.GetSelectedTarget())
141+
os << " (selected)";
140142
// Append the module path if we have one.
141143
if (Module *exe_module = target_sp->GetExecutableModulePointer())
142144
os << " " << exe_module->GetFileSpec().GetPath();

lldb/unittests/Protocol/ProtocolMCPServerTest.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ class TestTool : public mcp::Tool {
4646
using mcp::Tool::Tool;
4747

4848
virtual llvm::Expected<mcp::protocol::TextResult>
49-
Call(const llvm::json::Value *args) override {
49+
Call(const ToolArguments &args) override {
5050
std::string argument;
51-
if (const json::Object *args_obj = args->getAsObject()) {
51+
if (const json::Object *args_obj =
52+
std::get<json::Value>(args).getAsObject()) {
5253
if (const json::Value *s = args_obj->get("arguments")) {
5354
argument = s->getAsString().value_or("");
5455
}
@@ -66,7 +67,7 @@ class ErrorTool : public mcp::Tool {
6667
using mcp::Tool::Tool;
6768

6869
virtual llvm::Expected<mcp::protocol::TextResult>
69-
Call(const llvm::json::Value *args) override {
70+
Call(const ToolArguments &args) override {
7071
return llvm::createStringError("error");
7172
}
7273
};
@@ -77,7 +78,7 @@ class FailTool : public mcp::Tool {
7778
using mcp::Tool::Tool;
7879

7980
virtual llvm::Expected<mcp::protocol::TextResult>
80-
Call(const llvm::json::Value *args) override {
81+
Call(const ToolArguments &args) override {
8182
mcp::protocol::TextResult text_result;
8283
text_result.content.emplace_back(mcp::protocol::TextContent{{"failed"}});
8384
text_result.isError = true;

0 commit comments

Comments
 (0)