Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 142454 - Regression: debugging on Mac broken (no remote setup)
Regression: debugging on Mac broken (no remote setup)
Product: cnd
Classification: Unclassified
Component: Debugger
All All
: P1 (vote)
: 6.x
Assigned To: Egor Ushakov
: 146691 (view as bug list)
Depends on:
Blocks: 147938
  Show dependency treegraph
Reported: 2008-07-31 18:40 UTC by Thomas Preisler
Modified: 2009-06-25 10:59 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

log file (2.01 KB, text/plain)
2008-08-01 16:07 UTC, Thomas Preisler
log file (6.16 KB, text/plain)
2008-08-01 17:59 UTC, Thomas Preisler

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preisler 2008-07-31 18:40:29 UTC
I get the exception below when trying to start the debugger on Mac:. Note no remote setup and working locally.

java.lang.StringIndexOutOfBoundsException: String index out of range: -203
	at java.lang.String.substring(
	at org.netbeans.modules.cnd.debugger.gdb.utils.GdbUtils.createMapFromString(
	at org.netbeans.modules.cnd.debugger.gdb.GdbDebugger.resultRecord(
	at org.netbeans.modules.cnd.debugger.gdb.proxy.GdbProxyEngine.processMessage(
	at org.netbeans.modules.cnd.debugger.gdb.proxy.GdbProxyEngine.access$000(
	at org.netbeans.modules.cnd.debugger.gdb.proxy.GdbProxyEngine$
	at org.openide.util.RequestProcessor$
[catch] at org.openide.util.RequestProcessor$
Comment 1 _ gordonp 2008-08-01 02:30:43 UTC
It looks like its processing data returned from stopping at a breakpoint. To really
verify this we need to use the same test program with the same breakpoint. Do you
remember what program and what line of code your breakpoint was set at? Was it a
C or C++ program?

When gdb stops it sends various pieces of data back. This exception happened while
parsing that data. Thats why knowing the program and line of the bp are so important.
We could be failing on a specific set of data received from gdb, but stopping in
other programs or at other lines may not send data we can't parse.
Comment 2 Thomas Preisler 2008-08-01 05:13:44 UTC
It chokes when parsing the following string:


when it gets to shlib....

It happens with *any* program I'm trying to debug.
Comment 3 Egor Ushakov 2008-08-01 14:47:03 UTC
please attach full gdb-log
Comment 4 Thomas Preisler 2008-08-01 14:48:55 UTC
and where do I find it?
Comment 5 Egor Ushakov 2008-08-01 15:22:26 UTC
usually at /var/tmp/gdb-cmds####.log or /tmp/gdb-cmds####.log
Comment 6 _ gordonp 2008-08-01 15:49:52 UTC
> and where do I find it?

I seem to remember it being harder to find on a Mac. If you can't find it,
copy ~gordonp/NetBeansProjects/SystemProperties/dist/SystemProperties.jar,
run it, and check the value of

The jar file dumps the output of System.getProperties()...
Comment 7 Thomas Preisler 2008-08-01 16:07:07 UTC
Created attachment 66327 [details]
log file
Comment 8 Egor Ushakov 2008-08-01 16:29:11 UTC
The problem is that for some reason "timings" is enabled on your version of gdb,
because of that gdb adds time=... epilog to every response and we do not expect that.
Proposed fix is to send -enable-timings no to the debugger at the beginning,
I implemented it in the changeset:
Comment 9 Thomas Preisler 2008-08-01 17:30:42 UTC
Wouldn't it be better to just parse the string correctly?
Comment 10 Egor Ushakov 2008-08-01 17:43:58 UTC
I think that if we do not use this information, why shouldn't we disable it?
It can double gdb transport traffic.
Comment 11 _ gordonp 2008-08-01 17:49:54 UTC
While I agree we shouldn't turn on timing, we should also parse the line correctly
if it is on. This problem shows that there is at least 1 case where GdbUtils.findMatchingCurly()
fails. If there's on, how do we know there aren't others?

I do think your fix resolves the P1, though. I suggest closing this as fixed and
opening a P2 on findMatchingCurly() (or possibly a P3 since we've only seen this
one case of it failing).
Comment 12 Thomas Preisler 2008-08-01 17:58:22 UTC
No, it didn't fix th problem. It fails same plase as before. New log attached.
Comment 13 Thomas Preisler 2008-08-01 17:59:07 UTC
Created attachment 66338 [details]
log file
Comment 14 Thomas Preisler 2008-08-01 18:07:45 UTC
I noticed debugging fails only if I do 'Step Into' but seems to work if I do Debug. I don't know if it helps.....
Comment 15 _ gordonp 2008-08-01 19:12:57 UTC
I borrowed Thomas' Mac so I could debug in his enviornment. First off, it looks like
Apple broke gdb/mi wrt -enable-timer because even though you explicitly turn it off,
its still on. Thomas said he downloaded a new X-Code recently and probably got an
updated gdb with this problem.

But the actual cause of the problem isn't in GdbUtils, its in GdbDebugger.resulteRecord
where it processes "^done,bkpt=". There is an assumption that the entire msg is the
breakpoint data so we strip off the 1st and last characters ('{' and '}') before
passing the string to GdbUtils.createMapFromString(). Since this assumption is incorrect,
we end up with "},time={" in the middle of the string passed to cMFS.

In his 2nd log, the same thing is happening in "^done,stack={...},time={...}". Again, we
assume one outer set of curly braces, strip them off, and assume everything left is part
of the stack.

There are several other places where we make this same assumption. We should probably
find the closing curly and send a substring rather than make this assumption (although
its really an Apple gdb bug causing the problem). We probably don't need to explicitly
send the -enable-timer off flag (since it doesn't work, anyway:-)
Comment 16 Egor Ushakov 2008-08-01 20:54:09 UTC
-enable-timings does not work because gdb does not recognize this command:
104^error,msg="Undefined MI command: enable-timings"
Comment 17 Egor Ushakov 2008-08-04 10:02:27 UTC
Now we check every debugger response for timing info and cut it out,
implemented in the changeset:
Comment 18 Thomas Preisler 2008-08-04 15:47:56 UTC
Fix confirmed: Debugging now works again on my Mac. 
Comment 19 _ gordonp 2008-09-13 01:56:00 UTC
*** Issue 146691 has been marked as a duplicate of this issue. ***
Comment 20 Alexander Pepin 2008-09-17 13:30:57 UTC
Verified in trunk by Thomas. The fix should be included into patch 4.
Comment 21 bradford653 2008-09-23 16:24:07 UTC
Will the fix be incorporated into the 6.1 tree at all?  Some of us have no immediate plans to upgrade to 6.5 until it has been stable for a while.
Comment 22 _ gordonp 2008-09-23 16:31:46 UTC
> Will the fix be incorporated into the 6.1 tree at all?

Yes. The fix is scheduled for patch 4 (the next patch).
Comment 24 Alexander Pepin 2008-10-08 14:53:15 UTC
verified in patch4

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo