mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
feature(debugger): Create DebugSessionLinux class
DebugSessionLinux is common base class for all linux dbgUMD implementations. This patch also moves DrmHelper to common debug folder Related-to: NEO-8404 Signed-off-by: Brandon Yates <brandon.yates@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
69f614a8c2
commit
157d7a327a
@@ -9,6 +9,7 @@ if(UNIX)
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/debug_session.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/debug_session.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/drm_helper.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NEO_ENABLE_i915_PRELIM_DETECTION)
|
if(NEO_ENABLE_i915_PRELIM_DETECTION)
|
||||||
@@ -16,7 +17,6 @@ if(UNIX)
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/prelim/debug_session.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/prelim/debug_session.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/prelim/debug_session.h
|
${CMAKE_CURRENT_SOURCE_DIR}/prelim/debug_session.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/prelim/drm_helper.cpp
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||||
|
|
||||||
#include "level_zero/core/source/device/device.h"
|
#include "level_zero/core/source/device/device.h"
|
||||||
|
#include "level_zero/tools/source/debug/linux/debug_session.h"
|
||||||
#include "level_zero/tools/source/debug/linux/debug_session_factory.h"
|
#include "level_zero/tools/source/debug/linux/debug_session_factory.h"
|
||||||
|
|
||||||
namespace L0 {
|
namespace L0 {
|
||||||
@@ -51,4 +52,22 @@ DebugSession *DebugSession::create(const zet_debug_config_t &config, Device *dev
|
|||||||
}
|
}
|
||||||
return debugSession;
|
return debugSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ze_result_t DebugSessionLinux::translateDebuggerOpenErrno(int error) {
|
||||||
|
|
||||||
|
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
switch (error) {
|
||||||
|
case ENODEV:
|
||||||
|
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||||
|
break;
|
||||||
|
case EBUSY:
|
||||||
|
result = ZE_RESULT_ERROR_NOT_AVAILABLE;
|
||||||
|
break;
|
||||||
|
case EACCES:
|
||||||
|
result = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace L0
|
} // namespace L0
|
||||||
|
|||||||
17
level_zero/tools/source/debug/linux/debug_session.h
Normal file
17
level_zero/tools/source/debug/linux/debug_session.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "level_zero/tools/source/debug/debug_session.h"
|
||||||
|
#include "level_zero/tools/source/debug/debug_session_imp.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
struct DebugSessionLinux : DebugSessionImp {
|
||||||
|
|
||||||
|
DebugSessionLinux(const zet_debug_config_t &config, Device *device) : DebugSessionImp(config, device){};
|
||||||
|
static ze_result_t translateDebuggerOpenErrno(int error);
|
||||||
|
};
|
||||||
|
} // namespace L0
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "level_zero/tools/source/debug/linux/prelim/drm_helper.h"
|
#include "level_zero/tools/source/debug/linux/drm_helper.h"
|
||||||
|
|
||||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||||
#include "shared/source/os_interface/linux/engine_info.h"
|
#include "shared/source/os_interface/linux/engine_info.h"
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2022 Intel Corporation
|
* Copyright (C) 2022-2023 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
|
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
|
||||||
#include "level_zero/include/zet_intel_gpu_debug.h"
|
#include "level_zero/include/zet_intel_gpu_debug.h"
|
||||||
#include "level_zero/tools/source/debug/linux/debug_session_factory.h"
|
#include "level_zero/tools/source/debug/linux/debug_session_factory.h"
|
||||||
#include "level_zero/tools/source/debug/linux/prelim/drm_helper.h"
|
#include "level_zero/tools/source/debug/linux/drm_helper.h"
|
||||||
#include <level_zero/ze_api.h>
|
#include <level_zero/ze_api.h>
|
||||||
|
|
||||||
#include "common/StateSaveAreaHeader.h"
|
#include "common/StateSaveAreaHeader.h"
|
||||||
@@ -41,7 +41,7 @@ static DebugSessionLinuxPopulateFactory<DEBUG_SESSION_LINUX_TYPE_I915, DebugSess
|
|||||||
|
|
||||||
DebugSession *createDebugSessionHelper(const zet_debug_config_t &config, Device *device, int debugFd, void *params);
|
DebugSession *createDebugSessionHelper(const zet_debug_config_t &config, Device *device, int debugFd, void *params);
|
||||||
|
|
||||||
DebugSessionLinuxi915::DebugSessionLinuxi915(const zet_debug_config_t &config, Device *device, int debugFd, void *params) : DebugSessionImp(config, device), fd(debugFd) {
|
DebugSessionLinuxi915::DebugSessionLinuxi915(const zet_debug_config_t &config, Device *device, int debugFd, void *params) : DebugSessionLinux(config, device), fd(debugFd) {
|
||||||
ioctlHandler.reset(new IoctlHandler);
|
ioctlHandler.reset(new IoctlHandler);
|
||||||
|
|
||||||
if (params) {
|
if (params) {
|
||||||
@@ -81,28 +81,11 @@ DebugSession *DebugSessionLinuxi915::createLinuxSession(const zet_debug_config_t
|
|||||||
auto reason = DrmHelper::getErrno(device);
|
auto reason = DrmHelper::getErrno(device);
|
||||||
PRINT_DEBUGGER_ERROR_LOG("PRELIM_DRM_IOCTL_I915_DEBUGGER_OPEN failed: open.pid: %d, open.events: %d, retCode: %d, errno: %d\n",
|
PRINT_DEBUGGER_ERROR_LOG("PRELIM_DRM_IOCTL_I915_DEBUGGER_OPEN failed: open.pid: %d, open.events: %d, retCode: %d, errno: %d\n",
|
||||||
open.pid, open.events, debugFd, reason);
|
open.pid, open.events, debugFd, reason);
|
||||||
result = DebugSessionLinuxi915::translateDebuggerOpenErrno(reason);
|
result = translateDebuggerOpenErrno(reason);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ze_result_t DebugSessionLinuxi915::translateDebuggerOpenErrno(int error) {
|
|
||||||
|
|
||||||
ze_result_t result = ZE_RESULT_ERROR_UNKNOWN;
|
|
||||||
switch (error) {
|
|
||||||
case ENODEV:
|
|
||||||
result = ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
|
||||||
break;
|
|
||||||
case EBUSY:
|
|
||||||
result = ZE_RESULT_ERROR_NOT_AVAILABLE;
|
|
||||||
break;
|
|
||||||
case EACCES:
|
|
||||||
result = ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DebugSessionLinuxi915::ioctl(unsigned long request, void *arg) {
|
int DebugSessionLinuxi915::ioctl(unsigned long request, void *arg) {
|
||||||
return ioctlHandler->ioctl(fd, request, arg);
|
return ioctlHandler->ioctl(fd, request, arg);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "level_zero/core/source/device/device_imp.h"
|
#include "level_zero/core/source/device/device_imp.h"
|
||||||
#include "level_zero/tools/source/debug/debug_session.h"
|
#include "level_zero/tools/source/debug/debug_session.h"
|
||||||
#include "level_zero/tools/source/debug/debug_session_imp.h"
|
#include "level_zero/tools/source/debug/debug_session_imp.h"
|
||||||
|
#include "level_zero/tools/source/debug/linux/debug_session.h"
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@@ -30,7 +31,7 @@ struct EngineClassInstance;
|
|||||||
namespace L0 {
|
namespace L0 {
|
||||||
struct TileDebugSessionLinuxi915;
|
struct TileDebugSessionLinuxi915;
|
||||||
|
|
||||||
struct DebugSessionLinuxi915 : DebugSessionImp {
|
struct DebugSessionLinuxi915 : DebugSessionLinux {
|
||||||
|
|
||||||
friend struct TileDebugSessionLinuxi915;
|
friend struct TileDebugSessionLinuxi915;
|
||||||
|
|
||||||
@@ -171,8 +172,6 @@ struct DebugSessionLinuxi915 : DebugSessionImp {
|
|||||||
std::unordered_map<uint64_t, Module> uuidToModule;
|
std::unordered_map<uint64_t, Module> uuidToModule;
|
||||||
};
|
};
|
||||||
|
|
||||||
static ze_result_t translateDebuggerOpenErrno(int error);
|
|
||||||
|
|
||||||
constexpr static uint64_t invalidClientHandle = std::numeric_limits<uint64_t>::max();
|
constexpr static uint64_t invalidClientHandle = std::numeric_limits<uint64_t>::max();
|
||||||
constexpr static uint64_t invalidHandle = std::numeric_limits<uint64_t>::max();
|
constexpr static uint64_t invalidHandle = std::numeric_limits<uint64_t>::max();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user