Files
compute-runtime/shared/source/device_binary_format/debug_zebin.h
Krystian Chmielewski 1417e894c7 Create debug zebin
Creates copy of zebinary with program headers containing
addresses of segments and applies debug relocations.


Related-To: NEO-6071
Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
2021-09-15 13:56:38 +02:00

37 lines
1.1 KiB
C++

/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/device_binary_format/elf/zebin_elf.h"
#include "shared/source/utilities/arrayref.h"
#include "shared/source/utilities/stackvec.h"
#include <limits>
#include <string>
#include <unordered_map>
#include <vector>
namespace NEO {
namespace Debug {
struct GPUSegments {
struct Segment {
uintptr_t gpuAddress = std::numeric_limits<uintptr_t>::max();
ArrayRef<const uint8_t> data;
};
using KernelNameToSectionIdMap = std::unordered_map<std::string, size_t>;
Segment varData;
Segment constData;
StackVec<Segment, 8> kernels;
KernelNameToSectionIdMap nameToSectIdMap;
};
void patch(uint64_t addr, uint64_t value, NEO::Elf::RELOC_TYPE_ZEBIN type);
void patchDebugZebin(std::vector<uint8_t> &debugZebin, const GPUSegments &segmentData);
std::vector<uint8_t> createDebugZebin(ArrayRef<const uint8_t> zebin, const GPUSegments &segmentData);
std::vector<uint8_t> getDebugZebin(ArrayRef<const uint8_t> zebin, const GPUSegments &segmentData);
} // namespace Debug
} // namespace NEO