aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-02-15 17:35:50 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-02-15 17:35:50 +0000
commit74164c5624c276e97cf9cb01876ef908745cd185 (patch)
tree8c1a196ff9b052b0f8adda3aa6b0d4b045d0aada /gdb/testsuite/gdb.base
parent01a8201190286f181bea5731495123ea465c6251 (diff)
downloadgdb-74164c5624c276e97cf9cb01876ef908745cd185.zip
gdb-74164c5624c276e97cf9cb01876ef908745cd185.tar.gz
gdb-74164c5624c276e97cf9cb01876ef908745cd185.tar.bz2
gdb/
* 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.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r--gdb/testsuite/gdb.base/attach.exp23
1 files changed, 22 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 8729d58..a507e3b 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -93,7 +93,28 @@ proc do_attach_tests {} {
set test "attach to nonsense is prohibited"
gdb_test_multiple "attach abc" "$test" {
- -re "Illegal process-id: abc.*$gdb_prompt $" {
+ -re "Illegal process-id: abc\\.\r\n$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
+ # Response expected from /proc-based systems.
+ pass "$test"
+ }
+ -re "Can't attach to process..*$gdb_prompt $" {
+ # Response expected on Cygwin
+ pass "$test"
+ }
+ -re "Attaching to.*$gdb_prompt $" {
+ fail "$test (bogus pid allowed)"
+ }
+ }
+
+ # Verify that we cannot attach to nonsense even if its initial part is
+ # a valid PID.
+
+ set test "attach to digits-starting nonsense is prohibited"
+ gdb_test_multiple "attach ${testpid}x" "$test" {
+ -re "Illegal process-id: ${testpid}x\\.\r\n$gdb_prompt $" {
pass "$test"
}
-re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {