2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #include "hphp/runtime/eval/debugger/cmd/cmd_up.h"
18 #include "hphp/runtime/eval/debugger/cmd/cmd_where.h"
20 namespace HPHP
{ namespace Eval
{
21 ///////////////////////////////////////////////////////////////////////////////
23 TRACE_SET_MOD(debugger
);
25 bool CmdUp::help(DebuggerClient
*client
) {
26 client
->helpTitle("Up Command");
28 "[u]p {num=1}", "moves to outer frames (callers) on stacktrace",
32 "Use this command to walk up on stacktrace to find out outer callers of "
33 "current frame. By default it moves up by one level. Specify a number "
34 "to move up several levels a time."
39 int CmdUp::ParseNumber(DebuggerClient
*client
) {
40 if (client
->argCount() == 1) {
41 string snum
= client
->argValue(1);
42 if (!DebuggerClient::IsValidNumber(snum
)) {
43 client
->error("Please specify a number.");
45 "Run '[w]here' command to see the entire stacktrace."
49 return atoi(snum
.c_str());
54 bool CmdUp::onClient(DebuggerClient
*client
) {
55 if (DebuggerCommand::onClient(client
)) return true;
56 if (client
->argCount() > 1) {
60 CmdWhere().fetchStackTrace(client
);
61 client
->moveToFrame(client
->getFrame() + ParseNumber(client
));
65 void CmdUp::setClientOutput(DebuggerClient
*client
) {
66 client
->setOutputType(DebuggerClient::OTStacktrace
);
69 ///////////////////////////////////////////////////////////////////////////////