Fixed crash on monitor commands with no attached target.

This commit is contained in:
Gareth McMullin 2012-06-26 19:48:50 +12:00
parent 94516329a0
commit 29b9e103fb
1 changed files with 6 additions and 0 deletions

View File

@ -86,6 +86,9 @@ int command_process(char *cmd)
return !c->handler(cur_target, argc, argv);
}
if (!cur_target)
return -1;
for (tc = cur_target->commands; tc; tc = tc->next)
for(c = tc->cmds; c->cmd; c++)
if(!strncmp(argv[0], c->cmd, strlen(argv[0])))
@ -113,6 +116,9 @@ bool cmd_help(void)
for(c = cmd_list; c->cmd; c++)
gdb_outf("\t%s -- %s\n", c->cmd, c->help);
if (!cur_target)
return -1;
for (tc = cur_target->commands; tc; tc = tc->next) {
gdb_outf("%s specific commands:\n", tc->specific_name);
for(c = tc->cmds; c->cmd; c++)