本文整理汇总了C++中StackTrace::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ StackTrace::toString方法的具体用法?C++ StackTrace::toString怎么用?C++ StackTrace::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StackTrace
的用法示例。
在下文中一共展示了StackTrace::toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: f_debug_print_backtrace
void f_debug_print_backtrace() {
if (RuntimeOption::InjectedStackTrace) {
Array bt = FrameInjection::GetBacktrace(true);
int i = 0;
for (ArrayIter it = bt.begin(); !it.end(); it.next(), i++) {
Array frame = it.second().toArray();
StringBuffer buf;
buf.append('#');
buf.append(i);
if (i < 10) buf.append(' ');
buf.append(' ');
if (frame.exists("class")) {
buf.append(frame->get("class").toString());
buf.append(frame->get("type").toString());
}
buf.append(frame->get("function").toString());
buf.append("()");
if (frame.exists("file")) {
buf.append(" called at [");
buf.append(frame->get("file").toString());
buf.append(':');
buf.append(frame->get("line").toString());
buf.append(']');
}
buf.append('\n');
echo(buf.detach());
}
} else {
StackTrace st;
echo(String(st.toString()));
}
}
示例2: debug_string_backtrace
String debug_string_backtrace(bool skip) {
if (RuntimeOption::InjectedStackTrace) {
Array bt;
StringBuffer buf;
bt = g_vmContext->debugBacktrace(skip);
int i = 0;
for (ArrayIter it = bt.begin(); !it.end(); it.next(), i++) {
Array frame = it.second().toArray();
buf.append('#');
buf.append(i);
if (i < 10) buf.append(' ');
buf.append(' ');
if (frame.exists(s_class)) {
buf.append(frame->get(s_class).toString());
buf.append(frame->get(s_type).toString());
}
buf.append(frame->get(s_function).toString());
buf.append("()");
if (frame.exists(s_file)) {
buf.append(" called at [");
buf.append(frame->get(s_file).toString());
buf.append(':');
buf.append(frame->get(s_line).toString());
buf.append(']');
}
buf.append('\n');
}
return buf.detach();
} else {
StackTrace st;
return String(st.toString());
}
}
示例3: setStackTrace
void StructuredLogEntry::setStackTrace(folly::StringPiece key,
const StackTrace& st) {
std::vector<folly::StringPiece> stackFrames;
folly::split("\n", st.toString(), stackFrames);
for (auto& frame : stackFrames) {
const char* p = frame.begin();
while (*p == '#' || *p == ' ' || (*p >= '0' && *p <= '9')) ++p;
frame = folly::StringPiece(p, frame.end());
}
setVec(key, stackFrames);
}
示例4: debug_string_backtrace
String debug_string_backtrace(bool skip, bool ignore_args /* = false */,
int limit /* = 0 */) {
if (RuntimeOption::InjectedStackTrace) {
Array bt;
StringBuffer buf;
bt = g_context->debugBacktrace(skip, false, false, nullptr,
ignore_args, limit);
int i = 0;
for (ArrayIter it = bt.begin(); !it.end(); it.next(), i++) {
Array frame = it.second().toArray();
buf.append('#');
buf.append(i);
if (i < 10) buf.append(' ');
buf.append(' ');
if (frame.exists(s_class)) {
buf.append(frame->get(s_class).toString());
buf.append(frame->get(s_type).toString());
}
buf.append(frame->get(s_function).toString());
buf.append("(");
if (!ignore_args) {
bool first = true;
for (ArrayIter it = frame->get(s_args).begin(); !it.end(); it.next()) {
if (!first) {
buf.append(", ");
} else {
first = false;
}
try {
buf.append(it.second().toString());
} catch (FatalErrorException& fe) {
buf.append(fe.getMessage());
}
}
}
buf.append(")");
if (frame.exists(s_file)) {
buf.append(" called at [");
buf.append(frame->get(s_file).toString());
buf.append(':');
buf.append(frame->get(s_line).toString());
buf.append(']');
}
buf.append('\n');
}
return buf.detach();
} else {
StackTrace st;
return String(st.toString());
}
}
示例5:
std::string libmaus2::util::StackTrace::getStackTrace(bool translate)
{
StackTrace st;
return st.toString(translate);
}