本文整理汇总了C++中DebuggerClient::argValue方法的典型用法代码示例。如果您正苦于以下问题:C++ DebuggerClient::argValue方法的具体用法?C++ DebuggerClient::argValue怎么用?C++ DebuggerClient::argValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DebuggerClient
的用法示例。
在下文中一共展示了DebuggerClient::argValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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"
);
}
}
示例3: onClient
void CmdFlowControl::onClient(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
client.setFrame(0);
if (client.argCount() > 1) {
help(client);
return;
}
if (client.argCount() == 1) {
std::string snum = client.argValue(1);
if (!DebuggerClient::IsValidNumber(snum)) {
client.error("Count needs to be a number.");
return;
}
m_count = atoi(snum.c_str());
if (m_count < 1) {
client.error("Count needs to be a positive number.");
return;
}
}
m_smallStep = client.getDebuggerClientSmallStep();
client.sendToServer(this);
throw DebuggerConsoleExitException();
}
示例4: onClient
void CmdVariable::onClient(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
String text;
if (client.argCount() == 1) {
text = client.argValue(1);
} else if (client.argCount() != 0) {
help(client);
return;
}
if (client.isStackTraceAsync()) {
m_type = KindOfVariableAsync;
}
m_frame = client.getFrame();
auto cmd = client.xend<CmdVariable>(this);
if (cmd->m_variables.empty()) {
client.info("(no variable was defined)");
} else {
PrintVariables(client, cmd->m_variables, cmd->m_global ? -1 : m_frame,
text, cmd->m_version);
}
}
示例5: onClientImpl
void CmdWhere::onClientImpl(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() > 1) {
help(client);
return;
}
Array st = fetchStackTrace(client);
if (st.empty()) {
client.info("(no stacktrace to display or in global scope)");
client.info("if you hit serialization limit, consider do "
"\"set sa off\" and then get the stack without args");
return;
}
// so list command can default to current frame
client.moveToFrame(client.getFrame(), false);
if (client.argCount() == 0) {
int i = 0;
for (ArrayIter iter(st); iter; ++iter) {
client.printFrame(i, iter.second().toArray());
++i;
if (!client.isApiMode() &&
i % DebuggerClient::ScrollBlockSize == 0 &&
client.ask("There are %zd more frames. Continue? [Y/n]",
st.size() - i) == 'n') {
break;
}
}
} else {
string snum = client.argValue(1);
int num = atoi(snum.c_str());
if (snum[0] == '-') {
snum = snum.substr(1);
}
if (!DebuggerClient::IsValidNumber(snum)) {
client.error("The argument, if specified, has to be numeric.");
return;
}
if (num > 0) {
for (int i = 0; i < num && i < st.size(); i++) {
client.printFrame(i, st[i].toArray());
}
} else if (num < 0) {
for (int i = st.size() + num; i < st.size(); i++) {
client.printFrame(i, st[i].toArray());
}
} else {
client.error("0 was specified for the number of frames");
client.tutorial(
"The optional argument is the number of frames to print out. "
"Use a positive number to print out innermost frames. Use a negative "
"number to print out outermost frames."
);
}
}
}
示例6: onClientImpl
void CmdInstrument::onClientImpl(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() == 1) {
if (client.argValue(1) == "list" || client.argValue(1) == "l") {
listInst(client);
return;
}
if (client.argValue(1) == "clear" || client.argValue(1) == "c") {
clearInst(client);
return;
}
}
if (client.argCount() < 2 || client.argValue(1) == "help") {
help(client);
return;
}
std::string loc = client.argValue(1);
std::string file = client.argValue(2);
std::string desc;
if (client.argCount() >= 3) {
desc = client.argValue(3);
}
Variant code = f_file_get_contents(file.c_str());
if (code.isNull()) {
client.error("Unable to read from file %s", file.c_str());
return;
}
m_instPoints = client.getInstPoints();
if (loc == "here") {
InstPointInfoPtr ipi(new InstPointInfo());
ipi->setLocHere();
ipi->m_code = (std::string) code.toString();
ipi->m_desc = desc;
m_instPoints->push_back(ipi);
} else if (loc.rfind("()") == loc.size() - 2){
InstPointInfoPtr ipi(new InstPointInfo());
ipi->setLocFuncEntry(loc.substr(0, loc.size() - 2));
ipi->m_code = (std::string) code.toString();
ipi->m_desc = desc;
m_instPoints->push_back(ipi);
} else {
client.error("Not implemented\n");
return;
}
m_type = ActionWrite;
CmdInstrumentPtr instCmdPtr = client.xend<CmdInstrument>(this);
if (!instCmdPtr->m_enabled) {
client.error("Instrumentation is not enabled on the server");
}
client.setInstPoints(instCmdPtr->m_ips);
CmdInstrument::PrintInstPoints(client);
}
示例7: processTutorial
bool CmdHelp::processTutorial(DebuggerClient &client) {
string mode = client.argValue(2);
if (mode == "off") {
client.setTutorial(-1);
} else if (mode == "on") {
client.setTutorial(1);
} else if (mode == "auto") {
client.setTutorial(0);
} else {
return false;
}
return true;
}
示例8: onClientImpl
void CmdMacro::onClientImpl(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() == 0) {
help(client);
return;
}
if (client.arg(1, "start")) {
client.startMacro(client.argValue(2));
} else if (client.arg(1, "end")) {
client.endMacro();
} else if (client.arg(1, "replay")) {
if (!client.playMacro(client.argValue(2))) {
client.error("Unable to find specified macro.");
processList(client);
}
} else if (client.arg(1, "list")) {
processList(client);
} else if (client.arg(1, "clear")) {
string snum = client.argValue(2);
if (!DebuggerClient::IsValidNumber(snum)) {
client.error("'& [c]lear' needs an {index} argument.");
client.tutorial(
"You will have to run '& [l]ist' first to see a list of valid "
"numbers or indices to specify."
);
return;
}
int num = atoi(snum.c_str());
if (!client.deleteMacro(num)) {
client.error("\"%s\" is not a valid macro index. Choose one from "
"this list:", snum.c_str());
processList(client);
return;
}
}
}
示例9: onClientImpl
void CmdInternalTesting::onClientImpl(DebuggerClient &client) {
TRACE(2, "CmdInternalTesting::onClientImpl\n");
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() == 0) {
help(client);
return;
}
client.info("Executing internal test...");
m_arg = client.argValue(1);
if (client.arg(1, "badcmdtypesend")) {
// Give the cmd a bad type and send it over. This should cause the proxy to
// disconnect from us.
m_type = KindOfInternalTestingBad;
client.sendToServer(this);
// Spin here and wait for the client to be marked as stopped
// before going back to the event loop. This will give the local
// proxy time to recgonize the bad cmd, terminate, and wait for
// the client to stop. This will ensure that we always exit on the
// same path on both proxy and client threads, and remove any
// spurious output form ths test case.
while (!client.internalTestingIsClientStopped()) {
sleep(1);
}
throw DebuggerConsoleExitException(); // Expect no response
} else if (client.arg(1, "badcmdtypereceive")) {
client.xend<CmdInternalTesting>(this);
return;
} else if (client.arg(1, "shortcmdsend")) {
m_arg = "shortcmd"; // Force send to drop a field.
client.sendToServer(this);
// See note above about this wait.
while (!client.internalTestingIsClientStopped()) {
sleep(1);
}
throw DebuggerConsoleExitException(); // Expect no response
} else if (client.arg(1, "shortcmdreceive")) {
client.xend<CmdInternalTesting>(this);
return;
} else if (client.arg(1, "segfaultClient")) {
int *px = nullptr;
*px = 42;
} else if (client.arg(1, "segfaultServer")) {
client.xend<CmdInternalTesting>(this);
return;
}
help(client);
}
示例10: onClient
void CmdGlobal::onClient(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
String text;
if (client.argCount() == 1) {
text = client.argValue(1);
} else if (client.argCount() != 0) {
help(client);
return;
}
auto cmd = client.xend<CmdGlobal>(this);
if (cmd->m_globals.empty()) {
client.info("(no global variable was found)");
} else {
CmdVariable::PrintVariables(client, cmd->m_globals, -1,
text, cmd->m_version);
}
}
示例11: onClient
void CmdVariable::onClient(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
String text;
if (client.argCount() == 1) {
text = client.argValue(1);
} else if (client.argCount() != 0) {
help(client);
return;
}
m_frame = client.getFrame();
CmdVariablePtr cmd = client.xend<CmdVariable>(this);
if (cmd->m_variables.empty()) {
client.info("(no variable was defined)");
} else {
m_variables = cmd->m_variables;
PrintVariables(client, cmd->m_variables, cmd->m_global, text);
}
}
示例12: processClear
void CmdPrint::processClear(DebuggerClient &client) {
DebuggerClient::WatchPtrVec &watches = client.getWatches();
if (watches.empty()) {
client.error("There is no watch expression to clear.");
client.tutorial(
"Use '[p]rint [a]lways ...' to set new watch expressions. "
"Use '[p]rint ?|[h]elp' to read how to set them. "
);
return;
}
if (client.arg(2, "all")) {
watches.clear();
client.info("All watch expressions are cleared.");
return;
}
string snum = client.argValue(2);
if (!DebuggerClient::IsValidNumber(snum)) {
client.error("'[p]rint [c]lear' needs an {index} argument.");
client.tutorial(
"You will have to run '[p]rint [l]ist' first to see a list of valid "
"numbers or indices to specify."
);
return;
}
int num = atoi(snum.c_str()) - 1;
if (num < 0 || num >= (int)watches.size()) {
client.error("\"%s\" is not a valid index. Choose one from this list:",
snum.c_str());
processList(client);
return;
}
watches.erase(watches.begin() + num);
}
示例13: onClient
void CmdThread::onClient(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() > 1) {
help(client);
return;
}
if (client.argCount() == 0) {
m_body = "info";
auto res = client.xend<CmdThread>(this);
client.print(res->m_out);
} else if (client.arg(1, "list")) {
processList(client);
} else if (client.arg(1, "normal")) {
m_body = "normal";
client.sendToServer(this);
client.info("Thread is running in normal mode now. Other threads will "
"interleave when they hit breakpoints as well.");
} else if (client.arg(1, "sticky")) {
m_body = "sticky";
client.sendToServer(this);
client.info("Thread is running in sticky mode now. All other threads "
"will wait until this thread finishes, when they hit "
"breakpoints.");
} else if (client.arg(1, "exclusive")) {
m_body = "exclusive";
client.sendToServer(this);
client.info("Thread is running in exclusive mode now. All other threads "
"will not break, even when they hit breakpoints.");
} else {
std::string snum = client.argValue(1);
if (!DebuggerClient::IsValidNumber(snum)) {
client.error("'[t]hread {index}' needs a numeric argument.");
client.tutorial(
"You will have to run '[t]hread [l]ist' first to see a list of valid "
"numbers or indices to specify. Thread 1 is always your current "
"thread. If that's the only thread on the list, you do not have "
"another thread at break to switch to."
);
return;
}
int num = atoi(snum.c_str());
DThreadInfoPtr thread = client.getThread(num);
if (!thread) {
processList(client, false);
thread = client.getThread(num);
if (!thread) {
client.error("\"%s\" is not a valid thread index. Choose one from "
"this list:", snum.c_str());
processList(client);
return;
}
}
if (thread->m_id == client.getCurrentThreadId()) {
client.info("This is your current thread already.");
return;
}
m_body = "switch";
m_threads.push_back(thread);
client.sendToServer(this);
throw DebuggerConsoleExitException();
}
}
示例14: onClient
void CmdConfig::onClient(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() == 0) {
listVars(client);
return;
}
std::string var = client.argValue(1);
if (var == "help" || client.argCount() < 2) {
help(client);
return;
}
std::string value = client.argValue(2);
if (var == "BypassAccessCheck" || var == "bac") {
if (value == "on") {
client.print("BypassAccessCheck(bac) set to on.\n"
"All code executed from debugger is bypassing "
"access check!");
client.setDebuggerClientBypassCheck(true);
} else if (value == "off") {
client.print("BypassAccessCheck(bac) set to off");
client.setDebuggerClientBypassCheck(false);
} else {
help(client);
}
return;
}
if (var == "LogFile" || var == "lf") {
// Close the current log file handler
FILE *f = client.getLogFileHandler();
if (f != nullptr) {
fclose(f);
client.setLogFileHandler(nullptr);
}
if (value == "off") {
value = "";
} else {
// Try open the log file and error if it's not working
f = fopen(value.c_str(), "a");
if (f == nullptr) {
client.error("Cannot open log file '%s'",
value.c_str());
value = "";
client.setLogFileHandler(nullptr);
} else {
client.setLogFileHandler(f);
}
}
client.print("LogFile(lf) is set to %s", value == "" ? "off"
: value.c_str());
client.setLogFile(value);
return;
}
if (var == "PrintLevel" || var == "pl") {
int pl = strtol(value.c_str(), nullptr, 10);
if (pl > 0 && pl < DebuggerClient::MinPrintLevel) {
client.error("%d is invalid for PrintLevel(pl)", pl);
return;
}
client.setDebuggerClientPrintLevel(pl);
client.print("PrintLevel(pl) is set to %d", pl);
return;
}
if (var == "ShortPrintCharCount" || var == "cc") {
int cc = strtol(value.c_str(), nullptr, 10);
if (cc < -1) {
client.error("%d is invalid for ShortPrintCharCount(cc)", cc);
} else {
client.setDebuggerClientShortPrintCharCount(cc);
client.print("ShortPrintCharCount(cc) is set to %d", cc);
}
return;
}
if (var == "SmallStep" || var == "ss") {
if (value == "on") {
client.print("SmallStep(ss) set to on.\n");
client.setDebuggerClientSmallStep(true);
} else if (value == "off") {
client.print("SmallStep(ss) set to off");
client.setDebuggerClientSmallStep(false);
} else {
help(client);
}
return;
}
if (var == "StackArgs" || var == "sa") {
if (value == "on") {
client.print("StackArgs(sa) set to on.\n");
client.setDebuggerClientStackArgs(true);
} else if (value == "off") {
client.print("StackArgs(sa) set to off");
client.setDebuggerClientStackArgs(false);
} else {
help(client);
}
return;
}
if (var == "MaxCodeLines" || var == "mcl") {
// MaxCodeLines: a useful configuration variable for emacs/hphpd-integration
//.........这里部分代码省略.........
示例15: onClientImpl
void CmdMachine::onClientImpl(DebuggerClient &client) {
if (DebuggerCommand::displayedHelp(client)) return;
if (client.argCount() == 0) {
help(client);
return;
}
bool rpc = client.arg(1, "rpc");
if (rpc || client.arg(1, "connect")) {
if (client.argCount() != 2) {
help(client);
return;
}
string host = client.argValue(2);
int port = 0;
size_t pos = host.find(":");
if (pos != string::npos) {
if (!DebuggerClient::IsValidNumber(host.substr(pos + 1))) {
client.error("Port needs to be a number");
help(client);
return;
}
port = atoi(host.substr(pos + 1).c_str());
host = host.substr(0, pos);
}
if (rpc) {
if (client.connectRPC(host, port)) {
throw DebuggerConsoleExitException();
}
} else {
if (client.connect(host, port)) {
throw DebuggerConsoleExitException();
}
}
if (!client.initializeMachine()) {
throw DebuggerConsoleExitException();
}
return;
}
if (client.arg(1, "disconnect")) {
if (client.disconnect()) {
throw DebuggerConsoleExitException();
}
if (!client.initializeMachine()) {
throw DebuggerConsoleExitException();
}
return;
}
if (client.arg(1, "list")) {
processList(client);
return;
}
if (client.arg(1, "attach")) {
DSandboxInfoPtr sandbox;
string snum = client.argValue(2);
if (DebuggerClient::IsValidNumber(snum)) {
int num = atoi(snum.c_str());
sandbox = client.getSandbox(num);
if (!sandbox) {
processList(client, false);
sandbox = client.getSandbox(num);
if (!sandbox) {
client.error("\"%s\" is not a valid sandbox index. Choose one from "
"this list:", snum.c_str());
processList(client);
return;
}
}
} else {
int argBase = 2;
if (client.argCount() >= 2 && client.arg(2, "force")) {
m_force = true;
argBase++;
}
sandbox = DSandboxInfoPtr(new DSandboxInfo());
if (client.argCount() < argBase) {
sandbox->m_user = client.getCurrentUser();
sandbox->m_name = "default";
} else if (client.argCount() == argBase) {
sandbox->m_user = client.getCurrentUser();
sandbox->m_name = client.argValue(argBase);
} else if (client.argCount() == argBase + 1) {
sandbox->m_user = client.argValue(argBase);
sandbox->m_name = client.argValue(argBase + 1);
} else {
help(client);
return;
}
}
if (AttachSandbox(client, sandbox, m_force)) {
// Attach succeed, wait for next interrupt
throw DebuggerConsoleExitException();
}
return;
}
//.........这里部分代码省略.........