Debugging functions in systemlib.php
After a run command, breakpoints in systemlib did not fire because systemlib.php does not get reloaded. Now get the run command to reapply the breakpoints. Also fixed the caching of the source of systemlib.php to not check for the debugger flag before the flag has been set. Finally, fixed a race condition where compiling a string/file to a unit will fail to update the repo with the unit because another thread has already written a unit with the same hash to the repo. In such cases, the losing unit is unable to retrieve source information because that only lives in the repo.
Esse commit está contido em:
@@ -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...
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -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<char[]> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
<?php
|
||||
$h = new SplMaxHeap();
|
||||
$h->insert(1);
|
||||
|
||||
@@ -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 <?php
|
||||
2 $h = new SplMaxHeap();
|
||||
3 (END)
|
||||
|
||||
step
|
||||
Break at SplHeap::__construct() on line %d of systemlib.php
|
||||
%d */
|
||||
%d public function __construct() {}
|
||||
%d
|
||||
%Sbr SplMaxHeap::insert()
|
||||
Breakpoint 1 set upon entering SplMaxHeap::insert()
|
||||
run
|
||||
Breakpoint 1 reached at SplHeap::insert() on line %d of systemlib.php
|
||||
%d public function insert($value) {
|
||||
%d $this->checkNotCorrupted();
|
||||
%d $index = $this->lowestFreeIndex();
|
||||
|
||||
quit
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
step
|
||||
step
|
||||
quit
|
||||
br SplMaxHeap::insert()
|
||||
run
|
||||
quit
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário