当前位置: 首页>>代码示例>>C++>>正文


C++ StackTrace::toString方法代码示例

本文整理汇总了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()));
  }
}
开发者ID:Jostein,项目名称:hiphop-php,代码行数:32,代码来源:ext_error.cpp

示例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());
  }
}
开发者ID:7755373049,项目名称:hiphop-php,代码行数:33,代码来源:ext_error.cpp

示例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);
}
开发者ID:,项目名称:,代码行数:11,代码来源:

示例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());
  }
}
开发者ID:RdeWilde,项目名称:hhvm,代码行数:51,代码来源:ext_error.cpp

示例5:

std::string libmaus2::util::StackTrace::getStackTrace(bool translate)
{
	StackTrace st;
	return st.toString(translate);
}
开发者ID:jameslz,项目名称:libmaus2,代码行数:5,代码来源:StackTrace.cpp


注:本文中的StackTrace::toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。