0
Offline
Jr. Member
Karma: 0
Posts: 69
Arduino rocks
|
 |
« on: November 10, 2009, 06:56:04 pm » |
This is really odd. I'm getting a stackoverflow error when uploading my sketch:
java.lang.StackOverflowError at java.util.Vector.addElement(Unknown Source) at java.util.Stack.push(Unknown Source) at com.oroinc.text.regex.Perl5Matcher._pushState(Perl5Matcher.java)
My sketch has the following:
void sendFrame(bool data, const char *charPtr, bool nullTerm) { if (nullTerm) { // special handling for commands that end with null terminator. the write command will not write the term char so we must write it explicitely
But when I change remove " we must write it explicitely" from the end of the comment, it works
This is Arduino 17 on windows.
Andrew
|
|
|
|
|
Logged
|
|
|
|
|
SE USA
Online
Faraday Member
Karma: 33
Posts: 3621
@ssh0le
|
 |
« Reply #1 on: November 10, 2009, 07:02:32 pm » |
that is odd, ive written comments longer than that in 17 with no issues (sofar) (windows) sorry but no help from me 
|
|
|
|
« Last Edit: November 10, 2009, 07:16:29 pm by Osgeld »
|
Logged
|
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 69
Arduino rocks
|
 |
« Reply #2 on: November 10, 2009, 07:05:29 pm » |
btw, the same sketch uploads fine with 17 on mac
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 69
Arduino rocks
|
 |
« Reply #3 on: November 11, 2009, 09:08:25 am » |
The problem was:
char x = '\"';
should be
char x = '"';
This is a bug in the Arduino IDE since that is a legal assignment. What's weird is that the program worked up until it got to a certain size. In this case my comment triggered some condition.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 312
Posts: 35483
Seattle, WA USA
|
 |
« Reply #4 on: November 11, 2009, 09:35:14 am » |
Since comments are ignored by the compiler, it's difficult to believe that they are the cause of the problem.
The assignment of \" (an escaped double quote) may be a legal assignment, but what value is actually placed in x?
It's likely that the invalid value in x was causing problems that didn't show up until x got put in a memory location that some code is overwriting, due to writing out-of-bounds, or mis-reading (again due to an out-of-bounds situation).
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 69
Arduino rocks
|
 |
« Reply #5 on: November 11, 2009, 10:46:11 am » |
But the error was not occurring in the compiler -- it never even got to compilation. It was occurring in the IDE (java).
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 312
Posts: 35483
Seattle, WA USA
|
 |
« Reply #6 on: November 11, 2009, 11:08:15 am » |
This is really odd. I'm getting a stackoverflow error when uploading my sketch: If you never got to the compiler, what were you uploading?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 69
Arduino rocks
|
 |
« Reply #7 on: November 11, 2009, 11:33:29 am » |
To clarify, the error occurred when I hit the "upload" button, not when it was uploading, because it never got that far. That stacktrace indicates a java error in the IDE. Possibly in the oroinc library. Again, it didn't get to the compilation step. As I modified the program, it got to a point where I could prevent the error if I removed an arbitrary chunk of code, but unfortunately I needed that code. Here's another instance of the same problem http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234031376
|
|
|
|
|
Logged
|
|
|
|
|
Forum Administrator
Cambridge, MA
Offline
Faraday Member
Karma: 7
Posts: 3532
|
 |
« Reply #8 on: November 18, 2009, 10:37:32 am » |
Sorry about that. The IDE includes some relatively hacky code to preprocess your source code to add function prototypes. It's just a bunch of regular expressions that can get confused by certain unusual strings in your code (including within comments). I added a note about this to troubleshooting guide: http://arduino.cc/en/Guide/Troubleshooting#stackoverflow
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 0
Posts: 69
Arduino rocks
|
 |
« Reply #9 on: November 18, 2009, 12:33:56 pm » |
thanks
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 77
Arduino rocks
|
 |
« Reply #10 on: January 23, 2011, 05:59:08 pm » |
This problem nearly drove me crazy. Finally I discovered a debugging line:
Serial.println(" no registration file);
Adding the " at the end of the string fixed it fine.
I dimly remember sticking the line in about (probably exactly before) the time everything turned to worms
|
|
|
|
|
Logged
|
|
|
|
|
|