Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/blackboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,21 @@ void Blackboard::debugMessage() const

for(const auto& [from, to] : internal_to_external_)
{
std::cout << "[" << from << "] remapped to port of parent tree [" << to << "]"
<< std::endl;
std::cout << "[" << from << "] remapped to port of parent tree [" << to << "]";
// Show the type of the remapped entry from the parent. Issue #408.
if(auto parent = parent_bb_.lock())
{
if(auto entry = parent->getEntry(to))
{
auto port_type = entry->info.type();
if(port_type == typeid(void))
{
port_type = entry->value.type();
}
std::cout << " (" << BT::demangle(port_type) << ")";
}
}
std::cout << std::endl;
}
}

Expand Down
28 changes: 28 additions & 0 deletions tests/gtest_blackboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,3 +745,31 @@ TEST(BlackboardTest, SetBlackboard_WithPortRemapping)
// Tick till the end with no crashes
ASSERT_NO_THROW(tree.tickWhileRunning(););
}

// Issue #408: debugMessage should show remapped entries from parent blackboard
TEST(BlackboardTest, DebugMessageShowsRemappedEntries_Issue408)
{
// Create parent BB with a value
auto parent_bb = Blackboard::create();
parent_bb->set("parent_value", 42);

// Create child BB with remapping
auto child_bb = Blackboard::create(parent_bb);
child_bb->addSubtreeRemapping("local_name", "parent_value");

// Capture debugMessage output
testing::internal::CaptureStdout();
child_bb->debugMessage();
std::string output = testing::internal::GetCapturedStdout();

// The output should contain the remapped key with its type info from parent
EXPECT_TRUE(output.find("local_name") != std::string::npos)
<< "debugMessage output should mention 'local_name'. Got: " << output;
EXPECT_TRUE(output.find("parent_value") != std::string::npos)
<< "debugMessage output should mention 'parent_value'. Got: " << output;
// The output should show the parent entry's type, not just the remapping
EXPECT_TRUE(output.find("int") != std::string::npos) << "debugMessage output should "
"show the type of the remapped "
"entry. Got: "
<< output;
}
Loading