sun-3 dbx, arguments, hacking, help...

Guy Harris guy at gorodish.Sun.COM
Tue Apr 26 02:05:20 AEST 1988


> 	HELP!!!  I need to know how `dbx' knows how many arguments are on the
> stack when you do the `where' command on a SUN 3.

By looking at the code following the call to see how many bytes it pops off the
stack.  (I checked the "dbx" source.)

> 	Now,  dbx KNOWS how many 4 byte arguments are there.  You do not have
> to compile with -g,   and it does not look in a symbol table and see how many
> are supposed to be there,   it knows even for function with a variable number
> of arguments.  Try the following program:

I did, and discovered that it does *not* get the argument count right on the
last call, because, as you indicate, the optimizer gets rid of the
stack-cleaning code.  It thinks "go" was called with zero arguments in the last
call.

> P.S.
> 	This will probably be impossible on a SUN-4

Make that "certainly will be impossible on a Sun-4", or on any other machine
that 1) passes arguments in registers and 2) has a compiler that does
sufficient optimization.  Perhaps not impossible, but at least *extremely*
difficult.



More information about the Comp.unix.wizards mailing list