Dbx problems

FIRTH%TARTAN at CMU-CS-C.ARPA FIRTH%TARTAN at CMU-CS-C.ARPA
Fri Mar 30 06:27:23 AEST 1984


The way one is supposed to call a routine from within Dbx is

	call routine ( arg1, ... )

Unfortunately, there are several problems.  First, such an attempt crashes.
This is due to a bug in "runtime.c", routine "callproc".  The last statement
reads

	cont();

which invokes routine "cont" in "process.c" with a junk actual parameter.  It
may be fixed to

	cont(0);

and the call then works.

However, the called routine behaves oddly with regard to breakpoints.  Any
breakpoint of the form "stop in FUNC" will be ignored; any of the form
"stop at LINE" will be obeyed.  We are still trying to find out why - stay
tuned.

Finally, the call performs a "compatibility" check on formal and actual
arguments.  There are a lot of things that can go wrong here, most of which
concern the types attached to literals by dbx.  The simplest and perhaps
most dangerous solution is to bypass the type checking:

In "runtime.c", routine "pushargs"

change

	argc = evalargs(proc, arglist);
to
	argc = unsafe_evalargs(proc, arglist);

Add a new routine

	private Integer unsafe_evalargs(proc, arglist)
	Symbol proc;
	Node arglist;
	{
	    Node p;
	    Integer count;

	    count = 0;
	    for (p = arglist; p != nil; p = p->value.arg[1]) {
		eval(p->value.arg[0]);
		++count;
	    }

	    return count;
	}

This simply pushes as many args as you provide, as plain values.  If you
are adhering to the Vax convention that all args are exactly one longword
in size, then this should work.  It should also work most of the time for
non-standard actions such as passing Double parameters by immediate value,
provided the called routine knows exactly what to expect.

Please feel free to mail enquiries direct.

Robert Firth
-------



More information about the Comp.unix.wizards mailing list