Add a new option to control args in backtraces

Add Eval.EnableArgsInBacktraces, which defaults to !Repo.Authoritative. This allows us to test what happens when backtraces keep references to function arguments even when testing in authoritative mode. Modified the test harness to set this to true when using Repo.Authoritative.
Esse commit está contido em:
mikemag
2013-04-16 14:13:44 -07:00
commit de Sara Golemon
commit 5240dae6a9
4 arquivos alterados com 56 adições e 50 exclusões
+53 -48
Ver Arquivo
@@ -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"];
+1
Ver Arquivo
@@ -366,6 +366,7 @@ public:
static int ScannerType;
static int MaxUserFunctionId;
static bool EnableFinallyStatement;
static bool EnableArgsInBacktraces;
static std::set<std::string, stdltistr> DynamicInvokeFunctions;
+1 -1
Ver Arquivo
@@ -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 {
+1 -1
Ver Arquivo
@@ -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";
}
}