提交 f9f9cbd1 编写于 作者: R rdurbin

7145527: sscanf must use a length in the format string

Summary: Remove dead code containing last call to scanf with no string length specifier
Reviewed-by: dcubed, coleenp
上级 7abc99b4
......@@ -665,152 +665,4 @@ void help() {
tty->print_cr(" ndebug() - undo debug");
}
#if 0
// BobV's command parser for debugging on windows when nothing else works.
enum CommandID {
CMDID_HELP,
CMDID_QUIT,
CMDID_HSFIND,
CMDID_PSS,
CMDID_PS,
CMDID_PSF,
CMDID_FINDM,
CMDID_FINDNM,
CMDID_PP,
CMDID_BPT,
CMDID_EXIT,
CMDID_VERIFY,
CMDID_THREADS,
CMDID_ILLEGAL = 99
};
struct CommandParser {
char *name;
CommandID code;
char *description;
};
struct CommandParser CommandList[] = {
(char *)"help", CMDID_HELP, " Dump this list",
(char *)"quit", CMDID_QUIT, " Return from this routine",
(char *)"hsfind", CMDID_HSFIND, "Perform an hsfind on an address",
(char *)"ps", CMDID_PS, " Print Current Thread Stack Trace",
(char *)"pss", CMDID_PSS, " Print All Thread Stack Trace",
(char *)"psf", CMDID_PSF, " Print All Stack Frames",
(char *)"findm", CMDID_FINDM, " Find a Method* from a PC",
(char *)"findnm", CMDID_FINDNM, "Find an nmethod from a PC",
(char *)"pp", CMDID_PP, " Find out something about a pointer",
(char *)"break", CMDID_BPT, " Execute a breakpoint",
(char *)"exitvm", CMDID_EXIT, "Exit the VM",
(char *)"verify", CMDID_VERIFY, "Perform a Heap Verify",
(char *)"thread", CMDID_THREADS, "Dump Info on all Threads",
(char *)0, CMDID_ILLEGAL
};
// get_debug_command()
//
// Read a command from standard input.
// This is useful when you have a debugger
// which doesn't support calling into functions.
//
void get_debug_command()
{
ssize_t count;
int i,j;
bool gotcommand;
intptr_t addr;
char buffer[256];
nmethod *nm;
Method* m;
tty->print_cr("You have entered the diagnostic command interpreter");
tty->print("The supported commands are:\n");
for ( i=0; ; i++ ) {
if ( CommandList[i].code == CMDID_ILLEGAL )
break;
tty->print_cr(" %s \n", CommandList[i].name );
}
while ( 1 ) {
gotcommand = false;
tty->print("Please enter a command: ");
count = scanf("%s", buffer) ;
if ( count >=0 ) {
for ( i=0; ; i++ ) {
if ( CommandList[i].code == CMDID_ILLEGAL ) {
if (!gotcommand) tty->print("Invalid command, please try again\n");
break;
}
if ( strcmp(buffer, CommandList[i].name) == 0 ) {
gotcommand = true;
switch ( CommandList[i].code ) {
case CMDID_PS:
ps();
break;
case CMDID_PSS:
pss();
break;
case CMDID_PSF:
psf();
break;
case CMDID_FINDM:
tty->print("Please enter the hex addr to pass to findm: ");
scanf("%I64X", &addr);
m = (Method*)findm(addr);
tty->print("findm(0x%I64X) returned 0x%I64X\n", addr, m);
break;
case CMDID_FINDNM:
tty->print("Please enter the hex addr to pass to findnm: ");
scanf("%I64X", &addr);
nm = (nmethod*)findnm(addr);
tty->print("findnm(0x%I64X) returned 0x%I64X\n", addr, nm);
break;
case CMDID_PP:
tty->print("Please enter the hex addr to pass to pp: ");
scanf("%I64X", &addr);
pp((void*)addr);
break;
case CMDID_EXIT:
exit(0);
case CMDID_HELP:
tty->print("Here are the supported commands: ");
for ( j=0; ; j++ ) {
if ( CommandList[j].code == CMDID_ILLEGAL )
break;
tty->print_cr(" %s -- %s\n", CommandList[j].name,
CommandList[j].description );
}
break;
case CMDID_QUIT:
return;
break;
case CMDID_BPT:
BREAKPOINT;
break;
case CMDID_VERIFY:
verify();;
break;
case CMDID_THREADS:
threads();;
break;
case CMDID_HSFIND:
tty->print("Please enter the hex addr to pass to hsfind: ");
scanf("%I64X", &addr);
tty->print("Calling hsfind(0x%I64X)\n", addr);
hsfind(addr);
break;
default:
case CMDID_ILLEGAL:
break;
}
}
}
}
}
}
#endif
#endif // !PRODUCT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册