This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] add -s option to make -break-insert support dprintf
- From: Pedro Alves <palves at redhat dot com>
- To: Hui Zhu <teawater at gmail dot com>
- Cc: Eli Zaretskii <eliz at gnu dot org>, Hui Zhu <hui_zhu at mentor dot com>, gdb-patches ml <gdb-patches at sourceware dot org>, Marc Khouzam <marc dot khouzam at ericsson dot com>
- Date: Fri, 12 Apr 2013 12:34:23 +0100
- Subject: Re: [PATCH] add -s option to make -break-insert support dprintf
- References: <515451EA dot 1000200 at mentor dot com> <83y5d7wpvq dot fsf at gnu dot org> <CANFwon23qn_SVjcUWUZ2Z2Y5Euqg8efiwMvXkxTRtA9-2Ttk3Q at mail dot gmail dot com> <516454DA dot 9040109 at redhat dot com> <CANFwon1aDoyCYrsNeUpkmh6ARFJmT8B4JdFqYcc6GLdo=cgqig at mail dot gmail dot com> <51667EDC dot 9070207 at redhat dot com> <CANFwon1_xBW8kcLw__tJV_Lnv5uhVSTycR-4651pYydvaa8rZw at mail dot gmail dot com>
On 04/12/2013 11:38 AM, Hui Zhu wrote:
>> >
>> > I still get:
>> >
>> > $ make check gdbserver RUNTESTFLAGS="--target_board=native-gdbserver mi-dprintf.exp"
> This part is really odd.
> In my part, without "sleep 1" will random get fail with "Set dprintf
> style to agent ".
> The reason of fail is test try to check the output before it call
> send_gdb "set dprintf-style agent\n".
> This is why I add a "sleep 1" for it.
>
> But looks it still not OK in your part, so I change it to:
> mi_gdb_test "pwd" ".*"
>
> If it is still not OK in your part, I suggest remove this part of test
> because it is not very important for this test. The "set
> dprintf-style agent" is tested in "dprintf.exp".
>
No, it's not okay. And it's not okay to just sweep it under the rug.
I believe the problem is that the test is sending CLI resumption commands:
+ mi_gdb_test "continue" ".*At foo entry.*arg=1234, g=1234.*" "mi 1st dprintf"
+ mi_gdb_test "continue" ".*At foo entry.*arg=1235, g=2222.*" "mi 2nd dprintf"
"continue" sent from MI causes two prompts to appear:
(gdb)
continue
&"continue\n"
~"Continuing.\n"
^running
*running,thread-id="all"
(gdb)
=breakpoint-modified,bkpt={number="6",type="breakpoint",disp="keep",enabled="y",addr="0x000000000045a3ff",func="main",file="../../src/gdb/gdb.c",fullname="/home/pedro/gdb/mygit/src/gdb/gdb.c",line="32",thread-groups=["i1"],times="1",original-location="/home/pedro/gdb/mygit/src/gdb/gdb.c:32"}
~"\nBreakpoint "
~"6, main (argc=1, argv=0x7fffffffdc58) at ../../src/gdb/gdb.c:32\n"
~"32\t args.use_windows = 0;\n"
*stopped,reason="breakpoint-hit",disp="keep",bkptno="6",frame={addr="0x000000000045a3ff",func="main",args=[{name="argc",value="1"},{name="argv",value="0x7fffffffdc58"}],file="../../src/gdb/gdb.c",fullname="/home/pedro/gdb/mygit/src/gdb/gdb.c",line="32"},thread-id="1",stopped-threads="all",core="0"
(gdb)
and that is confusing the test (the regex for the prompt is probably stopping
at the first prompt sometimes).
The test should be adjusted to do MI -exec-continue instead, with
mi_execute_to "exec-continue", mi_send_resuming_command "exec-continue"
or something like that.
BTW, you don't need to use gdbserver to trigger the issue. Native
works too. E.g., leave this running, and eventually, it should FAIL
and stop:
$ (set -e; while true; do make check RUNTESTFLAGS="mi-dprintf.exp"; done)
gdb/contrib/expect-read1.sh probably makes this reproducible all
the time, though I haven't tried.
--
Pedro Alves