StuBS
|
#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"
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) |
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) |
static int | encodeHex (char *buf, size_t buf_len, const State::Register reg) |
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) |
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. | |
#define token_remaining_buf (pkt_len-(ptr_next-pkt_buf)) |
#define token_expect_seperator | ( | c | ) |
#define token_expect_integer_arg | ( | arg | ) |
|
static |
Get the corresponding ASCII hex digit character for a value.
val | value |
-1
if invalid
|
static |
Comparison of two strings.
a | first string |
b | second string |
len | maximum length to compare |
true
if identical (up to the maximum length)
|
static |
Copy string (including \0
)
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 -1 if it should be determined by the \0 byte) |
|
static |
Concatenate a source string to the target buffer.
target | Pointer to target buffer |
target_len | Maximum length of target buffer |
source | Pointer to source buffer |
Concatenate a source string to the target buffer
source_len | Maximum length of source buffer (or -1 if it should be determined by the \0 byte) |
|
static |
Get the corresponding value for a ASCII digit character.
digit | ASCII digit character |
base | Base to convert (supports bases 2 to 16) |
-1
if invalid
|
static |
Determine if this is a printable ASCII character.
ch | character to check |
true | printable |
false | not printable |
|
static |
Get integer value for a string representation.
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 with 0x or 0X it 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 . |
|
static |
Decode data from its hex-value representation to a buffer.
buf | Source buffer with encoded data |
buf_len | Size of source buffer |
data | Target data buffer (raw representation) |
data_len | Size if target data |
0 | on success |
-1` | if the buffer is too small |
|
static |
Encode data to its binary representation in a buffer.
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 |
-1
if the buffer is too small Decode data from its bin-value representation to a buffer.
buf | Source buffer with encoded data |
buf_len | Size of source buffer |
data | Target data buffer (raw representation) |
data_len | Size if target data |
-1
if the buffer is too small
|
static |
|
static |
Map operations to core.