本文整理汇总了C++中DebuggerClient类的典型用法代码示例。如果您正苦于以下问题:C++ DebuggerClient类的具体用法?C++ DebuggerClient怎么用?C++ DebuggerClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DebuggerClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: listInst
void CmdInstrument::listInst(DebuggerClient &client) {
m_type = ActionRead;
m_instPoints = client.getInstPoints();
CmdInstrumentPtr instCmdPtr = client.xend<CmdInstrument>(this);
client.setInstPoints(instCmdPtr->m_ips);
PrintInstPoints(client);
}
示例2: AttachSandbox
bool CmdMachine::AttachSandbox(DebuggerClient &client,
DSandboxInfoPtr sandbox,
bool force /* = false */) {
if (client.isLocal()) {
client.error("Local script doesn't have sandbox to attach to.");
return false;
}
CmdMachine cmd;
cmd.m_body = "attach";
cmd.m_sandboxes.push_back(sandbox);
cmd.m_force = force;
client.info("Attaching to %s and pre-loading, please wait...",
sandbox->desc().c_str());
CmdMachinePtr cmdMachine = client.xend<CmdMachine>(&cmd);
if (cmdMachine->m_succeed) {
client.playMacro("startup");
} else {
// Note: it would be nice to give them more info about the process we think
// is debugging this sandbox: what machine it's on, what it's pid is, etc.
// Unfortunately, we don't have any of that data. We'd need a protocol
// change to have the client give us more info when it attaches.
client.error(
"Failed to attach to the sandbox. Maybe another client is debugging, \n"
"or a client failed to detach cleanly.\n"
"You can attach to another sandbox, or exit the other attached client, \n"
"or force this client to take over the sandbox with: \n"
"\n"
"\t[m]achine [a]ttach [f]orce %s %s"
"\n",
sandbox->m_user.c_str(), sandbox->m_name.c_str());
}
return cmdMachine->m_succeed;
}
示例3: onClient
void CmdHeaptrace::onClient(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
String format;
String file;
if (client.argCount() == 3) {
format = client.argValue(2);
file = client.argValue(3);
} else if (client.argCount() != 1) {
help(client);
return;
}
CmdHeaptracePtr cmd = client.xend<CmdHeaptrace>(this);
if (file.empty()) {
cmd->printHeap(client);
} else {
std::string formatStr = format->data();
const auto it = s_formatMap.find(formatStr);
if (it == s_formatMap.end()) {
client.print("Unsupported format type");
return;
}
cmd->printGraphToFile(client, file, it->second);
}
}
示例4: list
void CmdMachine::list(DebuggerClient &client) {
if (client.argCount() == 0) {
static const char *keywords[] =
{ "disconnect", "connect", "rpc", "list", "attach", nullptr };
client.addCompletion(keywords);
}
}
示例5: onClientImpl
void CmdException::onClientImpl(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() == 0) {
help(client);
return;
}
bool regex = false;
BreakPointInfo::State state = BreakPointInfo::Always;
int index = 1;
if (client.arg(1, "regex")) {
regex = true;
index++;
} else if (client.arg(1, "once")) {
state = BreakPointInfo::Once;
index++;
}
BreakPointInfoPtr bpi(new BreakPointInfo(regex, state, ExceptionThrown,
client.argValue(index), ""));
if (!addToBreakpointListAndUpdateServer(client, bpi, index)) {
client.tutorial(
"This is the order of different arguments:\n"
"\n"
"\t[e]xception [r]egex|[o]nce {exp} if|&& {php}\n"
"\n"
"These are the components in an exception {exp}:\n"
"\n"
"\[email protected]{url}"
"\t{namespace}::{cls}@{url}"
"\n"
);
}
}
示例6: processList
bool CmdMachine::processList(DebuggerClient &client,
bool output /* = true */) {
m_body = "list";
CmdMachinePtr res = client.xend<CmdMachine>(this);
client.updateSandboxes(res->m_sandboxes);
if (!output) return true;
if (res->m_sandboxes.empty()) {
client.info("(no sandbox was found)");
client.tutorial(
"Please hit the sandbox from browser at least once. Then run "
"'[m]achine [l]ist' again."
);
} else {
for (int i = 0; i < (int)res->m_sandboxes.size(); i++) {
client.print(" %d\t%s", i + 1,
res->m_sandboxes[i]->desc().c_str());
}
client.tutorial(
"Use '[m]achine [a]ttach {index}' to attach to one sandbox. For "
"example, 'm a 1'. If desired sandbox is not on the list, please "
"hit the sandbox from browser once. Then run '[m]achine [l]ist' "
"again."
);
}
return true;
}
示例7: setClientOutput
void CmdEval::setClientOutput(DebuggerClient &client) {
client.setOutputType(DebuggerClient::OTValues);
ArrayInit values(2);
values.set(s_body, m_body);
values.set(s_value, m_output);
client.setOTValues(values.create());
}
示例8: list
void CmdMacro::list(DebuggerClient &client) {
if (client.argCount() == 0) {
static const char *keywords[] =
{ "start", "end", "replay", "list", "clear", nullptr};
client.addCompletion(keywords);
}
}
示例9: printHeap
void CmdHeaptrace::printHeap(DebuggerClient &client) {
for (const auto &pair : m_accum.typesMap) {
size_t size = m_accum.sizeMap[pair.first];
std::string sizeStr = size
? folly::stringPrintf(" which consumes %lu bytes", size)
: std::string();
client.print(
folly::stringPrintf("Found TV at %p with type %s%s",
(void *)pair.first,
typeName(pair.second),
sizeStr.c_str()));
std::vector<int64_t> &adjList = m_accum.adjacencyList[pair.first];
if (!adjList.empty()) {
std::string children = " -> found children: ";
bool first = true;
for (const int64_t &adjacent : adjList) {
if (!first) {
children += ", ";
}
children += folly::stringPrintf("%p", (void *)adjacent);
first = false;
}
client.print(children);
}
}
}
示例10: list
void CmdThread::list(DebuggerClient &client) {
if (client.argCount() == 0) {
static const char *keywords[] =
{ "list", "normal", "sticky", "exclusive", nullptr };
client.addCompletion(keywords);
}
}
示例11: help
// The text to display when the debugger client processes "help list".
void CmdList::help(DebuggerClient &client) {
client.helpTitle("List Command");
client.helpCmds(
"list", "displays current block of source code",
"list {line}", "displays code around specified line",
"list {line1}-{line2}", "displays specified block of source code",
"list {line1}-", "displays code starting with the line",
"list -{line2}", "displays code ending with the line",
"list {file}", "displays beginning lines of the file",
"list {cls}", "displays beginning lines of the class",
"list {function}", "displays beginning lines of the function",
"list {cls::method}", "displays beginning lines of the method",
"list {file}:{line}", "displays code around specified file:line",
"list {file}:{l1}-{l2}", "displays specified block in the file",
"list {file}:{l1}-", "displays specified block in the file",
"list {file}:-{l2}", "displays specified block in the file",
"list {directory}", "sets PHP source root directory",
nullptr
);
client.helpBody(
"Use list command to display PHP source code. In remote debugging, this "
"is displaying source code on server side. When server side cannot find "
"the file, it will fall back to local files.\n"
"\n"
"Hit return to display more lines of code after current display.\n"
"\n"
"When a directory name is specified, this will become a root directory "
"for resolving relative paths of PHP files. Files with absolute paths "
"will not be affected by this setting. This directory will be stored "
"in configuration file for future sessions as well."
);
}
示例12: printGraphToFile
void CmdHeaptrace::printGraphToFile(DebuggerClient &client,
String filename,
const GraphFormat &gf) {
const char *name = filename->data();
FILE *graphFile = fopen(name, "w");
if (!graphFile) {
client.print("Could not open file!");
return;
}
fprintf(graphFile, "%s", gf.prologue.c_str());
for (const auto &pair : m_accum.typesMap) {
std::string n = gf.stringifyNode((TypedValue *)pair.first,
typeName(pair.second));
fprintf(graphFile, "%s", n.c_str());
std::vector<int64_t> &adjList = m_accum.adjacencyList[pair.first];
for (const int64_t adjacent : adjList) {
std::string e = gf.stringifyEdge((TypedValue *)pair.first,
(TypedValue *)adjacent);
fprintf(graphFile, "%s", e.c_str());
}
}
fprintf(graphFile, "%s", gf.epilogue.c_str());
fclose(graphFile);
client.print(folly::stringPrintf("Wrote heap graph to %s.", name));
}
示例13: AttachSandbox
bool CmdMachine::AttachSandbox(DebuggerClient &client,
DSandboxInfoPtr sandbox,
bool force /* = false */) {
if (client.isLocal()) {
client.error("Local script doesn't have sandbox to attach to.");
return false;
}
CmdMachine cmd;
cmd.m_body = "attach";
cmd.m_sandboxes.push_back(sandbox);
cmd.m_force = force;
client.info("Attaching to %s and pre-loading, please wait...",
sandbox->desc().c_str());
CmdMachinePtr cmdMachine = client.xend<CmdMachine>(&cmd);
if (cmdMachine->m_succeed) {
client.playMacro("startup");
} else {
client.error("failed to attach to sandbox, maybe another client is "
"debugging, \nattach to another sandbox, exit the "
"attached hphpd client, or try \n"
"[m]achine [a]ttach [f]orce [%s] [%s]",
sandbox->m_user.c_str(), sandbox->m_name.c_str());
}
return cmdMachine->m_succeed;
}
示例14: help
void CmdPrint::help(DebuggerClient &client) {
client.helpTitle("Print Command");
client.helpCmds(
"[p]rint {php}", "prints result of PHP code",
"[p]rint r {php}", "prints result of PHP code, (print_r)",
"[p]rint v {php}", "prints result of PHP code, (var_dump)",
"[p]rint x {php}", "prints hex encoded string or number",
"[p]rint [h]ex {php}", "prints hex encoded string or number",
"[p]rint [o]ct {php}", "prints octal encoded string or number",
"[p]rint [d]ec {php}", "prints as signed integer",
"[p]rint [u]nsigned {php}", "prints as unsigned integer",
"[p]rint [t]ime {php}", "converts between time and timestamp",
"", "",
"[p]rint [a]lways {above}", "adds a watch expression at break",
"[p]rint [l]ist", "lists watch expressions",
"[p]rint [c]lear {index}", "clears a watch expression",
"[p]rint [c]lear [a]ll", "clears all watch expressions",
nullptr
);
client.helpBody(
"Prints result of an expression in certain format. If '[a]lways' is "
"specified, the expression will be added to a watch list. At every break, "
"either at a breakpoint or caused by step commands, these expressions "
"will be evaluated and printed out."
);
}
示例15: processList
void CmdMacro::processList(DebuggerClient &client) {
const MacroPtrVec ¯os = client.getMacros();
for (unsigned int i = 0; i < macros.size(); i++) {
MacroPtr macro = macros[i];
client.output("%4d %s", i + 1, macro->m_name.c_str());
client.print("%s", macro->desc(" > ").c_str());
}
}