<commit_before>//===-- GDBRemoteCommunicationServer.h --------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_GDBRemoteCommunicationServer_h_
#define liblldb_GDBRemoteCommunicationServer_h_

// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private-forward.h"
#include "GDBRemoteCommunication.h"

class ProcessGDBRemote;
class StringExtractorGDBRemote;

class GDBRemoteCommunicationServer :
    public GDBRemoteCommunication
{
public:
    using PortMap = std::map<uint16_t, lldb::pid_t>;
    using PacketHandler = std::function<PacketResult(StringExtractorGDBRemote &packet,
                                                     lldb_private::Error &error,
                                                     bool &interrupt,
                                                     bool &quit)>;

    GDBRemoteCommunicationServer(const char *comm_name,
                                 const char *listener_name);

    virtual
    ~GDBRemoteCommunicationServer();

    void RegisterPacketHandler(StringExtractorGDBRemote::ServerPacketType packet_type,
                               PacketHandler handler);

    PacketResult
    GetPacketAndSendResponse (uint32_t timeout_usec,
                              lldb_private::Error &error,
                              bool &interrupt, 
                              bool &quit);

    // After connecting, do a little handshake with the client to make sure
    // we are at least communicating
    bool
    HandshakeWithClient (lldb_private::Error *error_ptr);

protected:
    std::map<StringExtractorGDBRemote::ServerPacketType, PacketHandler> m_packet_handlers;
    bool m_exit_now; // use in asynchronous handling to indicate process should exit.

    PacketResult
    SendUnimplementedResponse (const char *packet);

    PacketResult
    SendErrorResponse (uint8_t error);

    PacketResult
    SendIllFormedResponse (const StringExtractorGDBRemote &packet, const char *error_message);

    PacketResult
    SendOKResponse ();

private:
    //------------------------------------------------------------------
    // For GDBRemoteCommunicationServer only
    //------------------------------------------------------------------
    DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationServer);
};

#endif  // liblldb_GDBRemoteCommunicationServer_h_
<commit_msg>Fix windows build (broken by r228823)<commit_after>//===-- GDBRemoteCommunicationServer.h --------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_GDBRemoteCommunicationServer_h_
#define liblldb_GDBRemoteCommunicationServer_h_

// C Includes
// C++ Includes
#include <functional>
#include <map>

// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private-forward.h"
#include "GDBRemoteCommunication.h"

class ProcessGDBRemote;
class StringExtractorGDBRemote;

class GDBRemoteCommunicationServer :
    public GDBRemoteCommunication
{
public:
    using PortMap = std::map<uint16_t, lldb::pid_t>;
    using PacketHandler = std::function<PacketResult(StringExtractorGDBRemote &packet,
                                                     lldb_private::Error &error,
                                                     bool &interrupt,
                                                     bool &quit)>;

    GDBRemoteCommunicationServer(const char *comm_name,
                                 const char *listener_name);

    virtual
    ~GDBRemoteCommunicationServer();

    void RegisterPacketHandler(StringExtractorGDBRemote::ServerPacketType packet_type,
                               PacketHandler handler);

    PacketResult
    GetPacketAndSendResponse (uint32_t timeout_usec,
                              lldb_private::Error &error,
                              bool &interrupt, 
                              bool &quit);

    // After connecting, do a little handshake with the client to make sure
    // we are at least communicating
    bool
    HandshakeWithClient (lldb_private::Error *error_ptr);

protected:
    std::map<StringExtractorGDBRemote::ServerPacketType, PacketHandler> m_packet_handlers;
    bool m_exit_now; // use in asynchronous handling to indicate process should exit.

    PacketResult
    SendUnimplementedResponse (const char *packet);

    PacketResult
    SendErrorResponse (uint8_t error);

    PacketResult
    SendIllFormedResponse (const StringExtractorGDBRemote &packet, const char *error_message);

    PacketResult
    SendOKResponse ();

private:
    //------------------------------------------------------------------
    // For GDBRemoteCommunicationServer only
    //------------------------------------------------------------------
    DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationServer);
};

#endif  // liblldb_GDBRemoteCommunicationServer_h_

{'fraction_non_alphanumeric': 0.15639097744360902, 'fraction_numerical': 0.0030075187969924814, 'mean_word_length': 1.871559633027523, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2652680', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1290, 'n_words': 311}