Runtime Error on PCRE library, really need help!
-
I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex. The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper. Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running. Here's the part of "regexp.h" in FreeLing. The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line.
private: void clone(const RegEx &y) { size_t size; if (!y.re) return; pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size); re=(pcre*) new char[size]; if (!re) { throw "not enough memory"; } else { std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl; } memcpy(re, y.re, size); // Run time error on pcre_fullinfo(); pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size); pe = (pcre_extra *) new char[size]; if (!pe) throw "not enough memory"; memcpy(pe, y.pe, size); substrcount = y.substrcount; ovector = new int[3*substrcount]; matchlist = NULL; }
And the error in pcre_fullinfo(); in PCRE.C is below. On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE";int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) { const real_pcre *re = (const real_pcre *)external_re; const pcre_study_data *study = NULL; if (re == NULL || where == NULL) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) study = extra_data->study_data; switch (what) { case PCRE_INFO_OPTIONS: *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break; case PCRE_INFO_SIZE: *((size_t *)where) = re->size; break; case PCRE_INFO_STUDYSIZE: *((size_t *)where) = (study == NULL)? 0 : study->size; break; // more code here
I'm using VS.NET 2003 and the error-pop -
I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex. The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper. Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running. Here's the part of "regexp.h" in FreeLing. The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line.
private: void clone(const RegEx &y) { size_t size; if (!y.re) return; pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size); re=(pcre*) new char[size]; if (!re) { throw "not enough memory"; } else { std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl; } memcpy(re, y.re, size); // Run time error on pcre_fullinfo(); pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size); pe = (pcre_extra *) new char[size]; if (!pe) throw "not enough memory"; memcpy(pe, y.pe, size); substrcount = y.substrcount; ovector = new int[3*substrcount]; matchlist = NULL; }
And the error in pcre_fullinfo(); in PCRE.C is below. On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE";int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) { const real_pcre *re = (const real_pcre *)external_re; const pcre_study_data *study = NULL; if (re == NULL || where == NULL) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) study = extra_data->study_data; switch (what) { case PCRE_INFO_OPTIONS: *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break; case PCRE_INFO_SIZE: *((size_t *)where) = re->size; break; case PCRE_INFO_STUDYSIZE: *((size_t *)where) = (study == NULL)? 0 : study->size; break; // more code here
I'm using VS.NET 2003 and the error-popMore information on the Call Stack under debug It seem that error is from the "study" variable, which is of "pcre_study_data" type.
- re 0x00324278 {magic_number=0x50435245 size=0x0000005e tables=0x00737140 "" ...} const real_pcre * magic_number 0x50435245 unsigned long size 0x0000005e unsigned int + tables 0x00737140 "" const unsigned char * options 0x00000010 unsigned long top_bracket 0x0001 unsigned short top_backref 0x0000 unsigned short first_byte 0xcdcd unsigned short req_byte 0xcdcd unsigned short name_entry_size 0x0003 unsigned short name_count 0x0000 unsigned short - study 0xabababab {size=??? options=??? start_bits=0xabababb0 } const pcre_study_data * size CXX0030: Error: expression cannot be evaluated unsigned int options CXX0030: Error: expression cannot be evaluated unsigned char + start_bits 0xabababb0 unsigned char [32]
-
I'm trying to port the FreeLing (Natural Language Processor) from linux to windows platform. The FreeLing used the PCRE library for reg-ex. The FreeLing is built on C++ (normal STL) langauage. And I know that it's required a C++ Wrapper for PCRE. BTW, FreeLing have included C++ Wrapper in their project. I'm trying to use its built-in wrapper because it is modify to suitable for their code. If I change to another wrapper for PCRE, I think I could have a lot of work to modify the wrapper. Let's see the error here. The Runtime error occur when the "void clone();" in "regexp.h" in FreeLing is running. Here's the part of "regexp.h" in FreeLing. The error is on "pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size);" Line.
private: void clone(const RegEx &y) { size_t size; if (!y.re) return; pcre_fullinfo(y.re, 0, PCRE_INFO_SIZE, &size); re=(pcre*) new char[size]; if (!re) { throw "not enough memory"; } else { std::cout << std::endl << "**** Making new re pointer Allocation successful.. *****" << std::endl; } memcpy(re, y.re, size); // Run time error on pcre_fullinfo(); pcre_fullinfo(y.re, y.pe, PCRE_INFO_STUDYSIZE, &size); pe = (pcre_extra *) new char[size]; if (!pe) throw "not enough memory"; memcpy(pe, y.pe, size); substrcount = y.substrcount; ovector = new int[3*substrcount]; matchlist = NULL; }
And the error in pcre_fullinfo(); in PCRE.C is below. On the line "*((size_t *)where) = (study == NULL)? 0 : study->size;" below "CASE:PCRE_INFO_STUDYSIZE";int pcre_fullinfo(const pcre *external_re, const pcre_extra *extra_data, int what, void *where) { const real_pcre *re = (const real_pcre *)external_re; const pcre_study_data *study = NULL; if (re == NULL || where == NULL) return PCRE_ERROR_NULL; if (re->magic_number != MAGIC_NUMBER) return PCRE_ERROR_BADMAGIC; if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_STUDY_DATA) != 0) study = extra_data->study_data; switch (what) { case PCRE_INFO_OPTIONS: *((unsigned long int *)where) = re->options & PUBLIC_OPTIONS; break; case PCRE_INFO_SIZE: *((size_t *)where) = re->size; break; case PCRE_INFO_STUDYSIZE: *((size_t *)where) = (study == NULL)? 0 : study->size; break; // more code here
I'm using VS.NET 2003 and the error-popThe address 0xabababab indicates a memory following a block allocated by LocalAlloc(). Means that you are stepping (wayyy) outside of your memory block Try setting a conditional break point on when the variable study change Papa while (TRUE) Papa.WillLove ( Bebe ) ;
-
The address 0xabababab indicates a memory following a block allocated by LocalAlloc(). Means that you are stepping (wayyy) outside of your memory block Try setting a conditional break point on when the variable study change Papa while (TRUE) Papa.WillLove ( Bebe ) ;