Pages: [1]   Go Down
Author Topic: perl5matcher stackoverflow  (Read 5469 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 80
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Offline Offline
Faraday Member
**
Karma: 41
Posts: 3783
@ssh0le
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

that is odd, ive written comments longer than that in 17 with no issues (sofar) (windows)

sorry but no help from me  smiley-sad
« Last Edit: November 10, 2009, 07:16:29 pm by Osgeld » Logged


0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 80
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

btw, the same sketch uploads fine with 17 on mac
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 80
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 613
Posts: 49310
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Jr. Member
**
Karma: 0
Posts: 80
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 613
Posts: 49310
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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 Offline
Jr. Member
**
Karma: 0
Posts: 80
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Jr. Member
**
Karma: 0
Posts: 80
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks
Logged

0
Offline Offline
Jr. Member
**
Karma: 3
Posts: 77
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: