Kernel Source Level debugger support 4/n

- adding DebugSurface allocation and setup
- unit tests refactors:
  - mock kernel with kernel debug option
  - separating fixtures to headers
  - added helper for getting internal-options kernels
    filenames

Change-Id: I7b6f4d46e2ab7cff0da8d5212483f44ae0d4be31
This commit is contained in:
Hoppe, Mateusz
2018-03-21 12:58:30 +01:00
committed by sys_ocldev
parent 7b1fd38fe6
commit 7f32eb06d1
20 changed files with 372 additions and 59 deletions

View File

@ -30,35 +30,6 @@
using namespace OCLRT;
class MockDebugKernel : public MockKernel {
public:
MockDebugKernel(Program *program, KernelInfo &kernelInfo, const Device &device) : MockKernel(program, kernelInfo, device) {
if (!kernelInfo.patchInfo.pAllocateSystemThreadSurface) {
SPatchAllocateSystemThreadSurface *patchToken = new SPatchAllocateSystemThreadSurface;
patchToken->BTI = 0;
patchToken->Offset = 0;
patchToken->PerThreadSystemThreadSurfaceSize = MockDebugKernel::perThreadSystemThreadSurfaceSize;
patchToken->Size = sizeof(SPatchAllocateSystemThreadSurface);
patchToken->Token = iOpenCL::PATCH_TOKEN_ALLOCATE_SIP_SURFACE;
kernelInfo.patchInfo.pAllocateSystemThreadSurface = patchToken;
systemThreadSurfaceAllocated = true;
}
}
~MockDebugKernel() override {
if (systemThreadSurfaceAllocated) {
delete kernelInfo.patchInfo.pAllocateSystemThreadSurface;
}
}
static const uint32_t perThreadSystemThreadSurfaceSize;
bool systemThreadSurfaceAllocated = false;
};
const uint32_t MockDebugKernel::perThreadSystemThreadSurfaceSize = 0x100;
TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) {
std::unique_ptr<MockDevice> device(new MockDevice(*platformDevices[0]));
MockProgram program;