Re: [gts-general] g_assert woes
Brought to you by:
popinet
From: Rob M. <ro...@as...> - 2005-04-06 17:45:16
|
s after a g_assert happens will likely be fruitless. I'm all for graceful error handling, but you need to have realistic goals for how graceful this actually is. The long jump mentioned below saves the thread environment at a specified point and then restores that at a later point. I don't know that this makes sense in the GTS way, but trying to continue performing boolean operations after a failed g_assert (even with some sort of exception handling) seems silly. For starters, I would try to set up the exception handling to print out lots of good debugging information. Maybe even save files for the two offending surfaces. (Of course, writing the truncated ascii representation of the surfaces doesn't ensure that they will fail when read back in. We need an easy way to save binary files.) Once you are comfortable with that; you may be able to attempt to actually recover what you were doing. You'll have to back up to a known good state, and then proceed forward differently somehow. If you are modeling CNC tool paths, maybe you want to slightly change your timestep; this will result in a different set of triangles passed to the next boolean operation. Getting execution to continue past the g_assert is only the first step. g_assert crashes hard because continuing doesn't make sense. Now that you've gotten past that point, you need to make it so that it continues to make sense. I would probably attempt a different approach... I would change each g_assert to a straightforward if statement. If you hit that chunk of code, print out tons of debugging information, dump files, etc. to hopefully reconstruct the problem in a simpler case. After the debugging code, I would stick in the g_assert and let it crash hard. Then, I would try to share your simple failure case with the group, and try to see if anyone can fix GTS... Rob > Gert, > > Thanks for your help! I'm developing a Windows only app as it stands > right now and compiling with the Visual Studio compiler. It allows you > to do structured exception handling in C, which I think is similar to > what you have suggested. I set the GTS compilation up so that if an > assertion fails in Boolean.c, it throws an exception using __throw. I > then catch it and handle it with __except. It seemed to work the first > time that the exception occurred, but things hung up after that. I'm > not sure if a static variable was being set somewhere in GTS that caused > problems and my exceptions were jumping out of it, so I figured my quick > fix didn't work correctly and needed more attention. I'll look into it > further, and if you have any more ideas, keep 'em coming:) > > Thanks again, > > Jason > > -----Original Message----- > From: gts...@li... > [mailto:gts...@li...] On Behalf Of Gert > Wollny > Sent: Wednesday, April 06, 2005 10:47 AM > To: gts...@li... > Subject: RE: [gts-general] g_assert woes > > Hello Jason, > > I was thinking about this ... > > first, you might try to look at (sig)setjmp/longjmp > http://www.opengroup.org/onlinepubs/007908799/xsh/longjmp.html > > Replacing the failing assertion by a longjmp (with a setjmp outside) > might be a way handle these errors gracefully. I haven't used it by > myself, but it's somewhat like C++ exceptions. > > It might also be helpful to get a hold on the offending input data, so > that a test case can be created and used for further debugging. > > Png uses lingjmp constructs, and someone posted some examples: > http://www.massey.ac.nz/~mgwalker/misc/create-images/jmp.c > http://www.massey.ac.nz/~mgwalker/misc/create-images/jmp2.c > > I hope it helps. > > Cheers > > Gert > > > -- > http://malachit.cbs.mpg.de:8080/MPI_Base/Mitarbeiter/homepage_MA_html?us > er=wollny > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Gts-general mailing list > Gts...@li... > https://lists.sourceforge.net/lists/listinfo/gts-general > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Gts-general mailing list > Gts...@li... > https://lists.sourceforge.net/lists/listinfo/gts-general > |