2018-04-20 20:44:14 +08:00
|
|
|
/*
|
2021-04-19 19:50:53 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2018-04-20 20:44:14 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-04-20 20:44:14 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2021-04-19 19:50:53 +08:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/debugger/debugger.h"
|
|
|
|
#include "shared/source/os_interface/os_library.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2018-04-20 20:44:14 +08:00
|
|
|
#include <memory>
|
2018-05-02 20:27:55 +08:00
|
|
|
#include <string>
|
2018-04-20 20:44:14 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2020-03-06 02:21:51 +08:00
|
|
|
struct DebugData;
|
2018-04-23 20:26:03 +08:00
|
|
|
|
2020-02-10 22:57:49 +08:00
|
|
|
class SourceLevelDebugger : public Debugger {
|
2018-04-20 20:44:14 +08:00
|
|
|
public:
|
2018-04-23 20:26:03 +08:00
|
|
|
SourceLevelDebugger(OsLibrary *library);
|
2020-02-10 22:57:49 +08:00
|
|
|
~SourceLevelDebugger() override;
|
2018-04-20 20:44:14 +08:00
|
|
|
SourceLevelDebugger(const SourceLevelDebugger &ref) = delete;
|
|
|
|
SourceLevelDebugger &operator=(const SourceLevelDebugger &) = delete;
|
2018-04-23 20:26:03 +08:00
|
|
|
static SourceLevelDebugger *create();
|
2018-04-20 20:44:14 +08:00
|
|
|
|
2021-04-19 19:50:53 +08:00
|
|
|
static bool shouldAppendOptDisable(const SourceLevelDebugger &debugger) {
|
|
|
|
if ((debugger.isOptimizationDisabled() && NEO::DebugManager.flags.DebuggerOptDisable.get() != 0) ||
|
|
|
|
NEO::DebugManager.flags.DebuggerOptDisable.get() == 1) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-10-27 23:00:56 +08:00
|
|
|
MOCKABLE_VIRTUAL bool isDebuggerActive();
|
2018-05-02 20:27:55 +08:00
|
|
|
MOCKABLE_VIRTUAL bool notifyNewDevice(uint32_t deviceHandle);
|
|
|
|
MOCKABLE_VIRTUAL bool notifyDeviceDestruction();
|
|
|
|
MOCKABLE_VIRTUAL bool notifySourceCode(const char *sourceCode, size_t size, std::string &filename) const;
|
|
|
|
MOCKABLE_VIRTUAL bool isOptimizationDisabled() const;
|
2020-03-06 02:21:51 +08:00
|
|
|
MOCKABLE_VIRTUAL bool notifyKernelDebugData(const DebugData *debugData, const std::string &name, const void *isa, size_t isaSize) const;
|
2018-05-02 20:27:55 +08:00
|
|
|
MOCKABLE_VIRTUAL bool initialize(bool useLocalMemory);
|
2018-04-20 20:44:14 +08:00
|
|
|
|
2020-08-24 15:27:30 +08:00
|
|
|
void captureStateBaseAddress(CommandContainer &container, SbaAddresses sba) override{};
|
2020-07-27 23:37:51 +08:00
|
|
|
|
2018-04-20 20:44:14 +08:00
|
|
|
protected:
|
|
|
|
class SourceLevelDebuggerInterface;
|
2018-04-23 20:26:03 +08:00
|
|
|
SourceLevelDebuggerInterface *sourceLevelDebuggerInterface = nullptr;
|
2018-04-20 20:44:14 +08:00
|
|
|
|
|
|
|
static OsLibrary *loadDebugger();
|
|
|
|
void getFunctions();
|
|
|
|
|
|
|
|
std::unique_ptr<OsLibrary> debuggerLibrary;
|
|
|
|
bool isActive = false;
|
2018-05-02 20:27:55 +08:00
|
|
|
uint32_t deviceHandle = 0;
|
2018-04-20 20:44:14 +08:00
|
|
|
|
|
|
|
static const char *notifyNewDeviceSymbol;
|
|
|
|
static const char *notifySourceCodeSymbol;
|
|
|
|
static const char *getDebuggerOptionSymbol;
|
|
|
|
static const char *notifyKernelDebugDataSymbol;
|
|
|
|
static const char *initSymbol;
|
2018-04-23 20:26:03 +08:00
|
|
|
static const char *isDebuggerActiveSymbol;
|
2018-05-02 20:27:55 +08:00
|
|
|
static const char *notifyDeviceDestructionSymbol;
|
2018-04-20 20:44:14 +08:00
|
|
|
// OS specific library name
|
|
|
|
static const char *dllName;
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|