Debugging “doesNotUnderstand:”

On June 22, 2011, in Support, by Jeremy Jordan

The error “Fatal error: No method found for doesNotUnderstand:” is a fatal error. That means when it occurs, the program will terminate.

The error “Fatal error: No method found for doesNotUnderstand:” is a fatal error. That means when it occurs, the program will terminate. It happens if two prerequisites are met:

  1. An object does not understand a message sent to it because it does not implement or inherit the method.
  2. The same object does not implement or inherit doesNotUnderstand:.

Because doesNotUnderstand: is implemented in Object, condition two above can only happen for objects in a separate class hierarchy, e.g., proxies.

Since this error terminates the program, it cannot easily debug with Smalltalk tools.

Here are some steps to obtain additional information:

Step 1:  Identify objects that fulfill condition two and check for obvious methods that are sent but not implemented.

Remember that debugger and inspector may send messages like class or printOn:. Consider using the BasicInspector instead of Trippy. Consider implementing doesNotUnderstand: for classes that miss it.

Step 2:  Stack dump

If step one above did not turn up anything, start the image with -xq like this:

bin\win\vwnt -xq image\visual.im

Note that the -xq option must be given before the image name to be picked up by the VM.

This will produce a stack dump of all processes when the fatal error happens. The dump will be appended to the file stack.txt in the current working directory. Make sure you look at the correct stack. The file may contain several sections starting with the VM identifier e.g., “VisualWorks® 7.7.1 Jul 7 2010.”

You need to look at the last one. Search for the active process, marked (activeProcess).

'process 0x7e345f08 (activeProcess) priority: 50'

This should help you by providing context information where the fatal message send occurred.

Step 3: C-level debugging

If the stack file does not help you, you can attach a C debugger like gdb or Visual Studio to the process.

Visual[.exe] does not come with debug information; you need to use (for example) vwlinux86. For Windows, you also need to download the symbol files.

The following explanation assumes familiarity with your C debugger. The example instructions are given for gdb. Microsoft debuggers have a menu item “quick watch” where these expressions can be evaluated.

The function doReportError is executed for all fatal errors. Therefore it is an ideal target for a breakpoint when debugging fatal errors. For this specific error, add breakpoints for functions doesNotUnderstandWA and CrtMNUFromPIC. One of these functions is executed when a new doesNotUnderstand error occurs. Note that these functions are also executed in the case when a doesNotUnderstand is handled.

If you want more details on C debugging for doesNotUnderstand, see VisualWorks 7.7.1 Resolution 99744.

We hope this helps with future debugging efforts.

1 Response » to “Debugging “doesNotUnderstand:””

  1. hehehehe cool post. I also faced that problem in Pharo while doing proxies. The error in the squeakVM was “recursive doesNotUnderstood” or something like that.

    And yes, I was doing something hacky with subclases of nil. at least in Pharo #doesNotUnderstand: is not only implemented in Object but also in ProtoObject. So, it is really weird to have direct subclasses from nil but ProtoObject.

Leave a Reply



Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can
take care of it!