Add conn conn_pop_packet.
This commit is contained in:
parent
b9bef6a9af
commit
9ac39e6a12
|
@ -5,11 +5,13 @@
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "(gdb) Launch",
|
"name": "mini-gdbstub",
|
||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/mini-gdbstub/build/emu",
|
"program": "${workspaceFolder}/mini-gdbstub/build/emu",
|
||||||
"args": ["./mini-gdbstub/build/emu_test.bin"],
|
"args": [
|
||||||
|
"./mini-gdbstub/build/emu_test.bin"
|
||||||
|
],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "${workspaceFolder}/mini-gdbstub",
|
"cwd": "${workspaceFolder}/mini-gdbstub",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
|
@ -27,7 +29,30 @@
|
||||||
"ignoreFailures": true
|
"ignoreFailures": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "gdbstub",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/gdbstub/build/stub",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceFolder}/gdbstub",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Set Disassembly Flavor to Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -8,5 +8,11 @@ int main(int argc, char *argv[]) {
|
||||||
conn_t conn;
|
conn_t conn;
|
||||||
if (!conn_init(&conn, "127.0.0.1", 1234)) std::cout << "conn_init error" << std::endl;
|
if (!conn_init(&conn, "127.0.0.1", 1234)) std::cout << "conn_init error" << std::endl;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
conn_recv_packet(&conn);
|
||||||
|
packet_t *pkt = conn_pop_packet(&conn);
|
||||||
|
printf("packet = %s\n", pkt->data);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
|
||||||
#define MAX_SEND_PACKET_SIZE (0x1000)
|
#define MAX_SEND_PACKET_SIZE (0x1000)
|
||||||
|
|
Loading…
Reference in New Issue