* defs.h (parse_pid_to_attach): New.
	* utils.c (parse_pid_to_attach): New.
	* darwin-nat.c (darwin_attach): Replace ARGS parsing by parse_pid.
	* gnu-nat.c (gnu_attach): Likewise.
	* nto-procfs.c (procfs_attach): Likewise.
	* procfs.c (procfs_attach): Likewise.
	* windows-nat.c (windows_attach): Likewise.
	* inf-ptrace.c (inf_ptrace_attach): Likewise.  Remove variable dummy.
	* inf-ttrace.c (inf_ttrace_attach): Likewise.
	* remote.c (extended_remote_attach_1): Likewise.  New comment on getpid
	check.

gdb/testsuite/
	* gdb.base/attach.exp (attach to nonsense is prohibited): Make the
	"Illegal process-id" expect string more exact.
	(attach to digits-starting nonsense is prohibited): New.
This commit is contained in:
Jan Kratochvil
2010-02-15 17:35:50 +00:00
parent 01a8201190
commit 74164c5624
13 changed files with 76 additions and 47 deletions

View File

@@ -1691,8 +1691,7 @@ windows_attach (struct target_ops *ops, char *args, int from_tty)
BOOL ok;
DWORD pid;
if (!args)
error_no_arg (_("process-id to attach"));
pid = parse_pid_to_attach (args);
if (set_process_privilege (SE_DEBUG_NAME, TRUE) < 0)
{
@@ -1700,8 +1699,6 @@ windows_attach (struct target_ops *ops, char *args, int from_tty)
printf_unfiltered ("This can cause attach to fail on Windows NT/2K/XP\n");
}
pid = strtoul (args, 0, 0); /* Windows pid */
windows_init_thread_list ();
ok = DebugActiveProcess (pid);
saw_create = 0;