Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: experimental/visual_studio_plugin/src/debug_conn/debug_packet.h

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2011 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can
4 * be found in the LICENSE file.
5 */
6
7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_DEBUG_STUB_DEBUG_PACKET_H_
8 #define NATIVE_CLIENT_SRC_TRUSTED_DEBUG_STUB_DEBUG_PACKET_H_ 1
9
10 #include <sstream>
11
12 /*
13 * This module provides interfaces for creating and viewing debug
14 * packets that conform to the GDB serial line debug protocol. The packet
15 * must not contain the special characters '$' or '#' which are used by
16 * the transport/framing layer to denote start and end of packets.
17 *
18 * All binary is expected to be cooked and convered into a pair of hex
19 * nibbles per byte. Data is stored as a stream, where the first char
20 * is expected to be and uncooked command ID, followed by optional
21 * arguments which may be raw or cooked.
22 *
23 * In addition, packets may be sequenced by setting an 8 bit sequence number,
24 * which helps both sides detect when packets have been lost. By default the
25 * sequence number is not set.
26 */
27
28 #include "native_client/src/include/nacl_base.h"
29 #include "native_client/src/include/portability.h"
30
31 namespace nacl_debug_conn {
32
33 class DebugPacket {
34 public:
35 DebugPacket();
36
37 public:
38 void Clear();
39 void Rewind();
40
41 void AddRawChar(char ch);
42 void AddByte(uint8_t ch);
43 void AddBlock(void *ptr, int len);
44 void AddString(const char *str);
45 void AddHexString(const char *str);
46 void AddPointer(void *ptr);
47 void AddWord16(uint16_t val);
48 void AddWord32(uint32_t val);
49 void AddWord64(uint64_t val);
50 void AddNumberSep(uint64_t val, char sep);
51
52 public:
53 bool GetRawChar(char *ch);
54 bool GetByte(uint8_t *ch);
55 bool GetBlock(void *ptr, int len);
56 bool GetString(const char **str);
57 bool PeekString(const char **ppstr);
58 bool PeekChar(char *ch);
59 bool GetHexString(const char **str);
60 bool GetPointer(void **ptr);
61 bool GetWord16(uint16_t *val);
62 bool GetWord32(uint32_t *val);
63 bool GetWord64(uint64_t *val);
64 bool GetNumberSep(uint64_t *val, char *sep);
65
66 int Read(void *ptr, int len);
67 public:
68 // GetSequence and SetSequence are DEPRECATED. We are not sending sequence
69 // numbers or checking them anymore
70 bool GetSequence(int32_t *seq) const;
71 void SetSequence(int32_t seq);
72
73 public:
74 const char *GetPayload() const;
75
76 private:
77 int seq;
78 std::stringstream data;
79 };
80
81 } // namespace nacl_debug_conn
82
83 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698