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


C++ SBStream::Printf方法代码示例

本文整理汇总了C++中SBStream::Printf方法的典型用法代码示例。如果您正苦于以下问题:C++ SBStream::Printf方法的具体用法?C++ SBStream::Printf怎么用?C++ SBStream::Printf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SBStream的用法示例。


在下文中一共展示了SBStream::Printf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

void
Driver::WriteCommandsForSourcing (CommandPlacement placement, SBStream &strm)
{
    std::vector<OptionData::InitialCmdEntry> *command_set;
    switch (placement)
    {
    case eCommandPlacementBeforeFile:
        command_set = &m_option_data.m_initial_commands;
        break;
    case eCommandPlacementAfterFile:
        command_set = &m_option_data.m_after_file_commands;
        break;
    case eCommandPlacementAfterCrash:
        command_set = &m_option_data.m_after_crash_commands;
        break;
    }
    
    for (const auto &command_entry : *command_set)
    {
        const char *command = command_entry.contents.c_str();
        if (command_entry.is_file)
        {
            bool source_quietly = m_option_data.m_source_quietly || command_entry.source_quietly;
            strm.Printf("command source -s %i '%s'\n", source_quietly, command);
        }
        else
            strm.Printf("%s\n", command);
    }
}
开发者ID:wiltonlazary,项目名称:swift-lldb,代码行数:29,代码来源:Driver.cpp

示例2: switch

void
Driver::WriteCommandsForSourcing (CommandPlacement placement, SBStream &strm)
{
    std::vector<OptionData::InitialCmdEntry> *command_set;
    switch (placement)
    {
    case eCommandPlacementBeforeFile:
        command_set = &m_option_data.m_initial_commands;
        break;
    case eCommandPlacementAfterFile:
        command_set = &m_option_data.m_after_file_commands;
        break;
    case eCommandPlacementAfterCrash:
        command_set = &m_option_data.m_after_crash_commands;
        break;
    }
    
    for (const auto &command_entry : *command_set)
    {
        const char *command = command_entry.contents.c_str();
        if (command_entry.is_file)
        {
            // If this command_entry is a file to be sourced, and it's the ./.lldbinit file (the .lldbinit
            // file in the current working directory), only read it if target.load-cwd-lldbinit is 'true'.
            if (command_entry.is_cwd_lldbinit_file_read)
            {
                SBStringList strlist = m_debugger.GetInternalVariableValue ("target.load-cwd-lldbinit", 
                                                                            m_debugger.GetInstanceName());
                if (strlist.GetSize() == 1 && strcmp (strlist.GetStringAtIndex(0), "warn") == 0)
                {
                    FILE *output = m_debugger.GetOutputFileHandle ();
                    ::fprintf (output, 
                            "There is a .lldbinit file in the current directory which is not being read.\n"
                            "To silence this warning without sourcing in the local .lldbinit,\n"
                            "add the following to the lldbinit file in your home directory:\n"
                            "    settings set target.load-cwd-lldbinit false\n"
                            "To allow lldb to source .lldbinit files in the current working directory,\n"
                            "set the value of this variable to true.  Only do so if you understand and\n"
                            "accept the security risk.\n");
                    return;
                }
                if (strlist.GetSize() == 1 && strcmp (strlist.GetStringAtIndex(0), "false") == 0)
                {
                    return;
                }
            }
            bool source_quietly = m_option_data.m_source_quietly || command_entry.source_quietly;
            strm.Printf("command source -s %i '%s'\n", source_quietly, command);
        }
        else
            strm.Printf("%s\n", command);
    }
}
开发者ID:32bitmicro,项目名称:riscv-lldb,代码行数:53,代码来源:Driver.cpp

示例3:

bool
SBFileSpec::GetDescription (SBStream &description) const
{
    if (m_opaque_ap.get())
    {
        char path[PATH_MAX];
        if (m_opaque_ap->GetPath(path, sizeof(path)))
            description.Printf ("%s", path);
    }
    else
        description.Printf ("No value");
    
    return true;
}
开发者ID:eightcien,项目名称:lldb,代码行数:14,代码来源:SBFileSpec.cpp

示例4:

