Files
eiffel-org/documentation/20.05/eiffelstudio/eiffelstudio-reference/debugger/object-tool/debug-output.wiki
jfiat 0ef958966d create 20.05 branch
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2240 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
2020-05-22 15:25:48 +00:00

17 lines
1.7 KiB
Plaintext

[[Property:title|Debug output]]
[[Property:weight|2]]
[[Property:uuid|41544c3b-e1f1-53a5-ff63-e63224c32fa3]]
For virtually any object displayed in the Object tool, it is possible for the developer to cause the Object tool to display a user-definable string value next to the object address.
In order to have the instances of a class display such a string in the object tool, make the class an heir to class <eiffel>DEBUG_OUTPUT</eiffel>. Then implement the feature <eiffel>debug_output</eiffel> to return the string to be displayed. At run-time, the debugger will automatically query this feature on all objects that define it, and then will display the results in the object tool and the [[Expression evaluation|evaluation tool]].
{{sample|The numeric *<code>_REF</code> classes inherit (through class <eiffel>NUMERIC</eiffel>) from the class <eiffel>DEBUG_OUTPUT</eiffel> so that it is possible to see immediately the value of *<code>_REF</code> objects in the Object tool. The *<code>_REF</code> classes are reference versions of the basic Eiffel classes such as [[ref:libraries/base/reference/kernel/integer_chart.xml|INTEGER]] and [[ref:libraries/base/reference/kernel/classic/double_chart.xml|DOUBLE]]. So, without <eiffel>DEBUG_OUTPUT</eiffel>, if you wanted to see, for example, the value of the [[ref:libraries/base/reference/kernel/integer_chart.xml|INTEGER]] associated with an instance of [[ref:libraries/base/reference/kernel/integer_ref_chart.xml|INTEGER_REF]] displayed in the Object tool, you would have expand the reference first.}}
{{tip|If an object has a long string output or an output with carriage returns, for instance, pick-and-drop it to the expanded display command [[Image:debugger-expand-info-icon]] in the object tool. }}