Implemented "exit" command.
This commit is contained in:
parent
fc808485c2
commit
99c478d37f
7
cmddb.c
7
cmddb.c
|
@ -234,6 +234,13 @@ const struct cmddb_record commands[] = {
|
||||||
"locka [set|clear]\n"
|
"locka [set|clear]\n"
|
||||||
" Show or change the status of the LOCKA flash write-protect bit.\n"
|
" Show or change the status of the LOCKA flash write-protect bit.\n"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "exit",
|
||||||
|
.func = cmd_exit,
|
||||||
|
.help =
|
||||||
|
"exit\n"
|
||||||
|
" Exit from MSPDebug.\n"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int cmddb_get(const char *name, struct cmddb_record *ret)
|
int cmddb_get(const char *name, struct cmddb_record *ret)
|
||||||
|
|
|
@ -174,6 +174,8 @@ bit in the flash memory controller).
|
||||||
|
|
||||||
Specify "segment" and a memory address to erase an individual flash
|
Specify "segment" and a memory address to erase an individual flash
|
||||||
segment.
|
segment.
|
||||||
|
.IP "\fBexit\fR"
|
||||||
|
Exit from MSPDebug.
|
||||||
.IP "\fBgdb\fR [\fIport\fR]"
|
.IP "\fBgdb\fR [\fIport\fR]"
|
||||||
Start a GDB remote stub, optionally specifying a TCP port to listen on.
|
Start a GDB remote stub, optionally specifying a TCP port to listen on.
|
||||||
If no port is given, the default port is 2000.
|
If no port is given, the default port is 2000.
|
||||||
|
|
18
reader.c
18
reader.c
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
static int modify_flags;
|
static int modify_flags;
|
||||||
static int in_reader_loop;
|
static int in_reader_loop;
|
||||||
|
static int want_exit;
|
||||||
|
|
||||||
void mark_modified(int flags)
|
void mark_modified(int flags)
|
||||||
{
|
{
|
||||||
|
@ -57,7 +58,7 @@ int prompt_abort(int flags)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
printc("Symbols have not been saved since modification. "
|
printf("Symbols have not been saved since modification. "
|
||||||
"Continue (y/n)? ");
|
"Continue (y/n)? ");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
|
@ -141,6 +142,11 @@ static int do_command(char *arg, int interactive)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reader_exit(void)
|
||||||
|
{
|
||||||
|
want_exit = 1;
|
||||||
|
}
|
||||||
|
|
||||||
void reader_loop(void)
|
void reader_loop(void)
|
||||||
{
|
{
|
||||||
int old = in_reader_loop;
|
int old = in_reader_loop;
|
||||||
|
@ -154,19 +160,25 @@ void reader_loop(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
want_exit = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char *buf = readline("(mspdebug) ");
|
char *buf = readline("(mspdebug) ");
|
||||||
|
|
||||||
if (!buf)
|
if (!buf) {
|
||||||
|
printc("\n");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
add_history(buf);
|
add_history(buf);
|
||||||
do_command(buf, 1);
|
do_command(buf, 1);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
|
if (want_exit)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} while (prompt_abort(MODIFY_SYMS));
|
} while (prompt_abort(MODIFY_SYMS));
|
||||||
|
|
||||||
printc("\n");
|
|
||||||
in_reader_loop = old;
|
in_reader_loop = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
reader.h
3
reader.h
|
@ -46,6 +46,9 @@ int prompt_abort(int flags);
|
||||||
/* Run the reader loop */
|
/* Run the reader loop */
|
||||||
void reader_loop(void);
|
void reader_loop(void);
|
||||||
|
|
||||||
|
/* Cause the reader loop to exit */
|
||||||
|
void reader_exit(void);
|
||||||
|
|
||||||
/* Commands can be fed directly to the processor either one at a time,
|
/* Commands can be fed directly to the processor either one at a time,
|
||||||
* or by specifying a file to read from.
|
* or by specifying a file to read from.
|
||||||
*/
|
*/
|
||||||
|
|
6
stdcmd.c
6
stdcmd.c
|
@ -242,3 +242,9 @@ int cmd_read(char **arg)
|
||||||
|
|
||||||
return process_file(filename);
|
return process_file(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cmd_exit(char **arg)
|
||||||
|
{
|
||||||
|
reader_exit();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue