Re: gdb.objc/objcdecode.exp test error..

Matt Rice
2009-03-07T12:07:44Z

[-- Attachment #1: Type: text/plain, Size: 4084 bytes --]

Joel Wrote:
>but it would be better if you had a proper copyright assignment
>at least for GDB (I suggest to assign any past and future changes
>to any GNU software and be done with it, but I understand if you prefer
>to choose a more limited list of projects).

Thanks, I wasn't aware I could assign to all gnu projects,
I've started the paperwork, i'll let you know when its gone through.

>In the meantime, this looks reasonable to me. I can check it in
>for you if you'd like.

it doesn't matter much to me, we might as well just wait and get the
new tests in.

On Fri, Mar 6, 2009 at 11:13 AM, Pedro Alves <pedro@codesourcery.com> wrote:
> Joel Wrote:
>> Matt Rice wrote:
>> > i should probably come up with another test for multiple-symbols all,
>> > so neither failure gets forgotten, but i'll have to learn more about
>> > dejagnu before i'm able to do that.
>
>> That would be very nice if you could add these extra tests.
>> It makes sense to test the behaviour in the "ask" case, but we really
>> ought to try to test the default case as well.
>
> Indeed.  This test internal-errors for me currently, but the patch masks
> it.  I don't see any internal error mentioned in the PRs which
> are linked from the kfails?  It looks like a different bug.
>
>  http://sourceware.org/bugzilla/show_bug.cgi?id=8341
>  http://sourceware.org/bugzilla/show_bug.cgi?id=8343
>
> (gdb) PASS: gdb.objc/objcdecode.exp: break on multiply defined method
> run
> Starting program: /home/pedro/gdb/baseline/build/gdb/testsuite/gdb.objc/objcdecode
> ../../src/gdb/breakpoint.c:7451: internal-error: breakpoint_re_set_one: Assertion `sals.nelts == 1' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
>

yes this is a different albeit somewhat related bug, (same cause,
different effect),
it doesn't get this far when using 'ask'.

I went ahead and tried to do some new tests, when trying to clean those up
to use gdb_continue_to_breakpoint, I discovered that it works
correctly after we've hit main,
so i added some tests for that since it appears to be touching
different code paths.

below is some more information, on further reducing the test,
I wasn't sure if or how I should incorporate into the test, as i'm not
sure about the reliability of hard coding breakpoint numbers nor a way
to delete a breakpoint by function name,

it probably doesn't matter its already pretty much reduced.

let me know if you guys have any issues with the tests or ideas on
doing things cleaner,
still pretty new to dejagnu and its mostly just modifications of the
original 'ask' test.

Use the "delete" command to delete unwanted breakpoints.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x000000000040072c in -[Decode multipleDef]
at
../.././gdb/testsuite/gdb.objc/objcdecode.m:14
2 breakpoint keep y 0x0000000000400753 in multipleDef
at
../.././gdb/testsuite/gdb.objc/objcdecode.m:28
(gdb) delete 2
(gdb) r
Starting program: /home/ratmice/git/gdb/gdb/testsuite/gdb.objc/objcdecode
function multipleDef

Breakpoint 1, -[Decode multipleDef] (self=0x604f20, _cmd=0x601450)
at ../.././gdb/testsuite/gdb.objc/objcdecode.m:14
14 printf("method multipleDef\n");
(gdb) c
Continuing.
method multipleDef

Program exited normally.
(gdb) delete 1
(gdb) break multipleDef
Breakpoint 3 at 0x40072c: file
../.././gdb/testsuite/gdb.objc/objcdecode.m, line 14.
Breakpoint 4 at 0x400753: file
../.././gdb/testsuite/gdb.objc/objcdecode.m, line 28.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) delete 3
(gdb) r
Starting program: /home/ratmice/git/gdb/gdb/testsuite/gdb.objc/objcdecode
breakpoint.c:7450: internal-error: breakpoint_re_set_one: Assertion
`sals.nelts == 1' failed.

so it only fails on the multipleDef function, not the multipleDef method.

[-- Attachment #2: foo.diff --]
[-- Type: application/octet-stream, Size: 3084 bytes --]

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 50e61ce..4617c4d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-03-05 Matt Rice <ratmice@gmail.com>
+
+ * gdb.objc/objcdecode.exp: Set the multiple symbols found behaviour
+ to ask for the original test. Add tests for the multiple symbols
+ found behaviour of all.
+
2009-03-05 Paul Pluzhnikov <ppluzhnikov@google.com>

* solib-display.exp: New file.
diff --git a/gdb/testsuite/gdb.objc/objcdecode.exp b/gdb/testsuite/gdb.objc/objcdecode.exp
index b751fb9..1b77aa6 100644
--- a/gdb/testsuite/gdb.objc/objcdecode.exp
+++ b/gdb/testsuite/gdb.objc/objcdecode.exp
@@ -59,7 +59,8 @@ do_objc_tests
#
# Break on multiply defined method (PR objc/1236)
#
-set name "break on multiply defined method"
+set name "break on multiply defined method using multiple-symbols ask"
+gdb_test "set multiple-symbols ask" ""
gdb_test_multiple "break multipleDef" $name \
{
-re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] -.Decode multipleDef. at .*\r\n\\\[3\\\] multipleDef at .*\r\n> $" {
@@ -70,7 +71,7 @@ gdb_test_multiple "break multipleDef" $name \
-re ".*$gdb_prompt $" { kfail "gdb/1236" $name }
}

-set name "continue after break on multiply defined symbol"
+set name "run after setting breakpoints on multiply defined symbol"
gdb_run_cmd
gdb_test_multiple "" $name \
{
@@ -84,3 +85,53 @@ gdb_test_multiple "" $name \
# It would be difficult to do any more tests after this.
}
}
+
+do_objc_tests
+if ![runto_main] { fail "Can't run to main" }
+
+set name "break on multiply defined symbol with multiple-symbols all after main"
+gdb_test "set multiple-symbols all after main" ""
+gdb_test_multiple "break multipleDef" $name \
+{
+ -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\n$gdb_prompt $" { pass $name }
+ -re ".*$gdb_prompt $" { fail $name }
+}
+
+set name "can hit multiply defined breakpoint on function after main"
+gdb_continue_to_breakpoint "function multipleDef"
+
+set name "can hit multiply defined breakpoint on objc method after main"
+gdb_continue_to_breakpoint "method multipleDef"
+gdb_exit
+
+do_objc_tests
+
+set name "break on multiply defined symbol with multiple-symbols all before main"
+gdb_test_multiple "break multipleDef" $name \
+{
+ -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\nBreakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\n$gdb_prompt $" { pass $name }
+ -re ".*$gdb_prompt $" { fail $name }
+}
+
+set name "can hit multiply defined breakpoint on function before main"
+gdb_run_cmd
+gdb_test_multiple "" $name \
+{
+ -re "Breakpoint \[0-9\]+, multipleDef \\\(\\\) at .*\r\n$gdb_prompt $" {
+ pass $name
+ }
+ -re ".*$gdb_prompt $" { fail $name }
+}
+
+set name "can hit multiply defined breakpoint on function before main"
+gdb_test_multiple "continue" $name \
+{
+ -re "Breakpoint \[0-9\]+, -\[Decode multipleDef\] at .*\r\n$gdb_prompt $" {
+ pass $name
+ }
+ -re ".*$gdb_prompt $" { fail $name }
+}
+
+gdb_exit
+return 0
+