I looked at this a few years ago. The debug_backtrace function was the only method I came up with back then also. Another method could be to share a token which is known only to the Machine and Widget classes but that requires some degree of physical separation between them and any "foreign" classes which oughtn't to be able to instantiate a Widget.

Is this for a plugin system?