You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Allows fast iteration of C++ changes without restarting the application. To use, select the "Live Coding (Experimental)" mode from the drop down menu next to the editor's compile button, or type "LiveCoding" into the console for a monolithic build. Press Ctrl+Alt+F11 to find changes and compile.
Changes vs standalone Live++ version:
* UBT is used to execute builds. This allows standard UE4 adaptive unity mode, allows us to reuse object files when we do regular builds, supports using any build executor allowed by UBT (XGE, SNDBS, etc..).
* Adding new source files is supported.
* Custom visualizer for FNames is supported via a weakly linked symbol in a static library (Engine/Extras/NatvisHelpers).
* Settings are exposed in the editor's project settings dialog.
* Standalone application has been rewritten as a Slate app ("LiveCodingConsole"). There is an additional option to start the program as hidden, where it will not be visible until Ctrl+Alt+F11 is hit. Similarly, closing the window will hide it instead of closing the application.
* Does not require a standalone licensed version of Live++.
Known issues:
* Does not currently support class layout changes / object reinstancing
#rb none
#fyi Marc.Audy, Stefan.Boberg, Nick.Penwarden
#jira
[CL 5304722 by Ben Marsh in 4.22 branch]
85 lines
2.1 KiB
C++
85 lines
2.1 KiB
C++
// Copyright 2011-2019 Molecular Matters GmbH, all rights reserved.
|
|
|
|
#include "LC_Disassembler.h"
|
|
#include "LC_PointerUtil.h"
|
|
#include "LC_Platform.h"
|
|
#include "LC_Logging.h"
|
|
#include "distorm.h"
|
|
|
|
|
|
namespace
|
|
{
|
|
// an x86/x64 instruction is at most 16 bytes long
|
|
static const size_t LONGEST_X86_INSTRUCTION = 16u;
|
|
}
|
|
|
|
|
|
size_t disassembler::FindInstructionSize(process::Handle processHandle, const void* address)
|
|
{
|
|
uint8_t code[LONGEST_X86_INSTRUCTION] = {};
|
|
process::ReadProcessMemory(processHandle, address, code, LONGEST_X86_INSTRUCTION);
|
|
|
|
_CodeInfo codeInfo = {};
|
|
codeInfo.code = code;
|
|
codeInfo.codeLen = LONGEST_X86_INSTRUCTION;
|
|
codeInfo.codeOffset = pointer::AsInteger<uint64_t>(address);
|
|
|
|
#if LC_64_BIT
|
|
codeInfo.dt = Decode64Bits;
|
|
#else
|
|
codeInfo.dt = Decode32Bits;
|
|
#endif
|
|
|
|
_DInst result = {};
|
|
unsigned int instructionCount = 0u;
|
|
distorm_decompose(&codeInfo, &result, 1u, &instructionCount);
|
|
|
|
if (instructionCount == 0u)
|
|
{
|
|
// something went horribly wrong
|
|
LC_ERROR_DEV("Could not disassemble instruction at 0x%p", address);
|
|
return 0u;
|
|
}
|
|
|
|
if (result.flags == FLAG_NOT_DECODABLE)
|
|
{
|
|
// the opcode could not be decoded
|
|
LC_ERROR_DEV("Could not decode instruction at 0x%p", address);
|
|
return 0u;
|
|
}
|
|
|
|
return result.size;
|
|
}
|
|
|
|
|
|
const void* disassembler::FindPreviousInstructionAddress(process::Handle processHandle, const void* functionStart, const void* instructionAddress)
|
|
{
|
|
// starting at the function, disassemble instructions until we arrive at the given address
|
|
const void* currentAddress = functionStart;
|
|
for (;;)
|
|
{
|
|
const size_t currentSize = FindInstructionSize(processHandle, currentAddress);
|
|
if (currentSize == 0u)
|
|
{
|
|
// something went wrong
|
|
break;
|
|
}
|
|
|
|
const void* previousAddress = currentAddress;
|
|
currentAddress = pointer::Offset<const void*>(currentAddress, currentSize);
|
|
if (currentAddress == instructionAddress)
|
|
{
|
|
// we just decoded the instruction right before the given address
|
|
return previousAddress;
|
|
}
|
|
|
|
if (currentAddress > instructionAddress)
|
|
{
|
|
// something went wrong, we should arrive *exactly* at the given address
|
|
break;
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|