Next: , Previous: , Up: Stack   [Contents][Index]


4.6.2 Backtraces (‘where’)

A backtrace is essentially the same as the call stack: a summary of how your script got where it is. It shows one line per frame, for many frames, starting with the place that you are stopped at (frame zero), followed by its caller (frame one), and on up the stack.

If GNU Remake is in the reading phase the backtrace shows the nesting of include files. If GNU Remake is in the interpretation phase the backtrace shows the nesting of targets.

where
backtrace
bt
T

If we are reading Makefiles, print a backtrace of the included Makefile stack. If we are evaluating the Makefile to bring targets up to date, print a backtrace of the target stack. In either case, we print line per frame.

where n
backtrace n
bt n
T n

Similar, but print only the innermost n frames. A negative number prints the outermost n frames.

Each line in the backtrace shows the frame number and the function name, the source file name and line number, as well as the function name.

Here is an example of a backtrace taken a program in the regression-tests parm.sh.

./make -X

/tmp/remake/src/Makefile:228: Makefile.in
remake<0> step

/tmp/remake/src/Makefile:263: make
remake<1> where

=>#0  make at /tmp/remake/src/Makefile:263
  #1  all-am at /tmp/remake/src/Makefile:386
  #2  all at /tmp/remake/src/Makefile:224

However if we have set debugging to stop before reading makefiles are we are in the reading phase, we show included Makefiles:

$ ./make –debugger=preread
Reading makefiles...
Reading makefile `Makefile'...

(/tmp/remake/src/Makefile:1)
remake<0> step
/tmp/remake/src/Makefile:324
	Reading makefile `.deps/alloca.Po' (search path) (no ~ expansion)...

(/tmp/remake/src/.deps/alloca.Po:1)
remake<1> where

=>#0  /tmp/remake/src/.deps/alloca.Po:1
  #1  /tmp/remake/src/Makefile:324

remake<2> next
/tmp/remake/src/Makefile:327
	Reading makefile `.deps/getloadavg.Po' (search path) (no ~ expansion)...
/tmp/remake/src/Makefile:328
	Reading makefile `.deps/ar_fns.Po' (search path) (no ~ expansion)...
/tmp/remake/src/Makefile:329

... lots of lines deleted ...

	Reading makefile `.deps/version.Po' (search path) (no ~ expansion)...
/tmp/remake/src/Makefile:360
	Reading makefile `.deps/vpath.Po' (search path) (no ~ expansion)...
Updating goal targets....
 /tmp/remake/src/Makefile:254	File `all' does not exist.

(/tmp/remake/src/Makefile:254): all
remake<3>

Note in the above ‘step’ goes on to the next read of a makefile while the ‘next’ command can be used to skip over all of the remaining reads.


Next: , Previous: , Up: Stack   [Contents][Index]