From 2914b27bda58c4fef415dcf634c5b1d41cf86ba3 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sun, 27 Jan 2002 15:20:33 +0000 Subject: [PATCH] Add a --debug=pdb option to run SCons under the Python debugger. git-svn-id: http://scons.tigris.org/svn/scons/trunk@226 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- doc/man/scons.1 | 42 ++++++++++++++++++----------- src/CHANGES.txt | 2 ++ src/engine/SCons/Script/__init__.py | 16 ++++++++++- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/doc/man/scons.1 b/doc/man/scons.1 index cadc7b89..69da1005 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -31,7 +31,7 @@ .RE .fi .. -.TH SCONS 1 "December 2001" +.TH SCONS 1 "January 2002" .SH NAME scons \- software constructor .SH SYNOPSIS @@ -274,13 +274,25 @@ in the specified directory.) .TP .RI --debug= type -Print debugging information durring the build process. +Debug the build process. .I type -specifies what type of of debugging information to print. Currently the -only supported type is -.I tree -which causes the dependency tree to be printed after each top-level -target is built. +specifies what type of debugging: + +.TP +.RI --debug=pdb +Re-run SCons under the control of the +.RI pdb +Python debugger. +The +.RI --debug=pdb +argument will be stripped from the command-line, +but all other arguments will be passed in-order +to the SCons invocation run by the debugger. + +.TP +.RI --debug=tree +Print the dependency tree +after each top-level target is built. .TP -e, --environment-overrides @@ -727,7 +739,7 @@ The list of directories that the C preprocessor will search for include directories. The C/C++ implicit dependency scanner will search these directories for include files. Don't explicitly put include directory arguments in CCFLAGS or CXXFLAGS because the result will be non-portable -and the directories will not be searched by the depedency scanner. Note: +and the directories will not be searched by the dependency scanner. Note: directory names in CPPPATH will be looked-up relative to the SConscript directory when they are used in a command. To force .B scons @@ -763,7 +775,7 @@ Note that, by default, .B scons does .I not -propogate the environment in force when you +propagate the environment in force when you execute .B scons to the commands used to build target files. @@ -773,11 +785,11 @@ variables set at the time .B scons is invoked. -If you want to propogate your +If you want to propagate your environment variables to the commands executed to build target files, -you must do so explictly: +you must do so explicitly: .ES import os @@ -785,7 +797,7 @@ env = Environment(ENV = os.environ) .EE .RS -Note that you can choose only to propogate +Note that you can choose only to propagate certain environment variables. A common example is the system @@ -932,14 +944,14 @@ is usually safe, and is always more efficient than .RI Default( targets ) This specifies a list of default targets. Default targets will be built by .B scons -if no explicit targets are given on the comamnd line. Multiple targets can +if no explicit targets are given on the command line. Multiple targets can be specified either as a space delimited string of target file names or as -seperate arguments. +separate arguments. Target names with white space may be be enclosed in an array to prevent the string from being split into separate file names. .BR Default () -will also accept the return value of any of the ccnstruction environment +will also accept the return value of any of the construction environment builder methods. Example: diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f3812417..05c4b81c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -63,6 +63,8 @@ RELEASE 0.04 - and updating multiple targets in a single Task. Simplify the interface between Task and Taskmaster. + - Add a --debug=pdb option to re-run SCons under the Python debugger. + From Steve Leblanc: - Add var=value command-line arguments. diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index 12a22f49..0416b629 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -361,7 +361,21 @@ def options_init(): def opt_debug(opt, arg): global print_tree - if arg == "tree": + if arg == "pdb": + if sys.platform == 'win32': + lib_dir = os.path.join(sys.exec_prefix, "lib") + else: + lib_dir = os.path.join(sys.exec_prefix, + "lib", + "python" + sys.version[0:3]) + args = [ sys.executable, os.path.join(lib_dir, "pdb.py") ] + \ + filter(lambda x: x != "--debug=pdb", sys.argv) + if sys.platform == 'win32': + ret = os.spawnve(os.P_WAIT, cmd_interp, args, env) + sys.exit(ret) + else: + os.execvpe(args[0], args, os.environ) + elif arg == "tree": print_tree = 1 else: sys.stderr.write("Warning: %s is not a valid debug type\n" -- 2.26.2