void
Driver::WriteInitialCommands (bool before_file, SBStream &strm)
{
    std::vector<std::pair<bool, std::string> > &command_set = before_file ? m_option_data.m_initial_commands :
                                                                            m_option_data.m_after_file_commands;
    
    for (const auto &command_pair : command_set)
    {
        const char *command = command_pair.second.c_str();
        if (command_pair.first)
            strm.Printf("command source -s %i '%s'\n", m_option_data.m_source_quietly, command);
        else
            strm.Printf("%s\n", command);
    }
}
开发者ID:chee-z,项目名称:lldb,代码行数:15,代码来源:Driver.cpp

示例5: guard

bool
SBBreakpoint::GetDescription (SBStream &s)
{
    if (m_opaque_sp)
    {
        std::lock_guard<std::recursive_mutex> guard(m_opaque_sp->GetTarget().GetAPIMutex());
        s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID());
        m_opaque_sp->GetResolverDescription (s.get());
        m_opaque_sp->GetFilterDescription (s.get());
        const size_t num_locations = m_opaque_sp->GetNumLocations ();
        s.Printf(", locations = %" PRIu64, (uint64_t)num_locations);
        return true;
    }
    s.Printf ("No value");
    return false;
}
开发者ID:Aj0Ay,项目名称:lldb,代码行数:16,代码来源:SBBreakpoint.cpp

示例6: if

