openscad/openscad — Issue #87: Exception from cache trimming debug
Author: caliston
Created: 2012-02-08 17:17:15+00:00
State: open

I'm running a fairly complex file through yesterday's OpenSCAD (git 7ae1f6da18abbde326410791dfde3ce361550f88 ) with debug enabled. I'm getting an exception when Cache::trim in src/cache.h tries to PRINTB a debug printout:

#ifdef DEBUG
PRINTB("Trimming cache: %1% (%d bytes)", *u->keyPtr % u->c);
#endif

then /usr/include/boost/format/parsing.hpp throws an exception:
if( !ordered_args) {
if(max_argN >= 0 ) { // dont mix positional with non-positionnal directives
if(exceptions() & io::bad_format_string_bit)
boost::throw_exception(io::bad_format_string(max_argN, 0));
// else do nothing. => positionnal arguments are processed as non-positionnal
}
(the above from Ubuntu 11.04, which appears to be Boost 1.42.0)

My file is 60K and depends on all sorts of DXF and STL inclusions so I can't really include it here. However, this is the backtrace:
http://www.cl.cam.ac.uk/~atm26/ephemeral/20120208-openscad-backtrace.png
and the debugger's idea of the data structures:
http://www.cl.cam.ac.uk/~atm26/ephemeral/20120208-openscad-printb-exception.png

The bit of model that data structure is referring to is:

module alprofile() {
if (render_al_extrusion_shape && !project_upstairs_central_plane)
{
translate([-1.5*cm, -1.5*cm, 0]) polygon(points=[[0*mm,0*mm],[11*mm,0*cm],[11*mm,7.5*mm],[19*mm,7.5*mm],[19*mm,0*cm],[3.0*cm,0*cm],[3.0*cm,1.1*cm],[2.25*cm,1.1*cm],[2.25*cm,1.9*cm],[3.0*cm,1.9*cm],[3.0*cm,3.0*cm],[1.9*cm,3.0*cm],[1.9*cm,2.25*cm],[1.1*cm,2.25*cm],[1.1*cm,3.0*cm],[0*cm,3.0*cm],[0*cm,1.9*cm],[0.75*cm,1.9*cm],[0.75*cm,1.1*cm],[0*cm,1.1*cm]],paths=[[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]]);
} else {
translate([-1.5*cm, -1.5*cm, 0]) polygon(points=[[0*cm,0*cm],[3.0*cm,0*cm],[3.0*cm,3.0*cm],[0*cm,3.0*cm]],paths=[[0,1,2,3]]);
}
}

module alextrusion(length) {
linear_extrude(height = length, center = true, convexity = 10, twist = 0)
alprofile();
}

But the error goes away if I comment out selected bits of my model (ie it appears to be related to the complexity of my model as a whole, not a particular section).

If there's some better way I can instrument it to display what's going wrong in that data structure I'm happy to do that (I don't really understand all the C++ structures).