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


C++ LogSP::GetVerbose方法代码示例

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


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

示例1: locker

bool
CommunicationKDP::CheckForPacket (const uint8_t *src, size_t src_len, DataExtractor &packet)
{
    // Put the packet data into the buffer in a thread safe fashion
    Mutex::Locker locker(m_bytes_mutex);

    LogSP log (ProcessKDPLog::GetLogIfAllCategoriesSet (KDP_LOG_PACKETS));

    if (src && src_len > 0)
    {
        if (log && log->GetVerbose())
        {
            PacketStreamType log_strm;
            DataExtractor::DumpHexBytes (&log_strm, src, src_len, UINT32_MAX, LLDB_INVALID_ADDRESS);
            log->Printf ("CommunicationKDP::%s adding %u bytes: %s",
                         __FUNCTION__,
                         (uint32_t)src_len,
                         log_strm.GetData());
        }
        m_bytes.append ((const char *)src, src_len);
    }

    // Make sure we at least have enough bytes for a packet header
    const size_t bytes_available = m_bytes.size();
    if (bytes_available >= 8)
    {
        packet.SetData (&m_bytes[0], bytes_available, m_byte_order);
        uint32_t offset = 0;
        uint8_t reply_command = packet.GetU8(&offset);
        switch (reply_command)
        {
        case ePacketTypeRequest | KDP_EXCEPTION:
        case ePacketTypeRequest | KDP_TERMINATION:
            // We got an exception request, so be sure to send an ACK
        {
            PacketStreamType request_ack_packet (Stream::eBinary, m_addr_byte_size, m_byte_order);
            // Set the reply but and make the ACK packet
            request_ack_packet.PutHex8 (reply_command | ePacketTypeReply);
            request_ack_packet.PutHex8 (packet.GetU8(&offset));
            request_ack_packet.PutHex16 (packet.GetU16(&offset));
            request_ack_packet.PutHex32 (packet.GetU32(&offset));
            m_is_running.SetValue(false, eBroadcastAlways);
            // Ack to the exception or termination
            SendRequestPacketNoLock (request_ack_packet);
        }
        // Fall through to case below to get packet contents
        case ePacketTypeReply | KDP_CONNECT:
        case ePacketTypeReply | KDP_DISCONNECT:
        case ePacketTypeReply | KDP_HOSTINFO:
        case ePacketTypeReply | KDP_VERSION:
        case ePacketTypeReply | KDP_MAXBYTES:
        case ePacketTypeReply | KDP_READMEM:
        case ePacketTypeReply | KDP_WRITEMEM:
        case ePacketTypeReply | KDP_READREGS:
        case ePacketTypeReply | KDP_WRITEREGS:
        case ePacketTypeReply | KDP_LOAD:
        case ePacketTypeReply | KDP_IMAGEPATH:
        case ePacketTypeReply | KDP_SUSPEND:
        case ePacketTypeReply | KDP_RESUMECPUS:
        case ePacketTypeReply | KDP_BREAKPOINT_SET:
        case ePacketTypeReply | KDP_BREAKPOINT_REMOVE:
        case ePacketTypeReply | KDP_REGIONS:
        case ePacketTypeReply | KDP_REATTACH:
        case ePacketTypeReply | KDP_HOSTREBOOT:
        case ePacketTypeReply | KDP_READMEM64:
        case ePacketTypeReply | KDP_WRITEMEM64:
        case ePacketTypeReply | KDP_BREAKPOINT_SET64:
        case ePacketTypeReply | KDP_BREAKPOINT_REMOVE64:
        case ePacketTypeReply | KDP_KERNELVERSION:
        {
            offset = 2;
            const uint16_t length = packet.GetU16 (&offset);
            if (length <= bytes_available)
            {
                // We have an entire packet ready, we need to copy the data
                // bytes into a buffer that will be owned by the packet and
                // erase the bytes from our communcation buffer "m_bytes"
                packet.SetData (DataBufferSP (new DataBufferHeap (&m_bytes[0], length)));
                m_bytes.erase (0, length);

                if (log)
                {
                    PacketStreamType log_strm;
                    DumpPacket (log_strm, packet);

                    log->Printf("%.*s", (uint32_t)log_strm.GetSize(), log_strm.GetData());
                }
                return true;
            }
        }
        break;

        default:
            // Unrecognized reply command byte, erase this byte and try to get back on track
            if (log)
                log->Printf ("CommunicationKDP::%s: tossing junk byte: 0x%2.2x",
                             __FUNCTION__,
                             (uint8_t)m_bytes[0]);
            m_bytes.erase(0, 1);
            break;
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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