diff --git a/hphp/compiler/analysis/emitter.cpp b/hphp/compiler/analysis/emitter.cpp index 60667a706..4eb343f2c 100644 --- a/hphp/compiler/analysis/emitter.cpp +++ b/hphp/compiler/analysis/emitter.cpp @@ -7480,6 +7480,15 @@ Unit* hphp_compiler_parse(const char* code, int codeLen, const MD5& md5, Repo::get().commitUnit(ue, unitOrigin); Unit* unit = ue->create(); delete ue; + if (unit->sn() == -1) { + // the unit was not committed to the Repo, probably because + // another thread did it first. Try to use the winner. + Unit* u = Repo::get().loadUnit(filename ? filename : "", md5); + if (u != nullptr) { + delete unit; + return u; + } + } return unit; } catch (const std::exception&) { // extern "C" function should not be throwing exceptions... diff --git a/hphp/hhvm/process_init.cpp b/hphp/hhvm/process_init.cpp index 0311e78a1..2a50ea839 100644 --- a/hphp/hhvm/process_init.cpp +++ b/hphp/hhvm/process_init.cpp @@ -120,6 +120,10 @@ void ProcessInit() { Logger::Error("Unable to find/load systemlib.php"); _exit(1); } + // Save this in case the debugger needs it. Once we know if this + // process does not have debugger support, we'll clear it. + SystemLib::s_source = slib; + SystemLib::s_unit = compile_string(slib.c_str(), slib.size(), "systemlib.php"); if (!hhas.empty()) { diff --git a/hphp/runtime/base/program_functions.cpp b/hphp/runtime/base/program_functions.cpp index b8ddc652d..b5efb0239 100644 --- a/hphp/runtime/base/program_functions.cpp +++ b/hphp/runtime/base/program_functions.cpp @@ -923,6 +923,9 @@ static int execute_program_impl(int argc, char **argv) { po.isTempFile = vm.count("temp-file"); + // forget the source for systemlib.php unless we are debugging + if (po.mode != "debug") SystemLib::s_source = ""; + // we need to initialize pcre cache table very early pcre_init(); @@ -1104,6 +1107,9 @@ static int execute_program_impl(int argc, char **argv) { free(new_argv); prepare_args(new_argc, new_argv, *client_args, nullptr); } + // Systemlib.php is not loaded again, so we need this if we + // are to hit any breakpoints in systemlib. + phpSetBreakPoints(localProxy.get()); restart = true; } catch (const Eval::DebuggerClientExitException &e) { execute_command_line_end(0, false, nullptr); @@ -1207,7 +1213,6 @@ string get_systemlib(string* hhas) { std::unique_ptr data(new char[desc.m_len]); ifs.read(data.get(), desc.m_len); string ret = systemlib_split(string(data.get(), desc.m_len), hhas); - if (RuntimeOption::EnableDebugger) SystemLib::s_source = ret; return ret; } diff --git a/hphp/test/quick/debugger/config.hdf b/hphp/test/quick/debugger/config.hdf index 19f64c452..528b95f2f 100644 --- a/hphp/test/quick/debugger/config.hdf +++ b/hphp/test/quick/debugger/config.hdf @@ -3,6 +3,9 @@ Eval { AllowHhas = true EnableHipHopSyntax = true EnableObjDestructCall = true + JitASize = 10485760 # 10 MB + JitAStubsSize = 10485760 # 10 MB + JitGlobalDataSize = 2097152 # 2 MB Debugger { EnableDebugger = true EnableDebuggerColor = false @@ -11,8 +14,6 @@ Eval { } Repo { - Local.Mode = r- - Central.Path = /var/facebook/hhvm/cli_%{schema}.hhbc Eval.Mode = readonly Commit = true DebugInfo = true @@ -39,3 +40,5 @@ ErrorHandling { ResourceLimit { SerializationSizeLimit=134217728 } + + diff --git a/hphp/test/quick/debugger/list.php.disabled b/hphp/test/quick/debugger/list.php similarity index 64% rename from hphp/test/quick/debugger/list.php.disabled rename to hphp/test/quick/debugger/list.php index 5c4673460..f8a8abbbf 100644 --- a/hphp/test/quick/debugger/list.php.disabled +++ b/hphp/test/quick/debugger/list.php @@ -1,2 +1,4 @@ insert(1); + diff --git a/hphp/test/quick/debugger/list.php.expectf b/hphp/test/quick/debugger/list.php.expectf index 2a032b06c..eea1ac7eb 100644 --- a/hphp/test/quick/debugger/list.php.expectf +++ b/hphp/test/quick/debugger/list.php.expectf @@ -1,14 +1,10 @@ Program %s/list.php loaded. Type '[r]un' or '[c]ontinue' to go. -step -Break on line 2 of %s/list.php - 1 checkNotCorrupted(); + %d $index = $this->lowestFreeIndex(); quit diff --git a/hphp/test/quick/debugger/list.php.in b/hphp/test/quick/debugger/list.php.in index 243229139..791f1bf30 100644 --- a/hphp/test/quick/debugger/list.php.in +++ b/hphp/test/quick/debugger/list.php.in @@ -1,3 +1,3 @@ -step -step -quit \ No newline at end of file +br SplMaxHeap::insert() +run +quit