From: Eli Zaretskii Newsgroups: comp.os.msdos.djgpp Subject: Re: Problem with Ctor/Dtor. Date: Mon, 13 Sep 1999 13:45:30 +0200 Organization: NetVision Israel Lines: 105 Message-ID: References: <937011029 DOT 69620 AT Chaos DOT es DOT co DOT nz> NNTP-Posting-Host: is.elta.co.il Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: news.netvision.net.il 937223057 3734 199.203.121.2 (13 Sep 1999 11:44:17 GMT) X-Complaints-To: abuse AT netvision DOT net DOT il NNTP-Posting-Date: 13 Sep 1999 11:44:17 GMT X-Sender: eliz AT is In-Reply-To: <937011029.69620@Chaos.es.co.nz> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sat, 11 Sep 1999, Christo Fogelberg wrote: > 1) When the class is destructed, the program crashes. > 2) If, for some bizarre reason, a string with an extension (.dat) is > entered, then the program crashes on constructing the database. Please tell what version of the compiler and Binutils are you using. If you use Binutils 2.9.1, did you patch the sources in any way, before building Binutils? If so, please tell what patches did you apply. > Exiting due to signal SIGILL > Invalid Opcode at eip=00000018 > eax=00000009 ebx=000b2dbc ecx=00000008 edx=00032a2a esi=00000056 > edi=00032b25 > ebp=000b2afd esp=000b2af1 program=C:\DJGPP\DATABASE\DATABA~1.EXE > cs: sel=00af base=835c4000 limit=000bffff > ds: sel=00b7 base=835c4000 limit=000bffff > es: sel=00b7 base=835c4000 limit=000bffff > fs: sel=0087 base=0000ef60 limit=0000ffff > gs: sel=00c7 base=00000000 limit=0010ffff > ss: sel=00b7 base=835c4000 limit=000bffff > App stack: [000b2b24..00032b24] Exceptn stack: [00032a00..00030ac0] > > Call frame traceback EIPs: > 0x00000018 0x18 > 0x00000140 0x140 > > ############################################## > > Exiting due to signal SIGSEGV > General Protection Fault at eip=00000014 > eax=00000009 ebx=000b2dbc ecx=00000006 edx=00032a28 esi=00000054 > edi=00032b24 > ebp=000b2afc esp=000b2ae4 program=C:\DJGPP\DATABASE\DATABA~1.EXE > cs: sel=00af base=835c4000 limit=000bffff > ds: sel=00b7 base=835c4000 limit=000bffff > es: sel=00b7 base=835c4000 limit=000bffff > fs: sel=0087 base=0000ef60 limit=0000ffff > gs: sel=00c7 base=00000000 limit=0010ffff > ss: sel=00b7 base=835c4000 limit=000bffff > App stack: [000b2b24..00032b24] Exceptn stack: [00032a00..00030ac0] > > Call frame traceback EIPs: > 0x00000014 0x14 > 0x00014020 ___djgpp_exception_table These two crashes seem to indicate that something is very wrong with your static constructors and destructors. It could be a result of some patch to Binutils. > Exiting due to signal SIGSEGV > General Protection Fault at eip=00008366 > eax=5e5be465 ebx=00000000 ecx=00014456 edx=fe040800 esi=00000011 > edi=00000020 > ebp=00014476 esp=000b2af8 program=C:\DJGPP\DATABASE\DATABA~1.EXE > cs: sel=00af base=835dc000 limit=000bffff > ds: sel=00b7 base=835dc000 limit=000bffff > es: sel=00b7 base=835dc000 limit=000bffff > fs: sel=0087 base=0000ef60 limit=0000ffff > gs: sel=00c7 base=00000000 limit=0010ffff > ss: sel=00b7 base=835dc000 limit=000bffff > App stack: [000b2b24..00032b24] Exceptn stack: [00032a00..00030ac0] > > Call frame traceback EIPs: > 0x00008366 ___8ofstreamiPCcii+226 EBP is trashed here (it's outside the valid limits for the stack, which are printed under "App stack"). I suggest running under a debugger to see what overwrites EBP. It's possible that some code overwrites a local array or something. > Exiting due to signal SIGSEGV > General Protection Fault at eip=000147bc > eax=746164fe ebx=000b2db0 ecx=000b2db0 edx=00032d48 esi=000b2db8 > edi=000000c8 > ebp=000b29d4 esp=000b29c8 program=C:\DJGPP\DATABASE\DATABA~1.EXE > cs: sel=00a7 base=835f6000 limit=000bffff > ds: sel=00af base=835f6000 limit=000bffff > es: sel=00af base=835f6000 limit=000bffff > fs: sel=0087 base=0000ef60 limit=0000ffff > gs: sel=00c7 base=00000000 limit=0010ffff > ss: sel=00af base=835f6000 limit=000bffff > App stack: [000b2b24..00032b24] Exceptn stack: [00032a00..00030ac0] > > Call frame traceback EIPs: > 0x000147bc _free+172 > 0x00004339 _deallocate__t23__malloc_alloc_template1i0PvUl+17, line 158 > of da > tabase2.cppd > 0x000042a1 > _deallocate__t12simple_alloc2Z8TestDataZt24__default_alloc_templa > te2b0i0P8TestDataUl+29, line 224 of database2.cpp > 0x00004238 __$_t6vector2Z8TestDataZt24__default_alloc_template2b0i0+32, > line > 126 of database2.cpp > 0x000020d9 _main+653, line 98 of database2.cpp > 0x0001401a ___crt1_startup+174 This seems to tell that you overwrite an allocated buffer, and thus trashing the hidden info maintained by malloc and free beyond the end of the buffer returned by malloc. Or it could be that you tried to free a buffer that wasn't result of malloc.