mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Print debug string with error when legacy debugger used with env
Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3f5b9df122
commit
3bbbe9facb
@@ -196,7 +196,11 @@ ze_result_t DriverHandleImp::initialize(std::vector<std::unique_ptr<NEO::Device>
|
||||
}
|
||||
|
||||
if (enableProgramDebugging) {
|
||||
UNRECOVERABLE_IF(neoDevice->getDebugger() != nullptr && enableProgramDebugging);
|
||||
if (neoDevice->getDebugger() != nullptr) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"%s", "Source Level Debugger cannot be used with Environment Variable enabling program debugging.\n");
|
||||
UNRECOVERABLE_IF(neoDevice->getDebugger() != nullptr && enableProgramDebugging);
|
||||
}
|
||||
neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[neoDevice->getRootDeviceIndex()]->debugger = DebuggerL0::create(neoDevice.get());
|
||||
}
|
||||
|
||||
|
||||
@@ -271,5 +271,33 @@ TEST_F(TwoSubDevicesDebuggerEnabledTest, givenDebuggingEnabledWhenSubDevicesAreC
|
||||
EXPECT_EQ(deviceL0->getDebugSurface(), subDevice0->getDebugSurface());
|
||||
}
|
||||
|
||||
TEST(Debugger, GivenLegacyDebuggerAndProgramDebuggingEnabledWhenInitializingDriverThenAbortIsCalledAfterPrintingError) {
|
||||
DebugManagerStateRestore restorer;
|
||||
NEO::DebugManager.flags.PrintDebugMessages.set(1);
|
||||
|
||||
::testing::internal::CaptureStderr();
|
||||
auto executionEnvironment = new NEO::ExecutionEnvironment();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
|
||||
executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(new MockSourceLevelDebugger());
|
||||
auto hwInfo = *NEO::defaultHwInfo.get();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo);
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
|
||||
executionEnvironment->setDebuggingEnabled();
|
||||
|
||||
auto neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u);
|
||||
|
||||
NEO::DeviceVector devices;
|
||||
devices.push_back(std::unique_ptr<NEO::Device>(neoDevice));
|
||||
auto driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
|
||||
driverHandle->enableProgramDebugging = true;
|
||||
|
||||
EXPECT_THROW(driverHandle->initialize(std::move(devices)), std::exception);
|
||||
std::string output = testing::internal::GetCapturedStderr();
|
||||
|
||||
EXPECT_EQ(std::string("Source Level Debugger cannot be used with Environment Variable enabling program debugging.\n"), output);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user