Added mock gdbstub implementation

This commit is contained in:
2023-10-05 23:04:59 +02:00
parent 378d0fa463
commit 5b020b0444
5 changed files with 99 additions and 1 deletions
+13 -1
View File
@@ -7,6 +7,7 @@
uint64_t memory_size = 512 * 1024 * 1024;
char* file_path;
bool gdbstub = false;
static void print_usage();
static void print_help();
@@ -94,6 +95,11 @@ void parse_options(int argc, char** argv)
break;
}
case 's':
{
gdbstub = true;
break;
}
default:
{
fprintf(stderr, "Error: Unknown short option -%c\n", argv[i][k]);
@@ -150,6 +156,11 @@ static int parse_long_option(char* str, char* argq)
return 1;
}
else if(strcmp(str, "gdb-stub") == 0)
{
gdbstub = true;
return 0;
}
else
{
fprintf(stderr, "Error: Unknown long option " OPTION_SEPARATOR OPTION_SEPARATOR "%s\n", str);
@@ -169,7 +180,8 @@ static void print_help()
printf("Options:\n");
printf(" " OPTION_SEPARATOR "h, " OPTION_SEPARATOR "?, --help\t\tPrint this help message\n");
printf(" " OPTION_SEPARATOR "v, --version\t\t\tPrint version information\n");
printf(" " OPTION_SEPARATOR "m, --memory\t\t\tSet the simulated memory size, in MiB\n");
printf(" " OPTION_SEPARATOR "m, --memory\t\t\tSet the simulated memory size, in MiB (max 4096)\n");
printf(" " OPTION_SEPARATOR "s, --gdb-stub\t\t\tLaunch a gdb stub server, for remote gdb debugging\n");
}
static void print_version()