diff --git a/hphp/runtime/base/runtime_option.cpp b/hphp/runtime/base/runtime_option.cpp index 2ed9451e8..c8a1877ce 100644 --- a/hphp/runtime/base/runtime_option.cpp +++ b/hphp/runtime/base/runtime_option.cpp @@ -361,6 +361,7 @@ bool RuntimeOption::CheckSymLink = false; int RuntimeOption::ScannerType = 0; int RuntimeOption::MaxUserFunctionId = (2 * 65536); bool RuntimeOption::EnableFinallyStatement = false; +bool RuntimeOption::EnableArgsInBacktraces = true; // Initializers for Eval flags. static inline bool evalJitDefault() { @@ -1162,61 +1163,65 @@ void RuntimeOption::Load(Hdf &config, StringVec *overwrites /* = NULL */, DebuggerRpcHostDomain = debugger["RPC.HostDomain"].getString(); DebuggerDefaultRpcTimeout = debugger["RPC.DefaultTimeout"].getInt32(30); } - } - { - Hdf repo = config["Repo"]; { - Hdf repoLocal = repo["Local"]; - // Repo.Local.Mode. - RepoLocalMode = repoLocal["Mode"].getString(); - if (!empty && RepoLocalMode.empty()) { - const char* HHVM_REPO_LOCAL_MODE = getenv("HHVM_REPO_LOCAL_MODE"); - if (HHVM_REPO_LOCAL_MODE != nullptr) { - RepoLocalMode = HHVM_REPO_LOCAL_MODE; + Hdf repo = config["Repo"]; + { + Hdf repoLocal = repo["Local"]; + // Repo.Local.Mode. + RepoLocalMode = repoLocal["Mode"].getString(); + if (!empty && RepoLocalMode.empty()) { + const char* HHVM_REPO_LOCAL_MODE = getenv("HHVM_REPO_LOCAL_MODE"); + if (HHVM_REPO_LOCAL_MODE != nullptr) { + RepoLocalMode = HHVM_REPO_LOCAL_MODE; + } + } + if (RepoLocalMode.empty()) { + RepoLocalMode = "r-"; + } + if (RepoLocalMode.compare("rw") + && RepoLocalMode.compare("r-") + && RepoLocalMode.compare("--")) { + Logger::Error("Bad config setting: Repo.Local.Mode=%s", + RepoLocalMode.c_str()); + RepoLocalMode = "rw"; + } + // Repo.Local.Path. + RepoLocalPath = repoLocal["Path"].getString(); + if (!empty && RepoLocalPath.empty()) { + const char* HHVM_REPO_LOCAL_PATH = getenv("HHVM_REPO_LOCAL_PATH"); + if (HHVM_REPO_LOCAL_PATH != nullptr) { + RepoLocalPath = HHVM_REPO_LOCAL_PATH; + } } } - if (RepoLocalMode.empty()) { - RepoLocalMode = "r-"; + { + Hdf repoCentral = repo["Central"]; + // Repo.Central.Path. + RepoCentralPath = repoCentral["Path"].getString(); } - if (RepoLocalMode.compare("rw") - && RepoLocalMode.compare("r-") - && RepoLocalMode.compare("--")) { - Logger::Error("Bad config setting: Repo.Local.Mode=%s", - RepoLocalMode.c_str()); - RepoLocalMode = "rw"; - } - // Repo.Local.Path. - RepoLocalPath = repoLocal["Path"].getString(); - if (!empty && RepoLocalPath.empty()) { - const char* HHVM_REPO_LOCAL_PATH = getenv("HHVM_REPO_LOCAL_PATH"); - if (HHVM_REPO_LOCAL_PATH != nullptr) { - RepoLocalPath = HHVM_REPO_LOCAL_PATH; + { + Hdf repoEval = repo["Eval"]; + // Repo.Eval.Mode. + RepoEvalMode = repoEval["Mode"].getString(); + if (RepoEvalMode.empty()) { + RepoEvalMode = "readonly"; + } else if (RepoEvalMode.compare("local") + && RepoEvalMode.compare("central") + && RepoEvalMode.compare("readonly")) { + Logger::Error("Bad config setting: Repo.Eval.Mode=%s", + RepoEvalMode.c_str()); + RepoEvalMode = "readonly"; } } + RepoJournal = repo["Journal"].getString("delete"); + RepoCommit = repo["Commit"].getBool(true); + RepoDebugInfo = repo["DebugInfo"].getBool(true); + RepoAuthoritative = repo["Authoritative"].getBool(false); } - { - Hdf repoCentral = repo["Central"]; - // Repo.Central.Path. - RepoCentralPath = repoCentral["Path"].getString(); - } - { - Hdf repoEval = repo["Eval"]; - // Repo.Eval.Mode. - RepoEvalMode = repoEval["Mode"].getString(); - if (RepoEvalMode.empty()) { - RepoEvalMode = "readonly"; - } else if (RepoEvalMode.compare("local") - && RepoEvalMode.compare("central") - && RepoEvalMode.compare("readonly")) { - Logger::Error("Bad config setting: Repo.Eval.Mode=%s", - RepoEvalMode.c_str()); - RepoEvalMode = "readonly"; - } - } - RepoJournal = repo["Journal"].getString("delete"); - RepoCommit = repo["Commit"].getBool(true); - RepoDebugInfo = repo["DebugInfo"].getBool(true); - RepoAuthoritative = repo["Authoritative"].getBool(false); + + // NB: after we know the value of RepoAuthoritative. + EnableArgsInBacktraces = + eval["EnableArgsInBacktraces"].getBool(!RepoAuthoritative); } { Hdf sandbox = config["Sandbox"]; diff --git a/hphp/runtime/base/runtime_option.h b/hphp/runtime/base/runtime_option.h index 743da3273..981b7f0a7 100644 --- a/hphp/runtime/base/runtime_option.h +++ b/hphp/runtime/base/runtime_option.h @@ -366,6 +366,7 @@ public: static int ScannerType; static int MaxUserFunctionId; static bool EnableFinallyStatement; + static bool EnableArgsInBacktraces; static std::set DynamicInvokeFunctions; diff --git a/hphp/runtime/vm/bytecode.cpp b/hphp/runtime/vm/bytecode.cpp index 575164698..3db160e7d 100644 --- a/hphp/runtime/vm/bytecode.cpp +++ b/hphp/runtime/vm/bytecode.cpp @@ -2452,7 +2452,7 @@ Array VMExecutionContext::debugBacktrace(bool skip /* = false */, fp->m_func->unit()->filepath()))); frame.set(String(s_args), args, true); } - } else if (RuntimeOption::RepoAuthoritative) { + } else if (!RuntimeOption::EnableArgsInBacktraces) { // Provide an empty 'args' array to be consistent with hphpc frame.set(String(s_args), args, true); } else { diff --git a/hphp/test/verify b/hphp/test/verify index a9ecef51a..2dc581cff 100755 --- a/hphp/test/verify +++ b/hphp/test/verify @@ -389,7 +389,7 @@ sub run_test } unlink "$opt_objdir/$test.repo/hhvm.hhbc"; `$opt_hphp -thhbc -l0 -k1 -o $opt_objdir/$test.repo $hphp_opts $opt_objdir/$test`; - $opts .= " -v Repo.Authoritative=true -v Repo.Central.Path=$opt_objdir/$test.repo/hhvm.hhbc"; + $opts .= " -v Repo.Authoritative=true -v Repo.Central.Path=$opt_objdir/$test.repo/hhvm.hhbc -v Eval.EnableArgsInBacktraces=true"; } }