summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Zhu <teawater@gmail.com>2014-03-21 11:11:51 +0800
committerHui Zhu <teawater@gmail.com>2014-03-21 11:23:06 +0800
commitccdd1909ad5299cf0753aaa113928a41f8f27391 (patch)
tree14f2cd67585db4b3cdd36cbda1d7cd77f122b68e
parentb4ab256ded5020a82ff7ce8dc485e7882fc5b6a7 (diff)
downloadbinutils-gdb-ccdd1909ad5299cf0753aaa113928a41f8f27391.tar.gz
Fix internal warning when "gdb -p xxx"
The issue that was fixed by b4ab256ded5020a82ff7ce8dc485e7882fc5b6a7 can not be found in regression test. Update attach.exp to test it. https://sourceware.org/ml/gdb-patches/2014-03/msg00438.html 2014-03-21 Hui Zhu <hui@codesourcery.com> * gdb.base/attach.exp (do_command_attach_tests): New.
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/attach.exp49
2 files changed, 53 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index d6fb1dc7648..a78fb17bf19 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2014-03-21 Hui Zhu <hui@codesourcery.com>
+
+ * gdb.base/attach.exp (do_command_attach_tests): New.
+
2014-03-20 Tom Tromey <tromey@redhat.com>
Pedro Alves <palves@redhat.com>
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index 4d67d51be61..9714c2991ea 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -384,6 +384,51 @@ proc do_call_attach_tests {} {
remote_exec build "kill -9 ${testpid}"
}
+proc do_command_attach_tests {} {
+ global gdb_prompt
+ global binfile
+ global verbose
+ global GDB
+ global INTERNAL_GDBFLAGS
+ global GDBFLAGS
+
+ if ![isnative] then {
+ unsupported "command attach test"
+ return 0
+ }
+
+ # Start the program running and then wait for a bit, to be sure
+ # that it can be attached to.
+
+ set testpid [eval exec $binfile &]
+ exec sleep 2
+ if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+ }
+
+ gdb_exit
+ if $verbose>1 then {
+ send_user "Spawning $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid\n"
+ }
+
+ eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid"
+ set test "starting with --pid"
+ expect {
+ -re "Reading symbols from.*$gdb_prompt $" {
+ pass "$test"
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+ }
+
+ # Get rid of the process
+
+ remote_exec build "kill -9 ${testpid}"
+}
+
# Start with a fresh gdb
@@ -404,4 +449,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
do_call_attach_tests
+# Test "gdb --pid"
+
+do_command_attach_tests
+
return 0