From d160ad4ddb46f41b9ac48739afd5eb2c9c6b36dc Mon Sep 17 00:00:00 2001 From: Herman Venter Date: Tue, 11 Jun 2013 15:20:05 -0700 Subject: [PATCH] Source information for systemlib.php for use in debugging. The debugger can only hit breakpoints and list source lines for code lines that have an entry in the byte code repository. In order to make systemlib.php debuggable, it needs an entry. A customized routine has been created for doing this since there is no actual source file available. Also, special case logic is needed to list the source file during debugging. --- hphp/hhvm/process_init.cpp | 3 --- hphp/runtime/debugger/cmd/cmd_list.cpp | 3 +++ hphp/runtime/vm/runtime.cpp | 2 +- hphp/test/quick/debugger/list.php | 2 ++ hphp/test/quick/debugger/list.php.expectf | 14 ++++++++++++++ hphp/test/quick/debugger/list.php.in | 3 +++ 6 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 hphp/test/quick/debugger/list.php create mode 100644 hphp/test/quick/debugger/list.php.expectf create mode 100644 hphp/test/quick/debugger/list.php.in diff --git a/hphp/hhvm/process_init.cpp b/hphp/hhvm/process_init.cpp index 285f4341c..d3d2948e7 100644 --- a/hphp/hhvm/process_init.cpp +++ b/hphp/hhvm/process_init.cpp @@ -112,9 +112,6 @@ void ProcessInit() { RuntimeOption::EvalAllowHhas = true; Transl::TargetCache::requestInit(); - - String currentDir = g_vmContext->getCwd(); - string hhas; string slib = get_systemlib(&hhas); diff --git a/hphp/runtime/debugger/cmd/cmd_list.cpp b/hphp/runtime/debugger/cmd/cmd_list.cpp index bd8965105..67469fa53 100644 --- a/hphp/runtime/debugger/cmd/cmd_list.cpp +++ b/hphp/runtime/debugger/cmd/cmd_list.cpp @@ -349,6 +349,9 @@ bool CmdList::onServer(DebuggerProxy &proxy) { } } RuntimeOption::WarningFrequency = savedWarningFrequency; + if (!m_code && m_file == "systemlib.php") { + m_code = get_systemlib(); + } return proxy.sendToClient((DebuggerCommand*)this); } diff --git a/hphp/runtime/vm/runtime.cpp b/hphp/runtime/vm/runtime.cpp index bef497bda..3f6e48fb9 100644 --- a/hphp/runtime/vm/runtime.cpp +++ b/hphp/runtime/vm/runtime.cpp @@ -333,7 +333,7 @@ Unit* compile_string(const char* s, size_t sz, const char* fname) { int out_len; md5 = MD5(string_md5(s, sz, false, out_len)); - Unit* u = Repo::get().loadUnit("", md5); + Unit* u = Repo::get().loadUnit(fname ? fname : "", md5); if (u != nullptr) { return u; } diff --git a/hphp/test/quick/debugger/list.php b/hphp/test/quick/debugger/list.php new file mode 100644 index 000000000..5c4673460 --- /dev/null +++ b/hphp/test/quick/debugger/list.php @@ -0,0 +1,2 @@ +