How does FORCEINLINE_DEBUGGABLE work?

According to the source code(UE4.26.2)

// Engine/Source/Runtime/Core/Public/Misc/CoreMiscDefines.h
#if UE_BUILD_DEBUG
	#define FORCEINLINE_DEBUGGABLE FORCEINLINE_DEBUGGABLE_ACTUAL
#else
	#define FORCEINLINE_DEBUGGABLE FORCEINLINE
#endif
// Engine/Source/Runtime/Core/Public/HAL/Platform.h
#ifndef FORCEINLINE_DEBUGGABLE_ACTUAL
	#define FORCEINLINE_DEBUGGABLE_ACTUAL inline
#endif

// Engine/Source/Runtime/Core/Public/Windows/WIndowsPlatform.h
#define FORCEINLINE __forceinline									/* Force code to be inline */

So I don’t understand how the macro FORCEINLINE_DEBUGGABLE can make a function inlined but also debuggable.

1 Like

0 information about this.

I think in debug builds its inline but in release__forceinline. idk how that aids debugability.

inline is a soft suggestion while __forceinline is a stronger request but the compiler may still ignore it if inlining is impossible.

So in debug build the code is less likely to be inlined (because it use a soft suggestion), which might aids the debugability.

I used to think that inlined code is not debugable (this is why I asked the question), however it seems modern debuggers can still show some inlined code if debug symbols are enabled.

I think I can close this question.

@NameOccupied You should update the solution before closing, pardon if you were doing it already

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.