Download

vs2017 - can't get any useful info from the debugger

Whenever I try to watch a value of a function in the watch window I get and error like this:


Function XXX has no address, possibly due to compiler optimizations.

For example, with the 3rd person template:


       
this->GetName()    Function UObjectBaseUtility::GetName has no address, possibly due to compiler optimizations.    
GetCapsuleComponent()    Function ACharacter::GetCapsuleComponent has no address, possibly due to compiler optimizations.    
GetCharacterMovement()    Function ACharacter::GetCharacterMovement has no address, possibly due to compiler optimizations.    
FollowCamera->CameraMesh->GetBounds()    Function UStaticMesh::GetBounds has no address, possibly due to compiler optimizations.


I’m using vs2017.4.4 and ue18.1
I tried using a project created from the launcher with the Debug Game configuration.
I tried building the engine from source with the Debug Game configuration and targeting that build with a project.
nothing works.

How do I turn off optimizations, if that is indeed the problem?

thanks.

This is because of optimization routines; Here is the answer you seek: Problems with VS2015, and Optimized code - UE4 AnswerHub

I usually surround my functions with those pragmas during test and see all the vars.

That didn’t work.
I used the Debug Editor configuration (Build.bat UE4Editor Win64 Debug -waitmutex), put the pragma directive at the top of the file (Character.cpp), but am still getting the optimization errors when debugging.
Shouldn’t optimizations be off anyway, just by selecting the Debug build configuration?

You should surround your functions with those detectives. It definitely works. Without them, even debug, will be optimized.

I tried surrounding the code with the pragmas, but that still didn’t work.
I don’t think that is the correct path, though. The pragmas are just a way to override compiler switches, which should be set correctly while building a debug config.
Also, they will only not-optimize the code within their scope. That doesn’t affect the engine code which has already been built and optimized.

You must surround the actual functions, not the calls to those functions. If those are engine functions, you must rebuild engine from source, and surround the function implementation in there. Well, it always works for me, could be that I am missing the point of your actual problem here. Maybe someone else will assist