Strange behavior when debugging Eclipse CDT with Eclipse Debugger

Sadik :

When debugging Eclipse CDT code I witnessed a strange behavior. I try to explain it with screen-shots. I am sure people who don't know CDT can still give me an answer to this question, because I think it's related to (debugging) Java code with Eclipse in general.

The IIndexFile file you see in the highlighted line will have a field with a wrong value and I try to understand where that value comes from.

Before entering getFile():

getFile() will be called

Inside getFile() a new PDOMFile is created. The constructor with two parameters is called: enter image description here

Shortly before leaving the constructor we can see on the right side that location is null. Not surprising, as it hasn't been set yet. enter image description here

The next image shows the first thing that surprises me a bit. When leaving the constructor for PDOMFILE I actually expect the debugger to tell me the return value. Instead it says No explicit return value. Maybe it's because it was a constructor or maybe it's because of the if-statement. enter image description here

Now the highlighted line shows that the dubber is back from the call getFile(), but the assignment to file hasn't been done yet. We can see that the location field is still null. enter image description here

And this is what I don't understand. Why is location from file set now?

enter image description here

HighCommander4 :

The debugger calls toString() to obtain the string displayed in the bottom pane of the "Variables" view. PDOMFile.toString() calls getLocation() which sets location on its first call.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325509&siteId=1