Go Down

Topic: perl5matcher stackoverflow (Read 5962 times) previous topic - next topic

rappa

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

Osgeld

#1
Nov 11, 2009, 01:02 am Last Edit: Nov 11, 2009, 01:16 am by Osgeld Reason: 1
that is odd, ive written comments longer than that in 17 with no issues (sofar) (windows)

sorry but no help from me  :(
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

rappa

btw, the same sketch uploads fine with 17 on mac

rappa

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.

PaulS

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).

rappa

But the error was not occurring in the compiler -- it never even got to compilation.  It was occurring in the IDE (java).

PaulS

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?

rappa

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

mellis

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


jcarrr

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

Go Up