* Re: [RFA]: pending breakpoint support [2/3]
@ 2004-01-21 22:20 Michael Elizabeth Chastain
2004-01-21 22:58 ` J. Johnston
0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-21 22:20 UTC (permalink / raw)
To: gdb-patches, jjohnstn
Hi Jeff,
This needs some work.
+gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
+ -re "Function \"langs0\" not defined\.$" {
+ pass "break on nonexistent function in langs.exp"
+ }
+ -re "Function \"langs0\" not defined\..*Make breakpoint pending.*" {
+ send_gdb "n\n"
+ pass "break on nonexistent function in langs.exp"
+ }
+ -re "Breakpoint .* (deferred).*" {
+ pass "break on nonexistent function in langs.exp"
+ }
+ -re ".*$gdb_prompt.*" {
+ fail "break on nonexistent function in langs.exp"
+ }
+ timeout { fail "break on nonexistent function in langs.exp" }
+}
All the arms of a gdb_test_muliple need to end in "$gdb_prompt $" (or
something) to match all the text of the output string. A pattern like
"Breakpoint .* (deferred).*" will match some indeterminate amount of
text after "deferred", leading to nondeterministic results for the next
test.
"Make breakpoint pending" does not end in "$gdb_prompt $" but it
should end with something other than ".*" for the same reason.
You don't need a ".*$gdb_prompt $" or a "timeout" case;
gdb_test_multiple automatically provides those.
The '(' and ')' need to be escaped: "\\(deferred\\)".
How come "Breakpoint .* \\(deferred\\).*$gdb_prompt $" is a PASS?
The function does not exist, so shouldn't that be a FAIL?
Or do I not understand your work?
> Index: testsuite/gdb.base/pending.c
> Index: testsuite/gdb.base/pendshr.c
These file need copyright notices.
See break.c for a good copyright notice.
+gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
+ -re ".*Make breakpoint pending.*$" {
+ gdb_test_multiple "y" "set pending breakpoint" {
+ -re "Breakpoint.*pendfunc1.*pending.*$gdb_prompt $" {
+ pass "set pending breakpoint"
+ }
+ }
+ }
+}
Same as before, don't put a ".*" at the end of a pattern.
> diff -u -p -r1.7 shlib-call.exp
> --- testsuite/gdb.base/shlib-call.exp 28 Sep 2002 01:12:04 -0000 1.7
> +++ testsuite/gdb.base/shlib-call.exp 21 Jan 2004 02:36:24 -0000
Add 2004 to the list of copyright years.
Michael C
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-21 22:20 [RFA]: pending breakpoint support [2/3] Michael Elizabeth Chastain
@ 2004-01-21 22:58 ` J. Johnston
2004-01-21 23:14 ` J. Johnston
0 siblings, 1 reply; 14+ messages in thread
From: J. Johnston @ 2004-01-21 22:58 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
Michael Elizabeth Chastain wrote:
> Hi Jeff,
>
> This needs some work.
>
> +gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
> + -re "Function \"langs0\" not defined\.$" {
> + pass "break on nonexistent function in langs.exp"
> + }
> + -re "Function \"langs0\" not defined\..*Make breakpoint pending.*" {
> + send_gdb "n\n"
> + pass "break on nonexistent function in langs.exp"
> + }
> + -re "Breakpoint .* (deferred).*" {
> + pass "break on nonexistent function in langs.exp"
> + }
> + -re ".*$gdb_prompt.*" {
> + fail "break on nonexistent function in langs.exp"
> + }
> + timeout { fail "break on nonexistent function in langs.exp" }
> +}
>
> All the arms of a gdb_test_muliple need to end in "$gdb_prompt $" (or
> something) to match all the text of the output string. A pattern like
> "Breakpoint .* (deferred).*" will match some indeterminate amount of
> text after "deferred", leading to nondeterministic results for the next
> test.
>
> "Make breakpoint pending" does not end in "$gdb_prompt $" but it
> should end with something other than ".*" for the same reason.
>
I am trying to fix that. I tried specifying the prompt fully and changed the
send_gdb to be a gdb_test as suggested by Daniel. Unfortunately, I get an
"ERROR: got an interactive prompt" message now. I need to look into why this is
happening.
> You don't need a ".*$gdb_prompt $" or a "timeout" case;
> gdb_test_multiple automatically provides those.
>
> The '(' and ')' need to be escaped: "\\(deferred\\)".
>
Done.
> How come "Breakpoint .* \\(deferred\\).*$gdb_prompt $" is a PASS?
> The function does not exist, so shouldn't that be a FAIL?
> Or do I not understand your work?
>
It has nothing to do with me. This was in the original gdb_test so I made
sure it was still there.
>
>>Index: testsuite/gdb.base/pending.c
>>Index: testsuite/gdb.base/pendshr.c
>
>
> These file need copyright notices.
> See break.c for a good copyright notice.
>
Done.
> +gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
> + -re ".*Make breakpoint pending.*$" {
> + gdb_test_multiple "y" "set pending breakpoint" {
> + -re "Breakpoint.*pendfunc1.*pending.*$gdb_prompt $" {
> + pass "set pending breakpoint"
> + }
> + }
> + }
> +}
>
> Same as before, don't put a ".*" at the end of a pattern.
>
Ok.
>
>>diff -u -p -r1.7 shlib-call.exp
>>--- testsuite/gdb.base/shlib-call.exp 28 Sep 2002 01:12:04 -0000 1.7
>>+++ testsuite/gdb.base/shlib-call.exp 21 Jan 2004 02:36:24 -0000
>
>
> Add 2004 to the list of copyright years.
>
Done.
Will repost when I have everything working again.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-21 22:58 ` J. Johnston
@ 2004-01-21 23:14 ` J. Johnston
0 siblings, 0 replies; 14+ messages in thread
From: J. Johnston @ 2004-01-21 23:14 UTC (permalink / raw)
To: J. Johnston; +Cc: Michael Elizabeth Chastain, gdb-patches
J. Johnston wrote:
> Michael Elizabeth Chastain wrote:
>
>> Hi Jeff,
>>
>> This needs some work.
>>
>> +gdb_test_multiple "b langs0" "break on nonexistent function in
>> langs.exp" {
>> + -re "Function \"langs0\" not defined\.$" {
>> + pass "break on nonexistent function in langs.exp"
>> + }
>> + -re "Function \"langs0\" not defined\..*Make breakpoint pending.*" {
>> + send_gdb "n\n"
>> + pass "break on nonexistent function in langs.exp"
>> + }
>> + -re "Breakpoint .* (deferred).*" {
>> + pass "break on nonexistent function in langs.exp"
>> + }
>> + -re ".*$gdb_prompt.*" {
>> + fail "break on nonexistent function in langs.exp"
>> + }
>> + timeout { fail "break on nonexistent function in langs.exp" }
>> +}
>>
>> All the arms of a gdb_test_muliple need to end in "$gdb_prompt $" (or
>> something) to match all the text of the output string. A pattern like
>> "Breakpoint .* (deferred).*" will match some indeterminate amount of
>> text after "deferred", leading to nondeterministic results for the next
>> test.
>>
>> "Make breakpoint pending" does not end in "$gdb_prompt $" but it
>> should end with something other than ".*" for the same reason.
>>
>
> I am trying to fix that. I tried specifying the prompt fully and
> changed the send_gdb to be a gdb_test as suggested by Daniel.
> Unfortunately, I get an "ERROR: got an interactive prompt" message now.
> I need to look into why this is happening.
>
Found the problem...didn't escape the question mark. As soon as I clarify
Daniel's one comment I will repost.
>> You don't need a ".*$gdb_prompt $" or a "timeout" case;
>> gdb_test_multiple automatically provides those.
>>
>> The '(' and ')' need to be escaped: "\\(deferred\\)".
>>
>
> Done.
>
>> How come "Breakpoint .* \\(deferred\\).*$gdb_prompt $" is a PASS?
>> The function does not exist, so shouldn't that be a FAIL?
>> Or do I not understand your work?
>>
>
> It has nothing to do with me. This was in the original gdb_test so I made
> sure it was still there.
>
>>
>>> Index: testsuite/gdb.base/pending.c
>>> Index: testsuite/gdb.base/pendshr.c
>>
>>
>>
>> These file need copyright notices.
>> See break.c for a good copyright notice.
>>
>
> Done.
>
>> +gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
>> + -re ".*Make breakpoint pending.*$" {
>> + gdb_test_multiple "y" "set pending breakpoint" {
>> + -re "Breakpoint.*pendfunc1.*pending.*$gdb_prompt $" {
>> + pass "set pending breakpoint"
>> + }
>> + }
>> + }
>> +}
>>
>> Same as before, don't put a ".*" at the end of a pattern.
>>
>
> Ok.
>
>>
>>> diff -u -p -r1.7 shlib-call.exp
>>> --- testsuite/gdb.base/shlib-call.exp 28 Sep 2002 01:12:04
>>> -0000 1.7
>>> +++ testsuite/gdb.base/shlib-call.exp 21 Jan 2004 02:36:24 -0000
>>
>>
>>
>> Add 2004 to the list of copyright years.
>>
>
> Done.
>
> Will repost when I have everything working again.
>
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-24 10:36 ` Eli Zaretskii
@ 2004-02-02 21:17 ` Jeff Johnston
0 siblings, 0 replies; 14+ messages in thread
From: Jeff Johnston @ 2004-02-02 21:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Michael Elizabeth Chastain, drow, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 625 bytes --]
Thanks. I have checked in the patch. A slight modification had to be
made to
pending.exp due to the fact that one message was reworded in response to
comments from
Daniel on the breakpoint.c code. That change was minor and I have
included the new patch
here.
-- Jeff J.
Eli Zaretskii wrote:
>>Date: Sat, 24 Jan 2004 02:31:20 -0500 (EST)
>>From: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
>>
>>I don't have the power to approve test suite patches,
>>but I endorse it for approval to the people who do.
>>
>>
>
>Seconded.
>
>And since I seem to have the approval power, I guess we've just did ;-)
>
>
>
[-- Attachment #2: pbreak.patch2b --]
[-- Type: text/plain, Size: 14492 bytes --]
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/ChangeLog,v
retrieving revision 1.780
diff -u -r1.780 ChangeLog
--- ChangeLog 2 Feb 2004 20:44:52 -0000 1.780
+++ ChangeLog 2 Feb 2004 21:13:07 -0000
@@ -1,3 +1,16 @@
+2004-02-02 Jeff Johnston <jjohnstn@redhat.com>
+
+ * lib/gdb.exp (gdb_breakpoint): Add pending breakpoint
+ support.
+ * gdb.base/langs.exp: Fix test which attempts to create
+ breakpoint on non-existent function to handle new pending
+ support.
+ * gdb.base/shlib-call.exp: Use gdb_breakpoint to set
+ a breakpoint.
+ * gdb.base/pending.exp: New test.
+ * gdb.base/pending.c: New file.
+ * gdb.base/pendshr.c: Ditto.
+
2004-02-02 David Carlton <carlton@kealia.com>
* gdb.cp/overload.exp: Add overloadNamespace tests.
Index: gdb.base/langs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/langs.exp,v
retrieving revision 1.2
diff -u -r1.2 langs.exp
--- gdb.base/langs.exp 23 Jun 2003 22:42:50 -0000 1.2
+++ gdb.base/langs.exp 2 Feb 2004 21:13:07 -0000
@@ -65,8 +65,15 @@
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
-gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \
- "break on nonexistent function in langs.exp"
+gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
+ -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or n. $" {
+
+ gdb_test "n" "" "break on nonexistent function in langs.exp"
+ }
+ -re "Breakpoint .* (deferred).*$gdb_prompt $" {
+ pass "break on nonexistent function in langs.exp"
+ }
+}
if {$hp_aCC_compiler} {
set isfixed 1
Index: gdb.base/pending.c
===================================================================
RCS file: gdb.base/pending.c
diff -N gdb.base/pending.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pending.c 2 Feb 2004 21:13:07 -0000
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <stdio.h>
+
+int k = 0;
+
+extern void pendfunc1 (int x);
+
+int main()
+{
+ pendfunc1 (3); /* break main here */
+ pendfunc1 (4);
+ k = 1;
+ pendfunc1 (3);
+ return 0;
+}
Index: gdb.base/pending.exp
===================================================================
RCS file: gdb.base/pending.exp
diff -N gdb.base/pending.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pending.exp 2 Feb 2004 21:13:07 -0000
@@ -0,0 +1,266 @@
+# Copyright 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was created by Jeff Johnston. (jjohnstn@redhat.com)
+# The shared library compilation portion was copied from shlib-call.exp which was
+# written by Elena Zannoni (ezannoni@redhat.com).
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+# are we on a target board?
+if ![isnative] then {
+ return 0
+}
+
+set testfile "pending"
+set libfile "pendshr"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Build the shared libraries this test case needs.
+#
+
+if {$gcc_compiled == 0} {
+ if [istarget "hppa*-hp-hpux*"] then {
+ set additional_flags "additional_flags=+z"
+ } elseif { [istarget "mips-sgi-irix*"] } {
+ # Disable SGI compiler's implicit -Dsgi
+ set additional_flags "additional_flags=-Usgi"
+ } else {
+ # don't know what the compiler is...
+ set additional_flags ""
+ }
+} else {
+ if { ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"]) } {
+ set additional_flags ""
+ } else {
+ set additional_flags "additional_flags=-fpic"
+ }
+}
+
+if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.o" object [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [istarget "hppa*-*-hpux*"] {
+ remote_exec build "ld -b ${objdir}/${subdir}/${libfile}.o -o ${objdir}/${subdir}/${libfile}.sl"
+} else {
+ set additional_flags "additional_flags=-shared"
+ if {[gdb_compile "${objdir}/${subdir}/${libfile}.o" "${objdir}/${subdir}/${libfile}.sl" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ }
+}
+
+if { ($gcc_compiled
+ && ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"] )) } {
+ set additional_flags "additional_flags=-L${objdir}/${subdir}"
+} elseif { [istarget "mips-sgi-irix*"] } {
+ set additional_flags "additional_flags=-rpath ${objdir}/${subdir}"
+} else {
+ set additional_flags ""
+}
+if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if [target_info exists gdb_stub] {
+ gdb_step_for_stub;
+}
+#
+# Test setting, querying, and modifying pending breakpoints
+#
+
+gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint"
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \
+"single pending breakpoint info"
+
+#
+# Test breaking at existing function
+#
+
+set mainline [gdb_get_line_number "break main here"]
+
+gdb_test "break main" \
+ "Breakpoint.*at.* file .*$srcfile, line $mainline.*" \
+ "breakpoint function"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus real breakpoint info"
+
+
+#
+# Test not setting a pending breakpoint
+#
+gdb_test_multiple "break pendfunc2" "Don't set pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "n" "" "Don't set pending breakpoint"
+ }
+}
+
+#
+# Add condition to pending breakpoint
+#
+
+gdb_test "condition 1 k == 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus condition"
+
+#
+# Disable pending breakpoint
+#
+
+gdb_test "disable 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled"
+
+#
+# Add commands to pending breakpoint
+#
+gdb_test "commands 1\nprint k\nend" "" \
+ "Set commands for pending breakpoint"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled plus commands"
+
+#
+# Try a pending break for a line in a source file with a condition
+#
+
+gdb_test_multiple "break pendshr.c:26 if x > 3" "Set pending breakpoint 2" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*pendshr.c:26.*pending." \
+ "Set pending breakpoint 2"
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:26 if x > 3.*" \
+"multiple pending breakpoints"
+
+#
+# Run to main which should resolve a pending breakpoint
+#
+
+gdb_test "run" \
+"Breakpoint.*at.*
+Pending breakpoint \"pendshr.c:26 if x > 3\" resolved.*
+Breakpoint.*, main.*$mainline.*" \
+"running to main"
+
+#
+# Re-enable the first pending breakpoint which should resolve
+#
+
+gdb_test "enable 1" \
+"Breakpoint.*at.*
+Pending breakpoint \"pendfunc1.* resolved.*" \
+"re-enabling pending breakpoint that can resolve instantly"
+
+#
+# Continue to verify conditionals and commands for breakpoints are honored
+#
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*4;" \
+"continue to resolved breakpoint 2"
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*
+\[$\]1 = 1." \
+"continue to resolved breakpoint 1"
+
+delete_breakpoints
+
+gdb_breakpoint "main"
+
+#
+# Set non-existent pending breakpoint
+#
+gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*imaginary.*pending." \
+ "set imaginary pending breakpoint"
+ }
+}
+
+#
+# rerun program and make sure that any pending breakpoint remains and no
+# error messages are issued for the missing function
+#
+
+rerun_to_main
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \
+"verify pending breakpoint after restart"
Index: gdb.base/pendshr.c
===================================================================
RCS file: gdb.base/pendshr.c
diff -N gdb.base/pendshr.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pendshr.c 2 Feb 2004 21:13:07 -0000
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <stdio.h>
+
+void pendfunc1 (int x)
+{
+ int y = x + 4;
+ printf ("in pendfunc1, x is %d\n", x);
+}
Index: gdb.base/shlib-call.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shlib-call.exp,v
retrieving revision 1.7
diff -u -r1.7 shlib-call.exp
--- gdb.base/shlib-call.exp 28 Sep 2002 01:12:04 -0000 1.7
+++ gdb.base/shlib-call.exp 2 Feb 2004 21:13:07 -0000
@@ -1,4 +1,4 @@
-# Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1997, 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -291,7 +291,7 @@
# PR's 16495, 18213
# test that we can re-set breakpoints in shared libraries
-gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library"
+gdb_breakpoint "shr1"
# FIXME: should not send "run" explicitly. Non-portable.
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.44
diff -u -r1.44 gdb.exp
--- lib/gdb.exp 1 Feb 2004 18:04:37 -0000 1.44
+++ lib/gdb.exp 2 Feb 2004 21:13:07 -0000
@@ -269,6 +269,10 @@
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {}
+ -re "Make breakpoint pending.*y or n. $" {
+ gdb_test "n" "" "setting breakpoint at $function" ;
+ return 1;
+ }
-re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 }
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-24 7:31 Michael Elizabeth Chastain
@ 2004-01-24 10:36 ` Eli Zaretskii
2004-02-02 21:17 ` Jeff Johnston
0 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2004-01-24 10:36 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: drow, jjohnstn, gdb-patches
> Date: Sat, 24 Jan 2004 02:31:20 -0500 (EST)
> From: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
>
> I don't have the power to approve test suite patches,
> but I endorse it for approval to the people who do.
Seconded.
And since I seem to have the approval power, I guess we've just did ;-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
@ 2004-01-24 7:31 Michael Elizabeth Chastain
2004-01-24 10:36 ` Eli Zaretskii
0 siblings, 1 reply; 14+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-24 7:31 UTC (permalink / raw)
To: drow, jjohnstn; +Cc: gdb-patches
I don't have the power to approve test suite patches,
but I endorse it for approval to the people who do.
I haven't proofread it in detail or tested it, but superficially
it looks okay. If it blows up after it goes in then I'll be happy
to diagnose it and fix it.
Michael C
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-23 1:06 ` J. Johnston
@ 2004-01-23 15:01 ` Daniel Jacobowitz
0 siblings, 0 replies; 14+ messages in thread
From: Daniel Jacobowitz @ 2004-01-23 15:01 UTC (permalink / raw)
To: gdb-patches
On Thu, Jan 22, 2004 at 08:06:56PM -0500, J. Johnston wrote:
> Yes, that worked.
>
> Please see new patch.
From a testsuite point of view, I think this is fine. Let's see if any
of the output needs to change to match the final pending breakpoints
patch; otherwise approved.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-22 22:40 ` Daniel Jacobowitz
@ 2004-01-23 1:06 ` J. Johnston
2004-01-23 15:01 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: J. Johnston @ 2004-01-23 1:06 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1947 bytes --]
Daniel Jacobowitz wrote:
> On Wed, Jan 21, 2004 at 08:08:15PM -0500, J. Johnston wrote:
>
>>@@ -269,6 +269,9 @@ proc gdb_breakpoint { function } {
>> -re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
>> -re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
>> -re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {}
>>+ -re "Make breakpoint pending.*y or n. $" {
>>+ return gdb_test "n" "" "setting breakpoint at $function"
>>+ }
>> -re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 }
>> timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
>> }
>
>
> Well, that's not valid TCL. Stick to gdb_test on one line and return
> on the next.
>
Ok.
>
>>+#
>>+# Test setting, querying, and modifying pending breakpoints
>>+#
>>+
>>+# Test deleting all breakpoints when there are none installed,
>>+# GDB should not prompt for confirmation.
>>+# Note that gdb-init.exp provides a "delete_breakpoints" proc
>
>
> FYI, it's gdb.exp. Also this comment doesn't apply to this test
> script...
>
Ugh, your right. Comment removed.
>
>>+# for general use elsewhere.
>>+
>>+gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
>>+ -re ".*Make breakpoint pending.*y or n. $" {
>>+ gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint"
>>+ }
>>+}
>>+
>
>
>
>>+send_gdb "commands 1\n"
>>+send_gdb "print k\n"
>>+send_gdb "end\n"
>>+
>>+gdb_test "info break" \
>>+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
>>+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
>>+\[\t \]+stop only if k == 1.*
>>+\[\t \]+print k.*
>>+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
>>+"pending disabled plus commands"
>
>
> Again, whenever you use send_gdb you need to eat the output. I think
> you can just use gdb_test for this; see commands.exp.
>
Yes, that worked.
Please see new patch.
[-- Attachment #2: pbreak.patch2 --]
[-- Type: text/plain, Size: 14010 bytes --]
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.42
diff -u -p -r1.42 gdb.exp
--- lib/gdb.exp 12 Jan 2004 17:20:41 -0000 1.42
+++ lib/gdb.exp 23 Jan 2004 01:03:51 -0000
@@ -1,5 +1,5 @@
# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-# 2002, 2003
+# 2002, 2003, 2004
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -269,6 +269,10 @@ proc gdb_breakpoint { function } {
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {}
+ -re "Make breakpoint pending.*y or n. $" {
+ gdb_test "n" "" "setting breakpoint at $function" ;
+ return 1;
+ }
-re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 }
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
}
Index: gdb.base/langs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/langs.exp,v
retrieving revision 1.2
diff -u -p -r1.2 langs.exp
--- gdb.base/langs.exp 23 Jun 2003 22:42:50 -0000 1.2
+++ gdb.base/langs.exp 23 Jan 2004 01:03:51 -0000
@@ -65,8 +65,15 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
-gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \
- "break on nonexistent function in langs.exp"
+gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
+ -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or n. $" {
+
+ gdb_test "n" "" "break on nonexistent function in langs.exp"
+ }
+ -re "Breakpoint .* (deferred).*$gdb_prompt $" {
+ pass "break on nonexistent function in langs.exp"
+ }
+}
if {$hp_aCC_compiler} {
set isfixed 1
Index: gdb.base/pending.c
===================================================================
RCS file: gdb.base/pending.c
diff -N gdb.base/pending.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pending.c 23 Jan 2004 01:03:51 -0000
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <stdio.h>
+
+int k = 0;
+
+extern void pendfunc1 (int x);
+
+int main()
+{
+ pendfunc1 (3); /* break main here */
+ pendfunc1 (4);
+ k = 1;
+ pendfunc1 (3);
+ return 0;
+}
Index: gdb.base/pending.exp
===================================================================
RCS file: gdb.base/pending.exp
diff -N gdb.base/pending.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pending.exp 23 Jan 2004 01:03:51 -0000
@@ -0,0 +1,266 @@
+# Copyright 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was created by Jeff Johnston. (jjohnstn@redhat.com)
+# The shared library compilation portion was copied from shlib-call.exp which was
+# written by Elena Zannoni (ezannoni@redhat.com).
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+# are we on a target board?
+if ![isnative] then {
+ return 0
+}
+
+set testfile "pending"
+set libfile "pendshr"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Build the shared libraries this test case needs.
+#
+
+if {$gcc_compiled == 0} {
+ if [istarget "hppa*-hp-hpux*"] then {
+ set additional_flags "additional_flags=+z"
+ } elseif { [istarget "mips-sgi-irix*"] } {
+ # Disable SGI compiler's implicit -Dsgi
+ set additional_flags "additional_flags=-Usgi"
+ } else {
+ # don't know what the compiler is...
+ set additional_flags ""
+ }
+} else {
+ if { ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"]) } {
+ set additional_flags ""
+ } else {
+ set additional_flags "additional_flags=-fpic"
+ }
+}
+
+if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.o" object [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [istarget "hppa*-*-hpux*"] {
+ remote_exec build "ld -b ${objdir}/${subdir}/${libfile}.o -o ${objdir}/${subdir}/${libfile}.sl"
+} else {
+ set additional_flags "additional_flags=-shared"
+ if {[gdb_compile "${objdir}/${subdir}/${libfile}.o" "${objdir}/${subdir}/${libfile}.sl" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ }
+}
+
+if { ($gcc_compiled
+ && ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"] )) } {
+ set additional_flags "additional_flags=-L${objdir}/${subdir}"
+} elseif { [istarget "mips-sgi-irix*"] } {
+ set additional_flags "additional_flags=-rpath ${objdir}/${subdir}"
+} else {
+ set additional_flags ""
+}
+if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if [target_info exists gdb_stub] {
+ gdb_step_for_stub;
+}
+#
+# Test setting, querying, and modifying pending breakpoints
+#
+
+gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint"
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \
+"single pending breakpoint info"
+
+#
+# Test breaking at existing function
+#
+
+set mainline [gdb_get_line_number "break main here"]
+
+gdb_test "break main" \
+ "Breakpoint.*at.* file .*$srcfile, line $mainline.*" \
+ "breakpoint function"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus real breakpoint info"
+
+
+#
+# Test not setting a pending breakpoint
+#
+gdb_test_multiple "break pendfunc2" "Don't set pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "n" "" "Don't set pending breakpoint"
+ }
+}
+
+#
+# Add condition to pending breakpoint
+#
+
+gdb_test "condition 1 k == 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus condition"
+
+#
+# Disable pending breakpoint
+#
+
+gdb_test "disable 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled"
+
+#
+# Add commands to pending breakpoint
+#
+gdb_test "commands 1\nprint k\nend" "" \
+ "Set commands for pending breakpoint"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled plus commands"
+
+#
+# Try a pending break for a line in a source file with a condition
+#
+
+gdb_test_multiple "break pendshr.c:26 if x > 3" "Set pending breakpoint 2" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*pendshr.c:26.*pending." \
+ "Set pending breakpoint 2"
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:26 if x > 3.*" \
+"multiple pending breakpoints"
+
+#
+# Run to main which should resolve a pending breakpoint
+#
+
+gdb_test "run" \
+".*Pending breakpoint \"pendshr.c:26 if x > 3\" resolved.*
+Breakpoint.*at.*
+Breakpoint.*, main.*$mainline.*" \
+"running to main"
+
+#
+# Re-enable the first pending breakpoint which should resolve
+#
+
+gdb_test "enable 1" \
+"Pending breakpoint \"pendfunc1.* resolved.*
+Breakpoint.*at.*" \
+"re-enabling pending breakpoint that can resolve instantly"
+
+#
+# Continue to verify conditionals and commands for breakpoints are honored
+#
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*4;" \
+"continue to resolved breakpoint 2"
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*
+\[$\]1 = 1." \
+"continue to resolved breakpoint 1"
+
+delete_breakpoints
+
+gdb_breakpoint "main"
+
+#
+# Set non-existent pending breakpoint
+#
+gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*imaginary.*pending." \
+ "set imaginary pending breakpoint"
+ }
+}
+
+#
+# rerun program and make sure that any pending breakpoint remains and no
+# error messages are issued for the missing function
+#
+
+rerun_to_main
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \
+"verify pending breakpoint after restart"
Index: gdb.base/pendshr.c
===================================================================
RCS file: gdb.base/pendshr.c
diff -N gdb.base/pendshr.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pendshr.c 23 Jan 2004 01:03:51 -0000
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <stdio.h>
+
+void pendfunc1 (int x)
+{
+ int y = x + 4;
+ printf ("in pendfunc1, x is %d\n", x);
+}
Index: gdb.base/shlib-call.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shlib-call.exp,v
retrieving revision 1.7
diff -u -p -r1.7 shlib-call.exp
--- gdb.base/shlib-call.exp 28 Sep 2002 01:12:04 -0000 1.7
+++ gdb.base/shlib-call.exp 23 Jan 2004 01:03:51 -0000
@@ -1,4 +1,4 @@
-# Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1997, 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -291,7 +291,7 @@ send_gdb "set width 0\n" ; gdb_expect -r
# PR's 16495, 18213
# test that we can re-set breakpoints in shared libraries
-gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library"
+gdb_breakpoint "shr1"
# FIXME: should not send "run" explicitly. Non-portable.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-22 1:08 ` J. Johnston
@ 2004-01-22 22:40 ` Daniel Jacobowitz
2004-01-23 1:06 ` J. Johnston
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2004-01-22 22:40 UTC (permalink / raw)
To: gdb-patches
On Wed, Jan 21, 2004 at 08:08:15PM -0500, J. Johnston wrote:
> @@ -269,6 +269,9 @@ proc gdb_breakpoint { function } {
> -re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
> -re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
> -re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {}
> + -re "Make breakpoint pending.*y or n. $" {
> + return gdb_test "n" "" "setting breakpoint at $function"
> + }
> -re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 }
> timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
> }
Well, that's not valid TCL. Stick to gdb_test on one line and return
on the next.
> +#
> +# Test setting, querying, and modifying pending breakpoints
> +#
> +
> +# Test deleting all breakpoints when there are none installed,
> +# GDB should not prompt for confirmation.
> +# Note that gdb-init.exp provides a "delete_breakpoints" proc
FYI, it's gdb.exp. Also this comment doesn't apply to this test
script...
> +# for general use elsewhere.
> +
> +gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
> + -re ".*Make breakpoint pending.*y or n. $" {
> + gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint"
> + }
> +}
> +
> +send_gdb "commands 1\n"
> +send_gdb "print k\n"
> +send_gdb "end\n"
> +
> +gdb_test "info break" \
> + "Num Type\[ \]+Disp Enb Address\[ \]+What.*
> +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
> +\[\t \]+stop only if k == 1.*
> +\[\t \]+print k.*
> +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
> +"pending disabled plus commands"
Again, whenever you use send_gdb you need to eat the output. I think
you can just use gdb_test for this; see commands.exp.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-22 0:20 ` Daniel Jacobowitz
@ 2004-01-22 1:08 ` J. Johnston
2004-01-22 22:40 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: J. Johnston @ 2004-01-22 1:08 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 713 bytes --]
Daniel Jacobowitz wrote:
> On Wed, Jan 21, 2004 at 06:12:29PM -0500, J. Johnston wrote:
>
>>>>+ -re "Make breakpoint pending.*y or n. $" {
>>>>+ send_gdb "n\n";
>>>>+ fail "setting breakpoint at $function" ;
>>>>+ return 0
>>>>+ }
>>>
>>>
>>>[in lib/gdb.exp] ditto.
>>>
>>
>>Daniel, can you clarify this last comment. Is something wrong with the
>>prompt test in the -re line or do you want me to change the send_gdb to be
>>a gdb_test?
>
>
> The latter, sorry. The basic rule is, if a test causes GDB to print
> something out, the test must also eat the output.
>
Ok, I think I have covered the comments thus far. I have included a revised
patch. Let me know if I missed something.
-- Jeff J.
[-- Attachment #2: pbreak.patch2 --]
[-- Type: text/plain, Size: 14182 bytes --]
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.42
diff -u -p -r1.42 gdb.exp
--- lib/gdb.exp 12 Jan 2004 17:20:41 -0000 1.42
+++ lib/gdb.exp 22 Jan 2004 01:04:24 -0000
@@ -1,5 +1,5 @@
# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-# 2002, 2003
+# 2002, 2003, 2004
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -269,6 +269,9 @@ proc gdb_breakpoint { function } {
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {}
+ -re "Make breakpoint pending.*y or n. $" {
+ return gdb_test "n" "" "setting breakpoint at $function"
+ }
-re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 }
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
}
Index: gdb.base/langs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/langs.exp,v
retrieving revision 1.2
diff -u -p -r1.2 langs.exp
--- gdb.base/langs.exp 23 Jun 2003 22:42:50 -0000 1.2
+++ gdb.base/langs.exp 22 Jan 2004 01:04:24 -0000
@@ -65,8 +65,15 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
-gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \
- "break on nonexistent function in langs.exp"
+gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
+ -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or n. $" {
+
+ gdb_test "n" "" "break on nonexistent function in langs.exp"
+ }
+ -re "Breakpoint .* (deferred).*$gdb_prompt $" {
+ pass "break on nonexistent function in langs.exp"
+ }
+}
if {$hp_aCC_compiler} {
set isfixed 1
Index: gdb.base/pending.c
===================================================================
RCS file: gdb.base/pending.c
diff -N gdb.base/pending.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pending.c 22 Jan 2004 01:04:24 -0000
@@ -0,0 +1,35 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <stdio.h>
+
+int k = 0;
+
+extern void pendfunc1 (int x);
+
+int main()
+{
+ pendfunc1 (3); /* break main here */
+ pendfunc1 (4);
+ k = 1;
+ pendfunc1 (3);
+ return 0;
+}
Index: gdb.base/pending.exp
===================================================================
RCS file: gdb.base/pending.exp
diff -N gdb.base/pending.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pending.exp 22 Jan 2004 01:04:24 -0000
@@ -0,0 +1,273 @@
+# Copyright 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was created by Jeff Johnston. (jjohnstn@redhat.com)
+# The shared library compilation portion was copied from shlib-call.exp which was
+# written by Elena Zannoni (ezannoni@redhat.com).
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+# are we on a target board?
+if ![isnative] then {
+ return 0
+}
+
+set testfile "pending"
+set libfile "pendshr"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Build the shared libraries this test case needs.
+#
+
+if {$gcc_compiled == 0} {
+ if [istarget "hppa*-hp-hpux*"] then {
+ set additional_flags "additional_flags=+z"
+ } elseif { [istarget "mips-sgi-irix*"] } {
+ # Disable SGI compiler's implicit -Dsgi
+ set additional_flags "additional_flags=-Usgi"
+ } else {
+ # don't know what the compiler is...
+ set additional_flags ""
+ }
+} else {
+ if { ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"]) } {
+ set additional_flags ""
+ } else {
+ set additional_flags "additional_flags=-fpic"
+ }
+}
+
+if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.o" object [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [istarget "hppa*-*-hpux*"] {
+ remote_exec build "ld -b ${objdir}/${subdir}/${libfile}.o -o ${objdir}/${subdir}/${libfile}.sl"
+} else {
+ set additional_flags "additional_flags=-shared"
+ if {[gdb_compile "${objdir}/${subdir}/${libfile}.o" "${objdir}/${subdir}/${libfile}.sl" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ }
+}
+
+if { ($gcc_compiled
+ && ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"] )) } {
+ set additional_flags "additional_flags=-L${objdir}/${subdir}"
+} elseif { [istarget "mips-sgi-irix*"] } {
+ set additional_flags "additional_flags=-rpath ${objdir}/${subdir}"
+} else {
+ set additional_flags ""
+}
+if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if [target_info exists gdb_stub] {
+ gdb_step_for_stub;
+}
+#
+# Test setting, querying, and modifying pending breakpoints
+#
+
+# Test deleting all breakpoints when there are none installed,
+# GDB should not prompt for confirmation.
+# Note that gdb-init.exp provides a "delete_breakpoints" proc
+# for general use elsewhere.
+
+gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint"
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \
+"single pending breakpoint info"
+
+#
+# Test breaking at existing function
+#
+
+set mainline [gdb_get_line_number "break main here"]
+
+gdb_test "break main" \
+ "Breakpoint.*at.* file .*$srcfile, line $mainline.*" \
+ "breakpoint function"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus real breakpoint info"
+
+
+#
+# Test not setting a pending breakpoint
+#
+gdb_test_multiple "break pendfunc2" "Don't set pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "n" "" "Don't set pending breakpoint"
+ }
+}
+
+#
+# Add condition to pending breakpoint
+#
+
+gdb_test "condition 1 k == 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus condition"
+
+#
+# Disable pending breakpoint
+#
+
+gdb_test "disable 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled"
+
+#
+# Add commands to pending breakpoint
+#
+
+send_gdb "commands 1\n"
+send_gdb "print k\n"
+send_gdb "end\n"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled plus commands"
+
+#
+# Try a pending break for a line in a source file with a condition
+#
+
+gdb_test_multiple "break pendshr.c:26 if x > 3" "Set pending breakpoint 2" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*pendshr.c:26.*pending." \
+ "Set pending breakpoint 2"
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:26 if x > 3.*" \
+"multiple pending breakpoints"
+
+#
+# Run to main which should resolve a pending breakpoint
+#
+
+gdb_test "run" \
+".*Pending breakpoint \"pendshr.c:26 if x > 3\" resolved.*
+Breakpoint.*at.*
+Breakpoint.*, main.*$mainline.*" \
+"running to main"
+
+#
+# Re-enable the first pending breakpoint which should resolve
+#
+
+gdb_test "enable 1" \
+"Pending breakpoint \"pendfunc1.* resolved.*
+Breakpoint.*at.*" \
+"re-enabling pending breakpoint that can resolve instantly"
+
+#
+# Continue to verify conditionals and commands for breakpoints are honored
+#
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*4;" \
+"continue to resolved breakpoint 2"
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*
+\[$\]1 = 1." \
+"continue to resolved breakpoint 1"
+
+delete_breakpoints
+
+gdb_breakpoint "main"
+
+#
+# Set non-existent pending breakpoint
+#
+gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or n. $" {
+ gdb_test "y" "Breakpoint.*imaginary.*pending." \
+ "set imaginary pending breakpoint"
+ }
+}
+
+#
+# rerun program and make sure that any pending breakpoint remains and no
+# error messages are issued for the missing function
+#
+
+rerun_to_main
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \
+"verify pending breakpoint after restart"
Index: gdb.base/pendshr.c
===================================================================
RCS file: gdb.base/pendshr.c
diff -N gdb.base/pendshr.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gdb.base/pendshr.c 22 Jan 2004 01:04:24 -0000
@@ -0,0 +1,28 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <stdio.h>
+
+void pendfunc1 (int x)
+{
+ int y = x + 4;
+ printf ("in pendfunc1, x is %d\n", x);
+}
Index: gdb.base/shlib-call.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shlib-call.exp,v
retrieving revision 1.7
diff -u -p -r1.7 shlib-call.exp
--- gdb.base/shlib-call.exp 28 Sep 2002 01:12:04 -0000 1.7
+++ gdb.base/shlib-call.exp 22 Jan 2004 01:04:24 -0000
@@ -1,4 +1,4 @@
-# Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1997, 1998, 1999, 2000, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -291,7 +291,7 @@ send_gdb "set width 0\n" ; gdb_expect -r
# PR's 16495, 18213
# test that we can re-set breakpoints in shared libraries
-gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library"
+gdb_breakpoint "shr1"
# FIXME: should not send "run" explicitly. Non-portable.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-21 23:12 ` J. Johnston
@ 2004-01-22 0:20 ` Daniel Jacobowitz
2004-01-22 1:08 ` J. Johnston
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2004-01-22 0:20 UTC (permalink / raw)
To: gdb-patches
On Wed, Jan 21, 2004 at 06:12:29PM -0500, J. Johnston wrote:
> >>+ -re "Make breakpoint pending.*y or n. $" {
> >>+ send_gdb "n\n";
> >>+ fail "setting breakpoint at $function" ;
> >>+ return 0
> >>+ }
> >
> >
> >[in lib/gdb.exp] ditto.
> >
>
> Daniel, can you clarify this last comment. Is something wrong with the
> prompt test in the -re line or do you want me to change the send_gdb to be
> a gdb_test?
The latter, sorry. The basic rule is, if a test causes GDB to print
something out, the test must also eat the output.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-21 22:20 ` Daniel Jacobowitz
@ 2004-01-21 23:12 ` J. Johnston
2004-01-22 0:20 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: J. Johnston @ 2004-01-21 23:12 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
Daniel Jacobowitz wrote:
> On Wed, Jan 21, 2004 at 04:03:28PM -0500, Jeff Johnston wrote:
>
>>The following makes changes to the testsuite to accomodate the pending
>>breakpoint support.
>>A new test case has been added to test pending breakpoint support.
>>
>>Ok to commit?
>
>
> Needs a tweak.
>
>
>>-gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \
>>- "break on nonexistent function in langs.exp"
>
>
> This has an implicit "$gdb_prompt $" anchor. All of the following
> cases need something similar; for the pending case that means you
> should replace send_gdb "n\n" with, probably, gdb_test "n" "" "break
> on...".
>
>
>>+gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
>>+ -re ".*Make breakpoint pending.*$" {
>
>
> Similarly, don't do that. As soon as expect's buffer is full, it will
> try to match, and succeed; possibly leaving a pending $gdb_prompt for
> another test to match, getting us hideously out of sync. Match
> whatever prompt you
>
>
>
>>+ -re "Make breakpoint pending.*y or n. $" {
>>+ send_gdb "n\n";
>>+ fail "setting breakpoint at $function" ;
>>+ return 0
>>+ }
>
>
> [in lib/gdb.exp] ditto.
>
Daniel, can you clarify this last comment. Is something wrong with the prompt
test in the -re line or do you want me to change the send_gdb to be a gdb_test?
-- Jeff J.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [RFA]: pending breakpoint support [2/3]
2004-01-21 21:03 Jeff Johnston
@ 2004-01-21 22:20 ` Daniel Jacobowitz
2004-01-21 23:12 ` J. Johnston
0 siblings, 1 reply; 14+ messages in thread
From: Daniel Jacobowitz @ 2004-01-21 22:20 UTC (permalink / raw)
To: Jeff Johnston; +Cc: gdb-patches
On Wed, Jan 21, 2004 at 04:03:28PM -0500, Jeff Johnston wrote:
> The following makes changes to the testsuite to accomodate the pending
> breakpoint support.
> A new test case has been added to test pending breakpoint support.
>
> Ok to commit?
Needs a tweak.
> -gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \
> - "break on nonexistent function in langs.exp"
This has an implicit "$gdb_prompt $" anchor. All of the following
cases need something similar; for the pending case that means you
should replace send_gdb "n\n" with, probably, gdb_test "n" "" "break
on...".
> +gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
> + -re ".*Make breakpoint pending.*$" {
Similarly, don't do that. As soon as expect's buffer is full, it will
try to match, and succeed; possibly leaving a pending $gdb_prompt for
another test to match, getting us hideously out of sync. Match
whatever prompt you
> + -re "Make breakpoint pending.*y or n. $" {
> + send_gdb "n\n";
> + fail "setting breakpoint at $function" ;
> + return 0
> + }
[in lib/gdb.exp] ditto.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 14+ messages in thread
* [RFA]: pending breakpoint support [2/3]
@ 2004-01-21 21:03 Jeff Johnston
2004-01-21 22:20 ` Daniel Jacobowitz
0 siblings, 1 reply; 14+ messages in thread
From: Jeff Johnston @ 2004-01-21 21:03 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 668 bytes --]
The following makes changes to the testsuite to accomodate the pending
breakpoint support.
A new test case has been added to test pending breakpoint support.
Ok to commit?
-- Jeff J.
2004-01-21 Jeff Johnston <jjohnstn@redhat.com>
* lib/gdb.exp (gdb_breakpoint): Add pending breakpoint
support.
* gdb.base/langs.exp: Fix test which attempts to create
breakpoint on non-existent function to handle new pending
support.
* gdb.base/shlib-call.exp: Use gdb_breakpoint to set
a breakpoint.
* gdb.base/pending.exp: New test.
* gdb.base/pending.c: New file.
* gdb.base/pendshr.c: Ditto.
[-- Attachment #2: pbreak.patch2 --]
[-- Type: text/plain, Size: 12487 bytes --]
Index: testsuite/gdb.base/langs.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/langs.exp,v
retrieving revision 1.2
diff -u -p -r1.2 langs.exp
--- testsuite/gdb.base/langs.exp 23 Jun 2003 22:42:50 -0000 1.2
+++ testsuite/gdb.base/langs.exp 21 Jan 2004 02:36:24 -0000
@@ -65,8 +65,22 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
-gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \
- "break on nonexistent function in langs.exp"
+gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" {
+ -re "Function \"langs0\" not defined\.$" {
+ pass "break on nonexistent function in langs.exp"
+ }
+ -re "Function \"langs0\" not defined\..*Make breakpoint pending.*" {
+ send_gdb "n\n"
+ pass "break on nonexistent function in langs.exp"
+ }
+ -re "Breakpoint .* (deferred).*" {
+ pass "break on nonexistent function in langs.exp"
+ }
+ -re ".*$gdb_prompt.*" {
+ fail "break on nonexistent function in langs.exp"
+ }
+ timeout { fail "break on nonexistent function in langs.exp" }
+}
if {$hp_aCC_compiler} {
set isfixed 1
Index: testsuite/gdb.base/pending.c
===================================================================
RCS file: testsuite/gdb.base/pending.c
diff -N testsuite/gdb.base/pending.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.base/pending.c 21 Jan 2004 02:36:24 -0000
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int k = 0;
+
+extern void pendfunc1 (int x);
+
+int main()
+{
+ pendfunc1 (3); /* break main here */
+ pendfunc1 (4);
+ k = 1;
+ pendfunc1 (3);
+ return 0;
+}
Index: testsuite/gdb.base/pending.exp
===================================================================
RCS file: testsuite/gdb.base/pending.exp
diff -N testsuite/gdb.base/pending.exp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.base/pending.exp 21 Jan 2004 02:36:24 -0000
@@ -0,0 +1,287 @@
+# Copyright 2003, 2004
+# Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was created by Jeff Johnston. (jjohnstn@redhat.com)
+# The shared library compilation portion was copied from shlib-call.exp which was
+# written by Elena Zannoni (ezannoni@redhat.com).
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+# are we on a target board?
+if ![isnative] then {
+ return 0
+}
+
+set testfile "pending"
+set libfile "pendshr"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Build the shared libraries this test case needs.
+#
+
+if {$gcc_compiled == 0} {
+ if [istarget "hppa*-hp-hpux*"] then {
+ set additional_flags "additional_flags=+z"
+ } elseif { [istarget "mips-sgi-irix*"] } {
+ # Disable SGI compiler's implicit -Dsgi
+ set additional_flags "additional_flags=-Usgi"
+ } else {
+ # don't know what the compiler is...
+ set additional_flags ""
+ }
+} else {
+ if { ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"]) } {
+ set additional_flags ""
+ } else {
+ set additional_flags "additional_flags=-fpic"
+ }
+}
+
+if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.o" object [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+if [istarget "hppa*-*-hpux*"] {
+ remote_exec build "ld -b ${objdir}/${subdir}/${libfile}.o -o ${objdir}/${subdir}/${libfile}.sl"
+} else {
+ set additional_flags "additional_flags=-shared"
+ if {[gdb_compile "${objdir}/${subdir}/${libfile}.o" "${objdir}/${subdir}/${libfile}.sl" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ }
+}
+
+if { ($gcc_compiled
+ && ([istarget "powerpc*-*-aix*"]
+ || [istarget "rs6000*-*-aix*"] )) } {
+ set additional_flags "additional_flags=-L${objdir}/${subdir}"
+} elseif { [istarget "mips-sgi-irix*"] } {
+ set additional_flags "additional_flags=-rpath ${objdir}/${subdir}"
+} else {
+ set additional_flags ""
+}
+if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.sl" "${binfile}" executable [list debug $additional_flags]] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if [target_info exists gdb_stub] {
+ gdb_step_for_stub;
+}
+#
+# Test setting, querying, and modifying pending breakpoints
+#
+
+# Test deleting all breakpoints when there are none installed,
+# GDB should not prompt for confirmation.
+# Note that gdb-init.exp provides a "delete_breakpoints" proc
+# for general use elsewhere.
+
+gdb_test_multiple "break pendfunc1" "set pending breakpoint" {
+ -re ".*Make breakpoint pending.*$" {
+ gdb_test_multiple "y" "set pending breakpoint" {
+ -re "Breakpoint.*pendfunc1.*pending.*$gdb_prompt $" {
+ pass "set pending breakpoint"
+ }
+ }
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \
+"single pending breakpoint info"
+
+#
+# Test breaking at existing function
+#
+
+set mainline [gdb_get_line_number "break main here"]
+
+gdb_test "break main" \
+ "Breakpoint.*at.* file .*$srcfile, line $mainline.*" \
+ "breakpoint function"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus real breakpoint info"
+
+
+#
+# Test not setting a pending breakpoint
+#
+gdb_test_multiple "break pendfunc2" "Don't set pending breakpoint" {
+ -re ".*Make breakpoint pending.*$" {
+ gdb_test_multiple "n" "Don't set pending breakpoint" {
+ -re "$gdb_prompt $" {
+ pass "Don't set pending breakpoint"
+ }
+ }
+ }
+}
+
+#
+# Add condition to pending breakpoint
+#
+
+gdb_test "condition 1 k == 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending plus condition"
+
+#
+# Disable pending breakpoint
+#
+
+gdb_test "disable 1\n" ""
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled"
+
+#
+# Add commands to pending breakpoint
+#
+
+send_gdb "commands 1\n"
+send_gdb "print k\n"
+send_gdb "end\n"
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \
+"pending disabled plus commands"
+
+#
+# Try a pending break for a line in a source file with a condition
+#
+
+gdb_test_multiple "break pendshr.c:6 if x > 3" "Set pending breakpoint 2" {
+ -re ".*Make breakpoint pending.*$" {
+ gdb_test_multiple "y" "Set pending breakpoint 2" {
+ -re "Breakpoint.*pendshr.c:6.*pending.*$gdb_prompt $" {
+ pass "Set pending breakpoint 2"
+ }
+ }
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.*
+\[\t \]+stop only if k == 1.*
+\[\t \]+print k.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:6 if x > 3.*" \
+"multiple pending breakpoints"
+
+#
+# Run to main which should resolve a pending breakpoint
+#
+
+gdb_test "run" \
+".*Pending breakpoint \"pendshr.c:6 if x > 3\" resolved.*
+Breakpoint.*at.*
+Breakpoint.*, main.*$mainline.*" \
+"running to main"
+
+#
+# Re-enable the first pending breakpoint which should resolve
+#
+
+gdb_test "enable 1" \
+"Pending breakpoint \"pendfunc1.* resolved.*
+Breakpoint.*at.*" \
+"re-enabling pending breakpoint that can resolve instantly"
+
+#
+# Continue to verify conditionals and commands for breakpoints are honored
+#
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:6.*" \
+"continue to resolved breakpoint 2"
+
+gdb_test "continue" \
+".*Breakpoint.*pendfunc1.*at.*pendshr.c:5.*
+\[$\]1 = 1.*" \
+"continue to resolved breakpoint 1"
+
+delete_breakpoints
+
+gdb_breakpoint "main"
+
+#
+# Set non-existent pending breakpoint
+#
+gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" {
+ -re ".*Make breakpoint pending.*$" {
+ gdb_test_multiple "y" "set imaginary pending breakpoint" {
+ -re "Breakpoint.*imaginary.*pending.*$gdb_prompt $" {
+ pass "set imaginary pending breakpoint"
+ }
+ }
+ }
+}
+
+#
+# rerun program and make sure that any pending breakpoint remains and no
+# error messages are issued for the missing function
+#
+
+rerun_to_main
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \
+"verify pending breakpoint after restart"
Index: testsuite/gdb.base/pendshr.c
===================================================================
RCS file: testsuite/gdb.base/pendshr.c
diff -N testsuite/gdb.base/pendshr.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/gdb.base/pendshr.c 21 Jan 2004 02:36:24 -0000
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void pendfunc1 (int x)
+{
+ int y = x + 4;
+ printf ("in pendfunc1, x is %d\n", x);
+}
Index: testsuite/gdb.base/shlib-call.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/shlib-call.exp,v
retrieving revision 1.7
diff -u -p -r1.7 shlib-call.exp
--- testsuite/gdb.base/shlib-call.exp 28 Sep 2002 01:12:04 -0000 1.7
+++ testsuite/gdb.base/shlib-call.exp 21 Jan 2004 02:36:24 -0000
@@ -291,7 +291,7 @@ send_gdb "set width 0\n" ; gdb_expect -r
# PR's 16495, 18213
# test that we can re-set breakpoints in shared libraries
-gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library"
+gdb_breakpoint "shr1"
# FIXME: should not send "run" explicitly. Non-portable.
Index: testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.42
diff -u -p -r1.42 gdb.exp
--- testsuite/lib/gdb.exp 12 Jan 2004 17:20:41 -0000 1.42
+++ testsuite/lib/gdb.exp 21 Jan 2004 02:36:24 -0000
@@ -269,6 +269,11 @@ proc gdb_breakpoint { function } {
-re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {}
-re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {}
+ -re "Make breakpoint pending.*y or n. $" {
+ send_gdb "n\n";
+ fail "setting breakpoint at $function" ;
+ return 0
+ }
-re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 }
timeout { fail "setting breakpoint at $function (timeout)" ; return 0 }
}
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2004-02-02 21:17 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-21 22:20 [RFA]: pending breakpoint support [2/3] Michael Elizabeth Chastain
2004-01-21 22:58 ` J. Johnston
2004-01-21 23:14 ` J. Johnston
-- strict thread matches above, loose matches on Subject: below --
2004-01-24 7:31 Michael Elizabeth Chastain
2004-01-24 10:36 ` Eli Zaretskii
2004-02-02 21:17 ` Jeff Johnston
2004-01-21 21:03 Jeff Johnston
2004-01-21 22:20 ` Daniel Jacobowitz
2004-01-21 23:12 ` J. Johnston
2004-01-22 0:20 ` Daniel Jacobowitz
2004-01-22 1:08 ` J. Johnston
2004-01-22 22:40 ` Daniel Jacobowitz
2004-01-23 1:06 ` J. Johnston
2004-01-23 15:01 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox