Trace on Variable assignment

Sean Hinde Sean.Hinde@REDACTED
Fri Nov 3 20:02:04 CET 2000

> > What about a guard: watch/1 which could be combined with 
> > the trace bif ? 

OK, I thought a bit more about what I am asking for, looked at the beam
assembly from a tiny program to see what is held about variable names
(nothing), and reflected on how this might be implemented.

I guess what I am asking for is pretty compiler/emulator unfriendly, which
is why we have source level debuggers after all :)

Some possibilities:

1) Tobbes watch/1 guard. This would make it easier to add trace
possibilities in production code for key variables (gen_server States for
example). A compiler option could force this to be included for every
variable assignment in a module, much like the old trace option for local
function calls. It also doesn't allow tracing of A in:

	{A, B} = case lic(X,Y) of
			X1 when X1 < 0 ->
				{1, X1};
			X2 ->
				{2, X2}

2) Something which could be added as an option to the existing function
call/signal trace mechanism to also send contents of selected current
variables. This would partly solve the triggering problem, though not which
data goes with which variable name, and no good for return values or
anywhere else where there is no following function call.

3) A compiler option which includes the variable name data in the relevant
places and invokes different beam ops which check for tracing every time a
new value is stored in whatever place the runtime stores these things.

- Sean

This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.

More information about the erlang-questions mailing list