From: Hui Zhu <hui_zhu@mentor.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [PATCH 1/1] Fix internal warning when "gdb -p xxx" (test)
Date: Thu, 20 Mar 2014 03:16:00 -0000 [thread overview]
Message-ID: <532A5D89.1060108@mentor.com> (raw)
In-Reply-To: <53297165.70007@redhat.com>
On 03/19/14 18:28, Pedro Alves wrote:
> On 03/19/2014 04:03 AM, Hui Zhu wrote:
>
>> + eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS --pid=$testpid"
>> + expect {
>> + -re "Reading symbols from.*$gdb_prompt $" {
>> + pass "starting with --pid=$testpid"
>
> Don't add the $testpid to the PASS/FAIL line, as it'll change between
> testsuite runs, making gdb.sum diffs harder.
>
>> + }
>> + timeout { fail "(timeout) starting with --pid=$testpid" }
>
> Instead of repeating the text, write:
>
> set test "starting with --pid"
> expect {
> -re "Reading symbols from.*$gdb_prompt $" {
> pass "$test"
> }
> timeout {
> fail "$test (timeout)"
> }
> }
>
> Otherwise OK.
>
> Thanks!
>
Make a new version according to your comments.
Please help me review it.
Thanks,
Hui
2014-03-20 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,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
next prev parent reply other threads:[~2014-03-20 3:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 16:00 [PATCH 0/1] Fix internal warning when "gdb -p xxx" Hui Zhu
2014-03-17 16:02 ` [PATCH 1/1] Fix memleak of the pid_to_exec_file target_ops method for some platforms Hui Zhu
2014-03-18 7:39 ` Hui Zhu
2014-03-17 16:12 ` [PATCH 0/1] Fix internal warning when "gdb -p xxx" Pedro Alves
2014-03-17 16:57 ` Pedro Alves
2014-03-18 7:38 ` Hui Zhu
2014-03-18 10:14 ` Pedro Alves
2014-03-19 3:58 ` Hui Zhu
2014-03-19 10:16 ` Pedro Alves
2014-03-20 2:58 ` Hui Zhu
2014-03-20 3:27 ` Hui Zhu
2014-03-20 12:56 ` Pedro Alves
2014-03-21 3:14 ` Hui Zhu
2014-03-19 4:03 ` [PATCH 1/1] Fix internal warning when "gdb -p xxx" (test) Hui Zhu
2014-03-19 10:28 ` Pedro Alves
2014-03-20 3:16 ` Hui Zhu [this message]
2014-03-20 12:23 ` Pedro Alves
2014-03-21 3:27 ` Hui Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=532A5D89.1060108@mentor.com \
--to=hui_zhu@mentor.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox