This is the mail archive of the gdb-prs@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]

objc/1298: linespec.c detects false negatives when testing for ObjC method names


>Number:         1298
>Category:       objc
>Synopsis:       linespec.c detects false negatives when testing for ObjC method names
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 27 08:18:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     David Ayers
>Release:        GNU gdb 5.3.90_2003-07-27-cvs
>Organization:
>Environment:
i686-pc-linux-gnu (probably any)
>Description:
linespec.c line 672 and 975 test for an ObjC method, assuming a ':' prefix of a file name like: 'NSException.m:-[NSException raise]' yet this isn't always the case.  In certain cases the string merely look like '-[NSException raise]' and there for return a false negative.  This used to result in an incorrect warning output when gdb tried to reset this type of breakpoint in a shared library after the process was killed and restarted.  The diagnostig was:
Error in re-setting breakpoint 3:
Function "raise]" not defined.
instead of:
Error in re-setting breakpoint 3:
Function "-[NSException raise]" not defined.
Yet ever since updateing to the head of the release branch, this warning doesn't appear anymore.  (I'm not sure yet whether this was intentional or is a regression.)

Just removing the assumption of the ':' prefix seems to fix the problem.  I considered whether the problem was the missing "File:" prefix, but I don't think we have that information in all cases.

I'm unsure in what contexts decode_line_1 is used and whether these false negatives can result into serious problems else where, so I left Severity and Priority at thier default values.

It would be really nice if this could be fixed on the release branch, especially if this could result in unknown side effects. (So, I'm not really sure whether the Category: objc is really correct for this issue either or whether this should be gdb or breakpoints.)
>How-To-Repeat:
NOTE: This example has been adapted for minimal requierments.  Please subtitute -[NSException raise] with -[Protocol conformsTo:], when reading the description.

compile with:
gcc -g -fgnu-runtime -lobjc QuickTest.m -o QuickTest

gdb QuickTest
(gdb) b main
Breakpoint 1 at 0x8048580: file QuickTest.m, line 5.
(gdb) r
Breakpoint 1, main () at QuickTest.m:5
5         return(0);
(gdb) b conformsTo:
[0] cancel
[1] all
[2] +[Object conformsTo:] at /usr/local/src/gcc-3.2.1/libobjc/Object.m:206
[3] -[Object conformsTo:] at /usr/local/src/gcc-3.2.1/libobjc/Object.m:224
[4] -[Protocol conformsTo:] at /usr/local/src/gcc-3.2.1/libobjc/Protocol.m:59
> 4
Breakpoint 2 at 0x400321d7: file /usr/local/src/gcc-3.2.1/libobjc/Protocol.m, line 59.
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb) r
Starting program: /home/dave/ObjC/QuickTest/QuickTest 
...

At this point decode_line_1 is called multiple times with '-[Protocol conformsTo:]',
but the diagnostic message:
  Error in re-setting breakpoint 3:
  Function "raise]" not defined.
does not appear anymore.  This might be a seperate issue.  
But this report aims at the false negatives of whether this is an ObjC method.
>Fix:
Just remove the assumption of the ':' prefix.  I'm (almost) certain that '-[' and '+[' are sufficient to detect ObjC method names in this context.  If not, I have a patch with a pedantically correct test, that I can post once my paperwork is in place.  (I'm already expecting it.)
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="QuickTest.m"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="QuickTest.m"

I2luY2x1ZGUgPG9iamMvT2JqZWN0Lmg+CgppbnQgbWFpbiAoKQp7CiAgcmV0dXJuKDApOwp9Cgog
Cg==


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