Made the command line debugger output “>” before inputs, added special magic sequence to break the debugger from stdin
This commit is contained in:
parent
0c0ca8e862
commit
08efb46d41
@ -62,6 +62,9 @@ static char *default_input_callback(GB_gameboy_t *gb)
|
|||||||
{
|
{
|
||||||
char *expression = NULL;
|
char *expression = NULL;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
if (gb->debug_stopped) {
|
||||||
|
printf(">");
|
||||||
|
}
|
||||||
|
|
||||||
if (getline(&expression, &size, stdin) == -1) {
|
if (getline(&expression, &size, stdin) == -1) {
|
||||||
/* The user doesn't have STDIN or used ^D. We make sure the program keeps running. */
|
/* The user doesn't have STDIN or used ^D. We make sure the program keeps running. */
|
||||||
@ -77,6 +80,12 @@ static char *default_input_callback(GB_gameboy_t *gb)
|
|||||||
if (expression[length - 1] == '\n') {
|
if (expression[length - 1] == '\n') {
|
||||||
expression[length - 1] = 0;
|
expression[length - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (expression[0] == '\x03') {
|
||||||
|
gb->debug_stopped = true;
|
||||||
|
free(expression);
|
||||||
|
return strdup("");
|
||||||
|
}
|
||||||
return expression;
|
return expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user