Skip to content

Commit c021e2e

Browse files
L0 Debugger - DebugSession linux implementation
- new feature, enabled with PRELIM build - implementation of debug session for linux - move ResourceClass enum from Drm to drm_debug.h Resolves: NEO-6814 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
1 parent 4e4560f commit c021e2e

File tree

27 files changed

+7906
-85
lines changed

27 files changed

+7906
-85
lines changed

CMakeLists.txt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,16 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
448448
# Get available platfroms
449449
include(platforms.cmake)
450450

451+
if(UNIX)
452+
# prelim headers detection
453+
if(NOT ("${BRANCH_TYPE}" STREQUAL ""))
454+
set(NEO_ENABLE_i915_PRELIM_DETECTION TRUE)
455+
elseif(NOT DEFINED NEO_ENABLE_i915_PRELIM_DETECTION)
456+
set(NEO_ENABLE_i915_PRELIM_DETECTION FALSE)
457+
endif()
458+
message(STATUS "i915 prelim headers detection: ${NEO_ENABLE_i915_PRELIM_DETECTION}")
459+
endif()
460+
451461
get_filename_component(I915_INCLUDES_DIR "${NEO_SOURCE_DIR}/third_party${BRANCH_DIR_SUFFIX}uapi" ABSOLUTE)
452462
message(STATUS "i915 includes dir: ${I915_INCLUDES_DIR}")
453463

@@ -793,15 +803,6 @@ else()
793803
set(NEO_EXTRA_LIBS dl pthread rt)
794804
endif()
795805

796-
if(UNIX)
797-
# prelim headers detection
798-
if(NOT ("${BRANCH_TYPE}" STREQUAL ""))
799-
set(NEO_ENABLE_i915_PRELIM_DETECTION TRUE)
800-
elseif(NOT DEFINED NEO_ENABLE_i915_PRELIM_DETECTION)
801-
set(NEO_ENABLE_i915_PRELIM_DETECTION FALSE)
802-
endif()
803-
message(STATUS "i915 prelim headers detection: ${NEO_ENABLE_i915_PRELIM_DETECTION}")
804-
endif()
805806
add_subdirectory_unique(shared)
806807

807808
if(NEO_BUILD_WITH_OCL)

level_zero/core/source/debugger/linux/debugger_l0_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool DebuggerL0::initDebuggingInOs(NEO::OSInterface *osInterface) {
2828
void DebuggerL0::registerElf(NEO::DebugData *debugData, NEO::GraphicsAllocation *isaAllocation) {
2929
if (device->getRootDeviceEnvironment().osInterface.get() != nullptr) {
3030
auto drm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>();
31-
auto handle = drm->registerResource(NEO::Drm::ResourceClass::Elf, debugData->vIsa, debugData->vIsaSize);
31+
auto handle = drm->registerResource(NEO::DrmResourceClass::Elf, debugData->vIsa, debugData->vIsaSize);
3232
static_cast<NEO::DrmAllocation *>(isaAllocation)->linkWithRegisteredHandle(handle);
3333
}
3434
}
@@ -39,7 +39,7 @@ bool DebuggerL0::attachZebinModuleToSegmentAllocations(const StackVec<NEO::Graph
3939
}
4040
auto drm = device->getRootDeviceEnvironment().osInterface->getDriverModel()->as<NEO::Drm>();
4141
uint32_t segmentCount = static_cast<uint32_t>(allocs.size());
42-
moduleHandle = drm->registerResource(NEO::Drm::ResourceClass::L0ZebinModule, &segmentCount, sizeof(uint32_t));
42+
moduleHandle = drm->registerResource(NEO::DrmResourceClass::L0ZebinModule, &segmentCount, sizeof(uint32_t));
4343

4444
for (auto &allocation : allocs) {
4545
auto drmAllocation = static_cast<NEO::DrmAllocation *>(allocation);

level_zero/core/source/dll/linux/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,16 @@
77
set(L0_SRCS_DLL_LINUX
88
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
99
${CMAKE_CURRENT_SOURCE_DIR}/debugger_l0_linux.cpp
10-
${NEO_SOURCE_DIR}/level_zero/tools/source/debug/linux/${BRANCH_DIR_SUFFIX}debug_session_linux_helper.cpp
1110
)
1211

12+
if(NEO_ENABLE_i915_PRELIM_DETECTION)
13+
list(APPEND L0_SRCS_DLL_LINUX
14+
${NEO_SOURCE_DIR}/level_zero/tools/source/debug/linux/prelim/debug_session_linux_helper.cpp
15+
)
16+
else()
17+
list(APPEND L0_SRCS_DLL_LINUX
18+
${NEO_SOURCE_DIR}/level_zero/tools/source/debug/linux/debug_session_linux_helper.cpp
19+
)
20+
endif()
21+
1322
set_property(GLOBAL PROPERTY L0_SRCS_DLL_LINUX ${L0_SRCS_DLL_LINUX})

level_zero/core/test/unit_tests/sources/debugger/linux/test_l0_debugger_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,12 @@ TEST_F(L0DebuggerLinuxTest, givenAllocationsWhenAttachingZebinModuleThenAllAlloc
198198
kernelAllocs.push_back(&isaAllocation2);
199199

200200
drmMock->registeredDataSize = 0;
201-
drmMock->registeredClass = NEO::Drm::ResourceClass::MaxSize;
201+
drmMock->registeredClass = NEO::DrmResourceClass::MaxSize;
202202

203203
EXPECT_TRUE(device->getL0Debugger()->attachZebinModuleToSegmentAllocations(kernelAllocs, handle));
204204

205205
EXPECT_EQ(sizeof(uint32_t), drmMock->registeredDataSize);
206-
EXPECT_EQ(NEO::Drm::ResourceClass::L0ZebinModule, drmMock->registeredClass);
206+
EXPECT_EQ(NEO::DrmResourceClass::L0ZebinModule, drmMock->registeredClass);
207207

208208
const auto containsModuleHandle = [handle](const auto &bufferObject) {
209209
const auto &bindExtHandles = bufferObject.getBindExtHandles();

level_zero/tools/source/debug/linux/CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,20 @@ if(UNIX)
88
target_sources(${L0_STATIC_LIB_NAME}
99
PRIVATE
1010
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
11-
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/debug_session.cpp
1211
)
1312

14-
add_subdirectories()
13+
if(NEO_ENABLE_i915_PRELIM_DETECTION)
14+
target_sources(${L0_STATIC_LIB_NAME}
15+
PRIVATE
16+
${CMAKE_CURRENT_SOURCE_DIR}/prelim/debug_session.cpp
17+
${CMAKE_CURRENT_SOURCE_DIR}/prelim/debug_session.h
18+
${CMAKE_CURRENT_SOURCE_DIR}/prelim/drm_helper.cpp
19+
)
20+
else()
21+
target_sources(${L0_STATIC_LIB_NAME}
22+
PRIVATE
23+
${CMAKE_CURRENT_SOURCE_DIR}/debug_session.cpp
24+
)
25+
endif()
26+
1527
endif()

0 commit comments

Comments
 (0)