Files
UnrealEngineUWP/Engine/Source/Runtime/UniversalObjectLocator/Public/UniversalObjectLocatorFragmentDebugging.h
andrew rodham b431317bf4 Improved visualizers for UOL fragments
Previously the visualizers used a method that had side-effects that required manual re-evaluation by the user. These have now been updated to use a side-effects-free method by emplacing a polymorphic vfptr in front of the fragment, along with the newly introduced FVisualizerDebuggingState to provide a much simpler and more intuitive debugging view for UOLs.

#rb David.Bromberg

[CL 35866960 by andrew rodham in ue5-main branch]
2024-08-28 10:40:36 -04:00

42 lines
1.0 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreTypes.h"
#ifndef UE_UNIVERSALOBJECTLOCATOR_DEBUG
#define UE_UNIVERSALOBJECTLOCATOR_DEBUG !UE_BUILD_SHIPPING
#endif
#if UE_UNIVERSALOBJECTLOCATOR_DEBUG
namespace UE::UniversalObjectLocator
{
/**
* Type whose sole purpose is to add a vtable pointer in front of a fragment
* to assist in debugging. When allocating the fragment, a TFragmentPayload<T>
* is allocated in the preceeding 8 bytes which can be used by a natvis expression
* to show the proceeding bytes as a (T*)
*/
struct alignas(8) IFragmentPayload
{
virtual ~IFragmentPayload()
{
}
};
/**
* Templated version of IFragmentPayload that is added to the start of a fragment.
* Utilizes a zero-sized array to cast the proceeding bytes to a T*.
*/
template<typename T>
struct TFragmentPayload : IFragmentPayload
{
UE_NO_UNIQUE_ADDRESS uint8 Ptr[];
};
} // namespace UE::UniversalObjectLocator
#endif // UE_UNIVERSALOBJECTLOCATOR_DEBUG