diff --git a/hphp/runtime/debugger/cmd/cmd_eval.cpp b/hphp/runtime/debugger/cmd/cmd_eval.cpp index 192366348..1192bdf2c 100644 --- a/hphp/runtime/debugger/cmd/cmd_eval.cpp +++ b/hphp/runtime/debugger/cmd/cmd_eval.cpp @@ -52,7 +52,7 @@ void CmdEval::onClientImpl(DebuggerClient &client) { } void CmdEval::handleReply(DebuggerClient &client) { - client.print(m_output); + if (!m_output.empty()) client.print(m_output); } const StaticString diff --git a/hphp/runtime/debugger/cmd/cmd_variable.cpp b/hphp/runtime/debugger/cmd/cmd_variable.cpp index a210b696d..50fd22ec6 100644 --- a/hphp/runtime/debugger/cmd/cmd_variable.cpp +++ b/hphp/runtime/debugger/cmd/cmd_variable.cpp @@ -67,6 +67,20 @@ void CmdVariable::help(DebuggerClient &client) { ); } +void CmdVariable::PrintVariable(DebuggerClient &client, CStrRef varName) { + CmdVariable cmd; + cmd.m_frame = client.getFrame(); + CmdVariablePtr rcmd = client.xend(&cmd); + if (!rcmd->m_variables.empty()) { + for (ArrayIter iter(rcmd->m_variables); iter; ++iter) { + String name = iter.first().toString(); + if (!name.equal(varName)) continue; + String value = DebuggerClient::FormatVariable(iter.second(), 200); + client.print("%s", value.data()); + } + } +} + void CmdVariable::PrintVariables(DebuggerClient &client, CArrRef variables, bool global, CStrRef text) { bool system = true; diff --git a/hphp/runtime/debugger/cmd/cmd_variable.h b/hphp/runtime/debugger/cmd/cmd_variable.h index c371f65dd..ea0c7373d 100644 --- a/hphp/runtime/debugger/cmd/cmd_variable.h +++ b/hphp/runtime/debugger/cmd/cmd_variable.h @@ -26,6 +26,7 @@ DECLARE_BOOST_TYPES(CmdVariable); class CmdVariable : public DebuggerCommand { public: static Array GetGlobalVariables(); + static void PrintVariable(DebuggerClient &client, CStrRef varName); static void PrintVariables(DebuggerClient &client, CArrRef variables, bool global, CStrRef text); diff --git a/hphp/runtime/debugger/debugger_client.cpp b/hphp/runtime/debugger/debugger_client.cpp index 5dfdc19a3..a886f5a2e 100644 --- a/hphp/runtime/debugger/debugger_client.cpp +++ b/hphp/runtime/debugger/debugger_client.cpp @@ -400,7 +400,7 @@ String DebuggerClient::FormatTitle(const char *title) { /////////////////////////////////////////////////////////////////////////////// DebuggerClient::DebuggerClient(std::string name /* = "" */) - : m_tutorial(0), m_printFunction(""), m_scriptMode(false), + : m_tutorial(0), m_scriptMode(false), m_logFile(""), m_logFileHandler(nullptr), m_mainThread(this, &DebuggerClient::run), m_stopped(false), m_inputState(TakingCommand), @@ -1919,6 +1919,8 @@ int DebuggerClient::checkEvalEnd() { return pos; } +const StaticString s_UNDERSCORE("_"); + // Parses the current command line as a code execution command // and carries out the command. void DebuggerClient::processTakeCode() { @@ -1937,8 +1939,9 @@ void DebuggerClient::processTakeCode() { // strip the trailing ; m_line = m_line.substr(0, m_line.size() - 1); } - m_code = string(" m_tutorialVisited; bool m_scriptMode; // Is this client being scripted by a test? diff --git a/hphp/test/quick/debugger/break1.php.expectf b/hphp/test/quick/debugger/break1.php.expectf index f8ad0591d..0f2172ed2 100644 --- a/hphp/test/quick/debugger/break1.php.expectf +++ b/hphp/test/quick/debugger/break1.php.expectf @@ -36,7 +36,6 @@ break clear all All breakpoints are cleared. continue test_break1_suffix - break foo() Breakpoint 1 set upon entering foo() @ foo('test_break2') @@ -51,11 +50,9 @@ break clear all All breakpoints are cleared. continue test_break2_suffix - break cls::pubObj() Breakpoint 1 set upon entering cls::pubObj() @ $break3=new cls() - @ $break3->pubObj('test_break3') Breakpoint 1 reached at cls::pubObj() on line 12 of %s/break1.php 11 public function pubObj($x) { @@ -70,7 +67,6 @@ break break3->pubObj() Breakpoint was not set in right format. continue pubObj:test_break3 - break cls::pubCls() Breakpoint 1 set upon entering cls::pubCls() @ cls::pubCls('test_break4') @@ -87,9 +83,7 @@ break cls::break4->pubCls() Breakpoint was not set in right format. continue pubCls:test_break4 - @ $break5=new cls() - @ $break5->pubHardBreak('test_break5') pubHardBreak:test_break5 Break at cls::pubHardBreak() on line 19 of %s/break1.php @@ -99,7 +93,6 @@ Break at cls::pubHardBreak() on line 19 of %s/break1.php continue pubHardBreak:done - break clear all There is no breakpoint to clear or toggle. break cls::nosuchMethod() @@ -118,7 +111,6 @@ Breakpoint 1 set upon entering derived::pubObj() break list 1 ALWAYS upon entering derived::pubObj() @ $break6 = new derived() - @ $break6->pubObj('test_break6') Breakpoint 1 reached at cls::pubObj() on line 12 of %s/break1.php 11 public function pubObj($x) { @@ -127,13 +119,11 @@ Breakpoint 1 reached at cls::pubObj() on line 12 of %s/break1.php continue pubObj:test_break6 - break clear all All breakpoints are cleared. b cls::pubObj() if $x == 'yes' Breakpoint 1 set upon entering cls::pubObj() if $x == 'yes' @ $break7 = new cls() - @ $break7->pubObj('yes'); Breakpoint 1 reached at cls::pubObj() on line 12 of %s/break1.php 11 public function pubObj($x) { @@ -157,16 +147,13 @@ break clear all All breakpoints are cleared. continue pubObj:yes sir - break derived::callPubObj=>cls::pubObj() Breakpoint 1 set upon entering cls::pubObj() called by derived::callPubObj() break list 1 ALWAYS upon entering cls::pubObj() called by derived::callPubObj() @ $break8 = new derived(); - @ $break8->pubObj('no') pubObj:no - @ $break8->callPubObj('yes') Breakpoint 1 reached at cls::pubObj() on line 12 of %s/break1.php 11 public function pubObj($x) { @@ -177,16 +164,13 @@ break clear all All breakpoints are cleared. continue pubObj:yes - break derived::callCallPubObj=>derived::callPubObj=>cls::pubObj() Breakpoint 1 set upon entering cls::pubObj() called by derived::callPubObj() called by derived::callCallPubObj() break list 1 ALWAYS upon entering cls::pubObj() called by derived::callPubObj() called by derived::callCallPubObj() @ $break9 = new derived(); - @ $break9->callPubObj('no') pubObj:no - @ $break9->callCallPubObj('yes') Breakpoint 1 reached at cls::pubObj() on line 12 of %s/break1.php 11 public function pubObj($x) { @@ -197,16 +181,13 @@ break clear all All breakpoints are cleared. continue pubObj:yes - break derived::callCallPubObj=>cls::pubObj() Breakpoint 1 set upon entering cls::pubObj() called by derived::callCallPubObj() break list 1 ALWAYS upon entering cls::pubObj() called by derived::callCallPubObj() @ $break10 = new derived(); - @ $break10->callPubObj('no') pubObj:no - @ $break10->callCallPubObj('yes') Breakpoint 1 reached at cls::pubObj() on line 12 of %s/break1.php 11 public function pubObj($x) { @@ -217,7 +198,6 @@ break clear all All breakpoints are cleared. continue pubObj:yes - break foo() Breakpoint 1 set upon entering foo() break break1.php:6 @@ -235,7 +215,6 @@ Breakpoint 2 reached at foo() on line 6 of %s/break1.php continue test_break7_suffix - break clear all All breakpoints are cleared. quit diff --git a/hphp/test/quick/debugger/break2.php.expectf b/hphp/test/quick/debugger/break2.php.expectf index 60a153a41..32312731d 100644 --- a/hphp/test/quick/debugger/break2.php.expectf +++ b/hphp/test/quick/debugger/break2.php.expectf @@ -37,7 +37,6 @@ Breakpoint 1 reached at foo2() on line 7 of %s/break2.php 8 } @ $break6=new cls2() - @ $break6->pubObj('test_break6') Breakpoint 3 reached at cls2::pubObj() on line 12 of %s/break2.php 11 public function pubObj($x) { @@ -46,7 +45,6 @@ Breakpoint 3 reached at cls2::pubObj() on line 12 of %s/break2.php continue pubObj2:test_break6 - @ cls2::pubCls('test_break6') Breakpoint 4 reached at cls2::pubCls() on line 15 of %s/break2.php 14 public static function pubCls($x) { @@ -57,5 +55,4 @@ break clear all All breakpoints are cleared. continue pubCls2:test_break6 - quit diff --git a/hphp/test/quick/debugger/break3.php.expectf b/hphp/test/quick/debugger/break3.php.expectf index 3e5caff0c..88f98194d 100644 --- a/hphp/test/quick/debugger/break3.php.expectf +++ b/hphp/test/quick/debugger/break3.php.expectf @@ -16,11 +16,9 @@ break clear all All breakpoints are cleared. continue test_break1_TestNs - break TestNs\cls::pubObj() Breakpoint 1 set upon entering TestNs\cls::pubObj() @ $break8=new \TestNs\cls() - @ $break8->pubObj('test_break2') Breakpoint 1 reached at TestNs\cls::pubObj() on line 13 of %s/break3.php 12 public function pubObj($x) { @@ -37,7 +35,6 @@ break TestNs\cls::break8->pubObj() Breakpoint was not set in right format. continue pubObj:test_break2 - break \TestNs\cls::pubCls() Breakpoint 1 set upon entering TestNs\cls::pubCls() @ \TestNs\cls::pubCls('test_break3') @@ -52,7 +49,6 @@ break clear all All breakpoints are cleared. continue pubCls:test_break3 - break \TestNs\Nested\foo() Breakpoint 1 set upon entering TestNs\Nested\foo() @ \TestNs\Nested\foo('test_break4') @@ -67,11 +63,9 @@ break clear all All breakpoints are cleared. continue test_break4_TestNs\Nested - break TestNs\Nested\cls::pubObj() Breakpoint 1 set upon entering TestNs\Nested\cls::pubObj() @ $break8=new \TestNs\Nested\cls() - @ $break8->pubObj('test_break5') Breakpoint 1 reached at TestNs\Nested\cls::pubObj() on line 29 of %s/break3.php 28 public function pubObj($x) { @@ -84,7 +78,6 @@ break clear all All breakpoints are cleared. continue pubObj:test_break5_TestNs\Nested - break \TestNs\Nested\cls::pubCls() Breakpoint 1 set upon entering TestNs\Nested\cls::pubCls() @ \TestNs\Nested\cls::pubCls('test_break6') @@ -99,5 +92,4 @@ break clear all All breakpoints are cleared. continue pubCls:test_break6_TestNs\Nested - quit diff --git a/hphp/test/quick/debugger/eval1.php.expectf b/hphp/test/quick/debugger/eval1.php.expectf index b70227dee..8b375cbcd 100644 --- a/hphp/test/quick/debugger/eval1.php.expectf +++ b/hphp/test/quick/debugger/eval1.php.expectf @@ -5,12 +5,10 @@ Program %s/eval1.php exited normally. print function_exists('test1') false @ function test1($x){error_log($x);return $x+1;} - print function_exists('test1') true @ $eval1=test1(4) 4 - print $eval1 5 print class_exists('test2') @@ -31,15 +29,12 @@ class test2 { } } ?> - print class_exists('test2') true set bac off BypassAccessCheck(bac) set to off @ $eval2 = new test2() - @ $eval2->a = 3 - @ $eval2->b = 4 Hit fatal : Cannot access protected property #0 at [:1] @@ -51,7 +46,6 @@ set bac on BypassAccessCheck(bac) set to on. All code executed from debugger is bypassing access check! @ $eval2->b = 4 - print $eval2->ab() "3:4" break eval1.php:12 @@ -67,9 +61,7 @@ All breakpoints are cleared. set bac off BypassAccessCheck(bac) set to off @ $this->pub = 21 - @ $this->pri = 22 - next Break at cls::meth() on line 13 of %s/eval1.php 12 $b = $this->pub.':'.$this->pri; @@ -88,7 +80,6 @@ set bac on BypassAccessCheck(bac) set to on. All code executed from debugger is bypassing access check! @ $this->pub = $x->seven() - continue "11:12-21:22-7:22" quit diff --git a/hphp/test/quick/debugger/flow.php.expectf b/hphp/test/quick/debugger/flow.php.expectf index 40e62e6bc..834535f73 100644 --- a/hphp/test/quick/debugger/flow.php.expectf +++ b/hphp/test/quick/debugger/flow.php.expectf @@ -47,7 +47,6 @@ break clear all All breakpoints are cleared. continue test done 1 - break flow.php:18 Breakpoint 1 set on line 18 of flow.php @test(2) @@ -107,7 +106,6 @@ continue out pri:2 out pub:2 test done 2 - break flow.php:6 Breakpoint 1 set on line 6 of flow.php @test(3) @@ -132,7 +130,6 @@ continue out pri:3 out pub:3 test done 3 - break flow.php:7 Breakpoint 1 set on line 7 of flow.php @test(4) @@ -181,7 +178,6 @@ Break at test() on line 62 of %s/flow.php continue test done 4 - break flow.php:46 Breakpoint 1 set on line 46 of flow.php test(5) @@ -222,7 +218,6 @@ continue out pri:5 out pub:5 test done 5 - break flow.php:46 Breakpoint 1 set on line 46 of flow.php test(6) @@ -263,7 +258,6 @@ continue out pri:6 out pub:6 test done 6 - break flow.php:7 Breakpoint 1 set on line 7 of flow.php @test(7) @@ -292,5 +286,4 @@ break clear all All breakpoints are cleared. continue test done 7 - quit diff --git a/hphp/test/quick/debugger/flow_break_interference.php.expectf b/hphp/test/quick/debugger/flow_break_interference.php.expectf index 660f290b5..21b50c4cd 100644 --- a/hphp/test/quick/debugger/flow_break_interference.php.expectf +++ b/hphp/test/quick/debugger/flow_break_interference.php.expectf @@ -31,7 +31,6 @@ Breakpoint 2 reached at main() on line 27 of %s/flow_break_interference.php p $a 42 $a = 7 - n Break at main() on line 28 of %s/flow_break_interference.php 27 $z = $a; diff --git a/hphp/test/quick/debugger/flow_small.php.expectf b/hphp/test/quick/debugger/flow_small.php.expectf index 4254528aa..d49f9bd3b 100644 --- a/hphp/test/quick/debugger/flow_small.php.expectf +++ b/hphp/test/quick/debugger/flow_small.php.expectf @@ -60,7 +60,6 @@ break clear all All breakpoints are cleared. continue test done 1 - break flow_small.php:18 Breakpoint 1 set on line 18 of flow_small.php @test(2) @@ -183,7 +182,6 @@ continue out pri:2 out pub:2 test done 2 - break flow_small.php:6 Breakpoint 1 set on line 6 of flow_small.php @test(3) @@ -208,7 +206,6 @@ continue out pri:3 out pub:3 test done 3 - break flow_small.php:7 Breakpoint 1 set on line 7 of flow_small.php @test(4) @@ -257,7 +254,6 @@ Break at test() on line 62 of %s/flow_small.php continue test done 4 - break flow_small.php:46 Breakpoint 1 set on line 46 of flow_small.php test(5) @@ -298,7 +294,6 @@ continue out pri:5 out pub:5 test done 5 - break flow_small.php:46 Breakpoint 1 set on line 46 of flow_small.php test(6) @@ -339,7 +334,6 @@ continue out pri:6 out pub:6 test done 6 - break flow_small.php:7 Breakpoint 1 set on line 7 of flow_small.php @test(7) @@ -368,5 +362,4 @@ break clear all All breakpoints are cleared. continue test done 7 - quit diff --git a/hphp/test/quick/debugger/info1.php.expectf b/hphp/test/quick/debugger/info1.php.expectf index 352951dc9..6a1fcc084 100644 --- a/hphp/test/quick/debugger/info1.php.expectf +++ b/hphp/test/quick/debugger/info1.php.expectf @@ -1,6 +1,5 @@ Program %s/info1.php loaded. Type '[r]un' or '[c]ontinue' to go. @ - info array_key_exists /** * ( excerpt from http://php.net/manual/en/function.array_key_exists.php ) @@ -21,7 +20,6 @@ class stdClass { run Program %s/info1.php exited normally. @ - info myfunc // defined on line 3 to 5 of %s/info1.php function myfunc($a, $b); diff --git a/hphp/test/quick/debugger/stack1.php.expectf b/hphp/test/quick/debugger/stack1.php.expectf index d86238108..3bc152842 100644 --- a/hphp/test/quick/debugger/stack1.php.expectf +++ b/hphp/test/quick/debugger/stack1.php.expectf @@ -95,7 +95,6 @@ StackArgs(sa) set to on. continue out pub:1 0 test done 1 0 - break stack1.php:9 Breakpoint 1 set on line 9 of stack1.php @ test(2, 2) @@ -161,7 +160,6 @@ down #6 foo (2, 1) at %s/stack1.php:28 @ $x=3 - continue out pri:2 0 out pub:2 0 diff --git a/hphp/test/server/debugger/tests/runTest1.php.expectf b/hphp/test/server/debugger/tests/runTest1.php.expectf index ba03e4c5e..8b456f43e 100644 --- a/hphp/test/server/debugger/tests/runTest1.php.expectf +++ b/hphp/test/server/debugger/tests/runTest1.php.expectf @@ -67,7 +67,6 @@ Break at test_sleep() on line 17 of %s/test1.php 18 return $a; @ $a = 0 - break test1.php:18 Breakpoint 1 set on line 18 of test1.php continue