Unreal Engine : Debugging a Shipping Packaged Build, with -waitforattach option (based on UE4 4.26)

Prerequisite

You need the Engine built from source.
You can not do this with the Launcher version engine.

To make -waitforattach option available in shipping build

Ref: https://unrealcommunity.wiki/debugging-a-packaged-build-o9c2ta8f

You have to commentate these preprocesser directives like below:
(Please ignore very long comment of mine, in the end of line.)

Engine/Source/Runtime/Core/Public/Windows/WindowsPlatformMisc.h

Engine/Source/Runtime/Core/Public/GenericPlatform/GenericPlatformMisc.h

Engine/Source/Runtime/Core/Private/Windows/WindowsPlatformMisc.cpp

Engine/Source/Runtime/Launch/Private/Launch.cpp

Bonus: To make log available in shipping build

Ref: https://forums.unrealengine.com/t/how-to-log-in-shipping-build-win/349171/26

Engine/Source/Runtime/Core/Public/Misc/Build.h

In addition, You have to add “bUseloggingInShipping = true;” into target cs file like this: