Subject: Re: fail executing large code
From: Michele Paoli <[email-masked]>
To: [email-masked]
Date: Tue, 26 Oct 1999 17:04:56 +0200

Your suggestion was a simple but good idea.

I would like to explain my error:
I wrote a demo program to test my library, and the demo source contains
this line:

namespace Demo
{

  .....

  main()
  {
    cout << "Hello" <<endl;

    .....
	
  }

}//end namespace.

I suppose that you cannot put the function main() inside the namespace
but under linux the compilation works fine and so does the execution.
Under WinNT, with cygnus, again the compilation works fine but the
execution throws the exception mentioned in the first occurence of
ostream opeator '<<' invocation.

This is the gdb output:
GNU gdb 4.17.1
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i586-cygwin32"...
(gdb) break 134
Breakpoint 1 at 0x403276: file TReSyDemo.cc, line 134.
(gdb) run
Starting program:
//d/utenti/frecco/lavoro/project/TReSyDemoStaticLib.exe 
61000000://d/PROGRA~1/cygnus/CYGWIN~1/H-I586~1/bin/cygwin1.dll
77e70000:/WINNT/system32/USER32.dll
77ed0000:/WINNT/system32/GDI32.dll
77e10000:/WINNT/system32/RPCRT4.dll
77bf0000:/WINNT/System32/rpcltc1.dll

Breakpoint 1, main (argc=1, argv=0xa030fe0) at TReSyDemo.cc:134
134		cout << "usage: "<<argv[0]<<" <cosa>  [<indexName>] [<pathFile>]" 
<< endl;
(gdb) list
129	      string    pathFileDirettive("direttive.txt");
130	      string    indexName("TReSyDemo");
131	
132	
133	      if (argc <= 1) {
134		cout << "usage: "<<argv[0]<<" <cosa>  [<indexName>] [<pathFile>]" 
<< endl;
135		cout << "         <cosa> 'crea'   -> crea l'indice su <pathFile>." 
<< endl;
136		cout << "                'mount'  -> monta l'indice <indexName> ed
eseguo debug_print."  << endl;
137		cout << "                'search' -> monta l'indice <indexName> e
esegue una search."  << endl;
138		cout << "         <indexName> nome dell'indice. Default
\""<<indexName<<"\"."  << endl;
(gdb) s
0x521c38 in ostream::operator<< () at LexicalAnalizer.cc:1987
1987		}
(gdb) list
1982	static void yy_flex_free( ptr )
1983	void *ptr;
1984	#endif
1985		{
1986		free( ptr );
1987		}
1988	
1989	#if YY_MAIN
1990	int main()
1991		{
(gdb) quit
The program is running.  Exit anyway? (y or n) 

By moving the function main() out of the namespace the problem is
solved,
but I think that the compiler should trace this error.

Has anyone any suggestion o comment about it?

Chris Faylor wrote:
> 
> Run your program under gdb to determine where it is dying.
> 
> cgf
> 
> On Mon, Oct 25, 1999 at 10:54:47AM +0200, Michele Paoli wrote:
> >hi all,
> >
> >executing an application compiled with cygnus r b20 i get this
> >exception:
> >
> >  [main] d:\utenti\Frecco\lavoro\project\TReSyDemo.exe 1761 (0)
> >handle_exceptions: Exception:  STATUS_ACCESS_VIOLATION
> >  [main] TReSyDemo 1761 (0) handle_exceptions: Dumping stack trace to
> >TReSyDemo.exe.core
> >
> >any one can suggest me which kind of problem?
> >The error arrive before any line of code was executed and smaller
> >program have not any problem.
> >
> >Thanks a lot.

-- 
 ==================================================================
  Michele Paoli - Computer Research for Cultural Heritage Centre
 ------------------------------------------------------------------
  via della Faggiola, 19 - 56126 Pisa (Italy)
  Phone  +39 (0)50 509409
  e-mail [email-masked]
 ==================================================================

--
Want to unsubscribe from this list?
Send a message to [email-masked]