bool
SBCommandReturnObject::GetDescription (SBStream &description)
{
    Stream &strm = description.ref();

    if (m_opaque_ap.get())
    {
        description.Printf ("Status:  ");
        lldb::ReturnStatus status = m_opaque_ap->GetStatus();
        if (status == lldb::eReturnStatusStarted)
            strm.PutCString ("Started");
        else if (status == lldb::eReturnStatusInvalid)
            strm.PutCString ("Invalid");
        else if (m_opaque_ap->Succeeded())
            strm.PutCString ("Success");
        else
            strm.PutCString ("Fail");

        if (GetOutputSize() > 0)
            strm.Printf ("\nOutput Message:\n%s", GetOutput());

        if (GetErrorSize() > 0)
            strm.Printf ("\nError Message:\n%s", GetError());
    }
    else
        strm.PutCString ("No value");

    return true;
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:29,代码来源:SBCommandReturnObject.cpp

示例7: sizeof

bool
SBLineEntry::GetDescription (SBStream &description)
{
    if (m_opaque_ap.get())
    {
        char file_path[PATH_MAX*2];
        m_opaque_ap->file.GetPath (file_path, sizeof (file_path));
        description.Printf ("%s:%u", file_path, GetLine());
        if (GetColumn() > 0)
            description.Printf (":%u", GetColumn());
    }
    else
        description.Printf ("No value");

    return true;
}
开发者ID:eightcien,项目名称:lldb,代码行数:16,代码来源:SBLineEntry.cpp

示例8: api_locker

bool
SBBreakpoint::GetDescription (SBStream &s)
{
    if (m_opaque_sp)
    {
        Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
        s.Printf("SBBreakpoint: id = %i, ", m_opaque_sp->GetID());
        m_opaque_sp->GetResolverDescription (s.get());
        m_opaque_sp->GetFilterDescription (s.get());
        const size_t num_locations = m_opaque_sp->GetNumLocations ();
        s.Printf(", locations = %zu", num_locations);
        return true;
    }
    s.Printf ("No value");
    return false;
}
开发者ID:carlokok,项目名称:lldb,代码行数:16,代码来源:SBBreakpoint.cpp

示例9:

bool
SBFunction::GetDescription (SBStream &s)
{
    if (m_opaque_ptr)
    {
        s.Printf ("SBFunction: id = 0x%8.8x, name = %s", 
                            m_opaque_ptr->GetID(),
                            m_opaque_ptr->GetName().AsCString());
        Type *func_type = m_opaque_ptr->GetType();
        if (func_type)
            s.Printf(", type = %s", func_type->GetName().AsCString());
        return true;
    }
    s.Printf ("No value");
    return false;
}
开发者ID:eightcien,项目名称:lldb,代码行数:16,代码来源:SBFunction.cpp

示例10: GetCString

bool
SBError::GetDescription (SBStream &description)
{
    if (m_opaque_ap.get())
    {
        if (m_opaque_ap->Success())
            description.Printf ("success");
        else
        {
            const char * err_string = GetCString();
            description.Printf ("error: %s",  (err_string != NULL ? err_string : ""));
        }
    }
    else
        description.Printf ("error: <NULL>");

    return true;
} 
开发者ID:2asoft,项目名称:freebsd,代码行数:18,代码来源:SBError.cpp

示例11:

bool
SBSymbolContext::GetDescription (SBStream &description)
{
    if (m_opaque_ap.get())
    {
        description.ref();
        m_opaque_ap->GetDescription (description.get(), lldb::eDescriptionLevelFull, NULL);
    }
    else
        description.Printf ("No value");

    return true;
}
开发者ID:eightcien,项目名称:lldb,代码行数:13,代码来源:SBSymbolContext.cpp

示例12:

bool
SBCompileUnit::GetDescription (SBStream &description)
{
    if (m_opaque_ptr)
    {
        description.ref();
        m_opaque_ptr->Dump (description.get(), false);
    }
    else
        description.Printf ("No Value");

    return true;
}
开发者ID:eightcien,项目名称:lldb,代码行数:13,代码来源:SBCompileUnit.cpp

示例13: GetTarget

bool
SBProcess::GetDescription (SBStream &description)
{
    if (m_opaque_sp)
    {
        char path[PATH_MAX];
        GetTarget().GetExecutable().GetPath (path, sizeof(path));
        Module *exe_module = m_opaque_sp->GetTarget().GetExecutableModule ().get();
        const char *exe_name = NULL;
        if (exe_module)
            exe_name = exe_module->GetFileSpec().GetFilename().AsCString();

        description.Printf ("SBProcess: pid = %d, state = %s, threads = %d%s%s", 
                            m_opaque_sp->GetID(),
                            lldb_private::StateAsCString (GetState()), 
                            GetNumThreads(),
                            exe_name ? ", executable = " : "",
                            exe_name ? exe_name : "");
    }
    else
        description.Printf ("No value");

    return true;
}
开发者ID:eightcien,项目名称:lldb,代码行数:24,代码来源:SBProcess.cpp

示例14: GetDescription

bool SBBreakpointName::GetDescription(SBStream &s) {
  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
  
  BreakpointName *bp_name = GetBreakpointName();
  if (!bp_name)
  {
    s.Printf("No value");
    return false;
  }
 
  LLDB_LOG(log, "Name: {0}\n", bp_name->GetName());
  std::lock_guard<std::recursive_mutex> guard(
        m_impl_up->GetTarget()->GetAPIMutex());
  bp_name->GetDescription(s.get(), eDescriptionLevelFull);
  return true;
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:16,代码来源:SBBreakpointName.cpp

示例15: GetInfoItemByPathAsString

bool SBThread::GetInfoItemByPathAsString(const char *path, SBStream &strm) {
  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
  bool success = false;
  std::unique_lock<std::recursive_mutex> lock;
  ExecutionContext exe_ctx(m_opaque_sp.get(), lock);

  if (exe_ctx.HasThreadScope()) {
    Process::StopLocker stop_locker;
    if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock())) {
      Thread *thread = exe_ctx.GetThreadPtr();
      StructuredData::ObjectSP info_root_sp = thread->GetExtendedInfo();
      if (info_root_sp) {
        StructuredData::ObjectSP node =
            info_root_sp->GetObjectForDotSeparatedPath(path);
        if (node) {
          if (node->GetType() == eStructuredDataTypeString) {
            strm.Printf("%s", node->GetAsString()->GetValue().str().c_str());
            success = true;
          }
          if (node->GetType() == eStructuredDataTypeInteger) {
            strm.Printf("0x%" PRIx64, node->GetAsInteger()->GetValue());
            success = true;
          }
          if (node->GetType() == eStructuredDataTypeFloat) {
            strm.Printf("0x%f", node->GetAsFloat()->GetValue());
            success = true;
          }
          if (node->GetType() == eStructuredDataTypeBoolean) {
            if (node->GetAsBoolean()->GetValue() == true)
              strm.Printf("true");
            else
              strm.Printf("false");
            success = true;
          }
          if (node->GetType() == eStructuredDataTypeNull) {
            strm.Printf("null");
            success = true;
          }
        }
      }
    } else {
      if (log)
        log->Printf("SBThread(%p)::GetInfoItemByPathAsString() => error: "
                    "process is running",
                    static_cast<void *>(exe_ctx.GetThreadPtr()));
    }
  }

  if (log)
    log->Printf("SBThread(%p)::GetInfoItemByPathAsString (\"%s\") => \"%s\"",
                static_cast<void *>(exe_ctx.GetThreadPtr()), path, strm.GetData());

  return success;
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:54,代码来源:SBThread.cpp


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