C++ Crashkurs
#include "debug/gdb/stub.h"#include "debug/gdb/state.h"#include "machine/apic.h"#include "machine/core.h"#include "machine/system.h"#include "debug/assert.h"#include "debug/output.h"
Include dependency graph for protocol.cc:Macros | |
| #define | token_remaining_buf (pkt_len-(ptr_next-pkt_buf)) |
| #define | token_expect_seperator(c) |
| #define | token_expect_integer_arg(arg) |
Functions | |
| static char | getDigit (int val) |
| Get the corresponding ASCII hex digit character for a value. | |
| static bool | stringCompare (const char *a, const char *b, size_t len) |
| Comparison of two strings. | |
| static size_t | stringCopy (char *target, size_t target_len, const char *source, size_t source_len=-1) |
Copy string (including \0) | |
| static size_t | stringConcat (char *target, size_t target_len, const char *source, size_t source_len=-1) |
| Concatenate a source string to the target buffer. | |
| static size_t | stringConcat (char *target, size_t target_len, char source) |
| Concatenate a character to the target buffer. | |
| static int | getValue (char digit, int base) |
| Get the corresponding value for a ASCII digit character. | |
| static bool | isPrintableChar (char ch) |
| Determine if this is a printable ASCII character. | |
| static intptr_t | stringToInteger (const char *str, size_t len, int base, const char **endptr) |
| Get integer value for a string representation. | |
| static int | encodeHex (char *buf, size_t buf_len, const char *data, size_t data_len) |
| Encode data to its hex-value representation in a buffer. | |
| static int | encodeHex (char *buf, size_t buf_len, const State::Register data) |
| Encode data to its hex-value representation in a buffer. | |
| static int | decodeHex (const char *buf, size_t buf_len, char *data, size_t data_len) |
| Decode data from its hex-value representation to a buffer. | |
| static int | decodeHex (const char *buf, size_t buf_len, State::Register reg) |
| Decode data from its hex-value representation to a buffer. | |
| static int | encodeBinary (char *buf, size_t buf_len, const char *data, size_t data_len) |
| Encode data to its binary representation in a buffer. | |
| static int | decodeBinary (const char *buf, size_t buf_len, char *data, size_t data_len) |
| Decode data from its bin-value representation to a buffer. | |
Constants | |
| static const char | digits [] = "0123456789abcdef" |
| static int8_t | cpu_ops [127] |
| Map operations to core. | |
Macro Definition Documentation
| #define token_remaining_buf (pkt_len-(ptr_next-pkt_buf)) |
| #define token_expect_seperator | ( | c | ) |
| #define token_expect_integer_arg | ( | arg | ) |
Function Documentation
|
static |
Get the corresponding ASCII hex digit character for a value.
- Parameters
-
val value
- Returns
- ASCII hex digit or
-1if invalid
|
static |
Comparison of two strings.
- Parameters
-
a first string b second string len maximum length to compare
- Returns
trueif identical (up to the maximum length)
|
static |
Copy string (including \0)
- Parameters
-
target Pointer to target buffer target_len Maximum length of target buffer source Pointer to source buffer source_len Maximum length of source buffer (or -1if it should be determined by the\0byte)
- Returns
- Number of copied characters (bytes)
|
static |
Concatenate a source string to the target buffer.
- Parameters
-
target Pointer to target buffer target_len Maximum length of target buffer source Pointer to source buffer source_len Maximum length of source buffer (or -1if it should be determined by the\0byte)
- Returns
- New length of target buffer
Concatenate a character to the target buffer.
Overloads singConcat(char*, size_t, const char*, size_t)
- Parameters
-
target Pointer to target buffer target_len Maximum length of target buffer source Source character
- Returns
- New length of target buffer
|
static |
Get the corresponding value for a ASCII digit character.
- Parameters
-
digit ASCII digit character base Base to convert (supports bases 2 to 16)
- Returns
- value or
-1if invalid
|
static |
Determine if this is a printable ASCII character.
- Parameters
-
ch character to check
- Return values
-
true printable false not printable
|
static |
Get integer value for a string representation.
- Parameters
-
str String to convert. It it starts with +or-it will be signed accordingly.len length of string base Base for the conversion. In case the value is set to 0, the base will be determined: if string starts with0xor0Xit is hexadecimal (base 16), otherwise decimal representation (base 10).endptr If specified, it will point to the last non-digit in the string. If there are no digits in the string, it will be set to nullptr.
- Returns
- recognized integer
Encode data to its hex-value representation in a buffer.
- Parameters
-
buf Pointer to target buffer for encoded data buf_len Size of target buffer data Source data buffer (raw representation) data_len Size if source data
- Returns
- number of bytes written to target buffer or
-1if the buffer is too small
|
static |
Encode data to its hex-value representation in a buffer.
Overloads encodeHex(char*, size_t, const char*, size_t)
- Parameters
-
buf Pointer to target buffer for encoded data buf_len Size of target buffer data Source register
- Returns
- number of bytes written to target buffer or
-1if the buffer is too small
Decode data from its hex-value representation to a buffer.
- Parameters
-
buf Source buffer with encoded data buf_len Size of source buffer data Target data buffer (raw representation) data_len Size if target data
- Return values
-
0 on success -1` if the buffer is too small
|
static |
Decode data from its hex-value representation to a buffer.
Overloads decodeHex(const char*, size_t, char*, size_t)
- Parameters
-
buf Source buffer with encoded data buf_len Size of source buffer reg Target register
- Return values
-
0 on success -1` if the buffer is too small
Encode data to its binary representation in a buffer.
- Parameters
-
buf Pointer to target buffer for encoded data buf_len Size of target buffer data Source data buffer (raw representation) data_len Size if source data
- Returns
- number of bytes written to target buffer or
-1if the buffer is too small
Decode data from its bin-value representation to a buffer.
- Parameters
-
buf Source buffer with encoded data buf_len Size of source buffer data Target data buffer (raw representation) data_len Size if target data
- Returns
- number of bytes decoded or
-1if the buffer is too small
Variable Documentation
|
static |
|
static |
Map operations to core.