⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trace

📁 make debug tool. You can use this tool to debug Makefile
💻
字号:
# -*-Perl-*-# $Id: trace,v 1.9 2005/12/24 16:17:52 rockyb Exp $$description = "The following checks tracing.\n";$details = "We test line tracing, showing a target stack, line numbers\n"         . "when we have multiple commands in a target\n";# TEST #1# -------open(MAKEFILE,"> $makefile");# The Contents of the MAKEFILE ...print MAKEFILE <<\EOF;# Test #1 simple tracingall: foofoo:	@echo FOO hereEOF# END of Contents of MAKEFILEclose(MAKEFILE);&run_make_with_options($makefile,"--trace --basename-filenames",                       &get_logfile);# Create the answer to what should be produced by this Makefile$answer = "Reading makefiles...Updating goal targets.... work/debugger/trace.mk:2	File `all' does not exist.   work/debugger/trace.mk:4	File `foo' does not exist.  work/debugger/trace.mk:4	Must remake target `foo'.##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>work/debugger/trace.mk:5: fooecho FOO here##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+ echo FOO hereFOO here  work/debugger/trace.mk:4	Successfully remade target file `foo'.work/debugger/trace.mk:2	Must remake target `all'.work/debugger/trace.mk:2	Successfully remade target file `all'.";# COMPARE RESULTS&compare_output($answer,&get_logfile(1));# TEST #2 Test #2 tracing with multiple commands and show call stack# dump# -------open(MAKEFILE,"> $makefile");# The Contents of the MAKEFILE ...print MAKEFILE <<\EOF;# Test #2 tracing with multiple commands and show call stack dumpall: foofoo:	@echo hi > /dev/null	@exit 5EOF# END of Contents of MAKEFILEclose(MAKEFILE);# We used option --trace in test 1, use short option name -x this time.&run_make_with_options($makefile, "-x -i --basename-filenames",		       &get_logfile);# Create the answer to what should be produced by this Makefile$answer = "Reading makefiles...Updating goal targets.... work/debugger/trace.mk:2	File `all' does not exist.   work/debugger/trace.mk:3	File `foo' does not exist.  work/debugger/trace.mk:3	Must remake target `foo'.##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>work/debugger/trace.mk:4: fooecho hi > /dev/null##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+ echo hi##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>work/debugger/trace.mk:5: fooexit 5##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<+ exit 5work/debugger/trace.mk:5: [foo] Error 5 (ignored)#0  foo at work/debugger/trace.mk:5#1  all at work/debugger/trace.mk:2  work/debugger/trace.mk:3	Successfully remade target file `foo'.work/debugger/trace.mk:2	Must remake target `all'.work/debugger/trace.mk:2	Successfully remade target file `all'.";# COMPARE RESULTS&compare_output($answer,&get_logfile(1));# TEST #3 Test #3 "tracing" vs "silent"# dump# -------open(MAKEFILE,"> $makefile");# The Contents of the MAKEFILE ...print MAKEFILE <<\EOF;# Test #3 "tracing" versus "silent".SILENT: fooall: foofoo:	if [ -n FOO ] ; \	then echo "test okay"; fiEOF# END of Contents of MAKEFILEclose(MAKEFILE);# Shells vary in output. For example, for echo "test okay"# some give 'test okay' while other omit the quotes.# So we'll issue the command that make should issue# and compare against that.# Pick up what the name of the shell is. Perhaps this# should done more globally.my @lines = `echo 'all: ;\@echo \$(SHELL)' | $make_path -f -`;if (@lines < 1) {  return -1;}chomp @lines;# Well, actually we want shell plus tracing.$shell = "$lines[0] -x";# Compute what the output should be for this shell.my $foo_lines = "if [ -n FOO ] ; then echo \"test okay\"; fi";my $foo_output = `echo '$foo_lines' | $shell 2>&1`;chomp $foo_output;# We used option --trace in test 1, use short option name -x this time.&run_make_with_options($makefile, "-x -i --basename-filenames",		       &get_logfile);# Create the answer to what should be produced by this Makefile$answer = "Reading makefiles...Updating goal targets.... work/debugger/trace.mk:4	File `all' does not exist.   work/debugger/trace.mk:6	File `foo' does not exist.  work/debugger/trace.mk:6	Must remake target `foo'.##>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>work/debugger/trace.mk:7: fooif [ -n FOO ] ; \\then echo \"test okay\"; fi##<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<$foo_output  work/debugger/trace.mk:6	Successfully remade target file `foo'.work/debugger/trace.mk:4	Must remake target `all'.work/debugger/trace.mk:4	Successfully remade target file `all'.";# COMPARE RESULTS&compare_output($answer,&get_logfile(1));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -