This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC]: Disallow ObjC search when resetting breakpoint.


This patch fixes PR objc/1238, where you get frustrating behavior if
there is an ObjC method with the same name as a function:

(gdb) break init
[0] cancel
[1] all
[2] -[MyObject init] at gdb-objc-test.m:50
[3] -[NewObject init] at gdb-objc-test.m:18
[4] init at gdb-objc-test.m:62
> 4
Breakpoint 1 at 0x10001a40: file gdb-objc-test.m, line 62.
(gdb) run
Starting program:
/home/users/fedor/src/gstep/Tester/shared_debug_obj/gdb-objc-test 
[0] cancel
[1] all
[2] -[MyObject init] at gdb-objc-test.m:50
[3] -[NewObject init] at gdb-objc-test.m:18
[4] init at gdb-objc-test.m:62
> 0
Error in re-setting breakpoint 1:
canceled
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 2249)]
[0] cancel
[1] all
[2] -[MyObject init] at gdb-objc-test.m:50
[3] -[NewObject init] at gdb-objc-test.m:18
[4] init at gdb-objc-test.m:62
> 
[... on and on ad infinitum ...]

What happens is that every time you try to reset a breakpoint,
decode_line_1 gets called and we search through all the ObjC selectors
for a match to the breakpoint and there are always multiple matches to
"init".

I don't particularly like the solution (It's the way Apple does it,
although it might be for more reasons than this, e.g. there's no reason
to go through the ObjC selector search when resetting a breakpoint
anyway). I can't think of any other way to do it though, unless perhaps
there is some way to canonicalize the symbol name for the breakpoint -
so it's something like "gdb-objc-test.m:init", and not just "init" -
then you won't get multiple matches.

Any comments?


Attachment: allow_objc.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]