This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/1] Fix internal warning when "gdb -p xxx" (test)
- From: Hui Zhu <hui_zhu at mentor dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>
- Date: Wed, 19 Mar 2014 12:03:02 +0800
- Subject: [PATCH 1/1] Fix internal warning when "gdb -p xxx" (test)
- Authentication-results: sourceware.org; auth=none
- References: <53271C09 dot 5000709 at mentor dot com> <53271ED2 dot 6010707 at redhat dot com> <53272958 dot 1080605 at redhat dot com> <5327F7D0 dot 1050304 at mentor dot com> <53281C69 dot 7090703 at redhat dot com>
We found that the issue can be found by regression test.
So make a patch to make attach.exp can test "gdb -p xxx".
Thanks,
Hui
2014-03-19 Hui Zhu <hui@codesourcery.com>
* gdb.base/attach.exp (do_command_attach_tests): New.
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -384,6 +384,48 @@ 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"
+ expect {
+ -re "Reading symbols from.*$gdb_prompt $" {
+ pass "starting with --pid=$testpid"
+ }
+ timeout { fail "(timeout) starting with --pid=$testpid" }
+ }
+
+ # Get rid of the process
+
+ remote_exec build "kill -9 ${testpid}"
+}
+
# Start with a fresh gdb
@@ -404,4 +446,8 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
do_call_attach_tests
+# Test "gdb --pid"
+
+do_command_attach_tests
+
return 0