Merge pull request #671 from MihailRis/debugging-client
Debugging client
This commit is contained in:
@@ -159,6 +159,11 @@ app.get_setting_info(name: str) -> {
|
||||
|
||||
Returns a table with information about a setting. Throws an exception if the setting does not exist.
|
||||
|
||||
```lua
|
||||
app.focus()
|
||||
```
|
||||
|
||||
Brings the window to front and sets input focus.
|
||||
|
||||
```lua
|
||||
app.create_memory_device(
|
||||
|
||||
@@ -13,7 +13,16 @@ input.mousecode(mousename: str) --> int
|
||||
Returns mouse button code or -1 if unknown
|
||||
|
||||
```lua
|
||||
input.add_callback(bindname: str, callback: function)
|
||||
input.add_callback(
|
||||
-- Binding name
|
||||
bindname: str,
|
||||
-- Handler
|
||||
callback: function
|
||||
-- UI element that owns the handler (responsible for the handler's lifetime)
|
||||
[optional] owner: Element,
|
||||
-- Ignore input capture by UI elements
|
||||
[optional] istoplevel: bool
|
||||
)
|
||||
```
|
||||
|
||||
Add binding activation callback. Example:
|
||||
|
||||
@@ -82,6 +82,16 @@ socket:recv(
|
||||
-- Returns nil on error (socket is closed or does not exist).
|
||||
-- If there is no data yet, returns an empty byte array.
|
||||
|
||||
-- Asynchronous version for use in coroutines.
|
||||
-- Waits for the entire specified number of bytes to be received.
|
||||
-- If socket closes, function works like socket:recv
|
||||
socket:recv_async(
|
||||
-- Size of the byte array to read
|
||||
length: int,
|
||||
-- Use table instead of Bytearray
|
||||
[optional] usetable: bool=false
|
||||
) -> nil|table|Bytearray
|
||||
|
||||
-- Closes the connection
|
||||
socket:close()
|
||||
|
||||
@@ -137,5 +147,5 @@ network.get_total_download() --> int
|
||||
|
||||
```lua
|
||||
-- Looks for a free port to use.
|
||||
network.find_free_port() --> int
|
||||
network.find_free_port() --> int or nil
|
||||
```
|
||||
|
||||
@@ -136,6 +136,7 @@ The key code for comparison can be obtained via `input.keycode("key_name")`
|
||||
- `text-wrap` - allows automatic text wrapping (works only with multiline: "true")
|
||||
- `editable` - determines whether the text can be edited.
|
||||
- `line-numbers` - enables line numbers display.
|
||||
- `keep-line-selection` - keep showing selected line after defocus.
|
||||
- `error-color` - color when entering incorrect data (the text does not pass the validator check). Type: RGBA color.
|
||||
- `text-color` - text color. Type: RGBA color.
|
||||
- `validator` - lua function that checks text for correctness. Takes a string as input, returns true if the text is correct.
|
||||
|
||||
@@ -161,6 +161,11 @@ app.get_setting_info(name: str) -> {
|
||||
Возвращает таблицу с информацией о настройке. Бросает исключение, если настройки не существует.
|
||||
|
||||
```lua
|
||||
app.focus()
|
||||
```
|
||||
|
||||
Переводит окно на передний план и устанавливает фокус ввода.
|
||||
|
||||
app.create_memory_device(
|
||||
-- имя точки входа
|
||||
name: str
|
||||
|
||||
@@ -13,7 +13,16 @@ input.mousecode(mousename: str) --> int
|
||||
Возвращает код кнопки мыши по имени, либо -1
|
||||
|
||||
```lua
|
||||
input.add_callback(bindname: str, callback: function)
|
||||
input.add_callback(
|
||||
-- Имя привязки
|
||||
bindname: str,
|
||||
-- Обработчик
|
||||
callback: function
|
||||
-- UI элемент-владелец обработчика (отвечает за срок жизни)
|
||||
[опционально] owner: Element,
|
||||
-- Игнорировать захват ввода UI элементами
|
||||
[опционально] istoplevel: bool
|
||||
)
|
||||
```
|
||||
|
||||
Назначает функцию, которая будет вызываться при активации привязки. Пример:
|
||||
|
||||
@@ -82,6 +82,16 @@ socket:recv(
|
||||
-- В случае ошибки возвращает nil (сокет закрыт или несуществует).
|
||||
-- Если данных пока нет, возвращает пустой массив байт.
|
||||
|
||||
-- Асинхронный вариант для использования в корутинах.
|
||||
-- Ожидает получение всего указанного числа байт.
|
||||
-- При закрытии сокета работает как socket:recv
|
||||
socket:recv_async(
|
||||
-- Размер читаемого массива байт
|
||||
length: int,
|
||||
-- Использовать таблицу вместо Bytearray
|
||||
[опционально] usetable: bool=false
|
||||
) -> nil|table|Bytearray
|
||||
|
||||
-- Закрывает соединение
|
||||
socket:close()
|
||||
|
||||
@@ -202,5 +212,5 @@ network.get_total_download() --> int
|
||||
|
||||
```lua
|
||||
-- Ищет свободный для использования порт.
|
||||
network.find_free_port() --> int
|
||||
network.find_free_port() --> int или nil
|
||||
```
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
- `text-wrap` - разрешает автоматический перенос текста (работает только при multiline: "true")
|
||||
- `editable`- определяет возможность редактирования текста.
|
||||
- `line-numbers` - включает отображение номеров строк.
|
||||
- `keep-line-selection` - продолжать отображать выбранную строку при потере фокуса.
|
||||
- `error-color` - цвет при вводе некорректных данных (текст не проходит проверку валидатора). Тип: RGBA цвет.
|
||||
- `text-color` - цвет текста. Тип: RGBA цвет.
|
||||
- `validator` - lua функция, проверяющая текст на корректность. Принимает на вход строку, возвращает true если текст корректен.
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
# VC-DBG protocol v1
|
||||
|
||||
## Notes
|
||||
|
||||
- '?' in name means that the attribute is optional.
|
||||
|
||||
## Connecting
|
||||
|
||||
### Step 1
|
||||
|
||||
Connection initiating with binary header exchange:
|
||||
|
||||
```
|
||||
'v' 'c' '-' 'd' 'b' 'g' NUL XX
|
||||
76 63 2D 64 62 67 00 XX
|
||||
```
|
||||
|
||||
XX - protocol version number
|
||||
|
||||
Client sends header to the server. Then server responds.
|
||||
Server closes connection after sending header if it mismatches.
|
||||
|
||||
### Step 2
|
||||
|
||||
Client sends 'connect' command.
|
||||
|
||||
## Messages
|
||||
|
||||
Message is:
|
||||
- 32 bit little-endian unsigned integer - number of encoded message bytes.
|
||||
- message itself (UTF-8 encoded json).
|
||||
|
||||
## Client-to-server
|
||||
|
||||
### Establishing connection
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "connect",
|
||||
"?disconnect-action": "resume|detach|terminate"
|
||||
}
|
||||
```
|
||||
|
||||
Configuring connection. Disconnect-action is action that debugged instance must perform on debugging client connection closed/refused.
|
||||
|
||||
- `resume` - Resume from pause mode and start listening for client.
|
||||
- `detach` - Resume from pause mode and stop server.
|
||||
- `terminate` - Stop the debugged application.
|
||||
|
||||
|
||||
### Specific action signals.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "pause|resume|terminate|detach"
|
||||
}
|
||||
```
|
||||
|
||||
### Breakpoints management
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "set-breakpoint|remove-breakpoint",
|
||||
"source": "entry_point:path",
|
||||
"line": 1
|
||||
}
|
||||
```
|
||||
|
||||
### Local value details request
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "get-value",
|
||||
"frame": 0,
|
||||
"local": 1,
|
||||
"path": ["path", "to", 1, "value"]
|
||||
}
|
||||
```
|
||||
|
||||
- `frame` - Call stack frame index (indexing from most recent call)
|
||||
- `local` - Local variable index (based on `paused` event stack trace)
|
||||
- `path` - Requsted value path segments. Example: `['a', 'b', 5]` is `local_variable.a.b[5]`
|
||||
|
||||
Responds with:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "value",
|
||||
"frame": 0,
|
||||
"local": 1,
|
||||
"path": ["path", "to", 1, "value"],
|
||||
"value": "value itself"
|
||||
}
|
||||
```
|
||||
|
||||
Example: actual value is table:
|
||||
```lua
|
||||
{a=5, b="test", 2={}}
|
||||
```
|
||||
|
||||
Then `value` is:
|
||||
```json
|
||||
{
|
||||
"a": {
|
||||
"type": "number",
|
||||
"short": "5"
|
||||
},
|
||||
"b": {
|
||||
"type": "string",
|
||||
"short": "test"
|
||||
},
|
||||
"1": {
|
||||
"type": "table",
|
||||
"short": "{...}"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Server-to-client
|
||||
|
||||
### Response signals
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "success|resumed"
|
||||
}
|
||||
```
|
||||
|
||||
### Pause event
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "paused",
|
||||
"?reason": "breakpoint|exception|step",
|
||||
"?message": "...",
|
||||
"?stack": [
|
||||
{
|
||||
"?function": "function name",
|
||||
"source": "source name",
|
||||
"what": "what",
|
||||
"line": 1,
|
||||
"locals": [
|
||||
"name": {
|
||||
"type": "local type",
|
||||
"index": 1,
|
||||
"short": "short value",
|
||||
"size": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user