Debugging a Program With dbx

Evaluating Unnamed Arguments in C++ Programs

C++ allows you to define functions with unnamed arguments. For example:


void tester(int)
{
};
main(int, char **)
{
   tester(1);
};

Though you cannot use unnamed arguments elsewhere in a program, dbx encodes unnamed arguments in a form that allows you to evaluate them. The form is:


_ARG_%n_

where dbx assigns an integer to %n.

To obtain an assigned argument name from dbx, issue the whatis command with the function name as its target:


(dbx) whatis tester
void tester(int _ARG_0_);
(dbx) whatis main
int main(int _ARG_1_, char **_ARG_2_);

To evaluate (or display) an unnamed function argument,


(dbx) print _ARG_1_
_ARG_1_ = 4