[openib-general] OpenSM Debug

Fab Tillier ftillier at silverstorm.com
Sat Nov 19 10:50:51 PST 2005


> From: Sean Hefty [mailto:sean.hefty at intel.com]
> Sent: Saturday, November 19, 2005 8:38 AM
> 
> >The following code snippet is in opensm/main.c:
> >
> >  if ( osm_is_debug() != cl_is_debug() )
> >  {
> >    fprintf(stderr, "ERROR: OpenSM and Complib were compiled using
> > different modes\n");
> >    fprintf(stderr, "ERROR: OpenSM debug:%d Complib debug:%d \n",
> >osm_is_debug(), cl_is_debug() );
> >    exit(1);
> >  }
> >
> >Is there a reason debug can't be turned on independently in OpenSM and
> >the component library ?
> 
> There used to be a restriction that you couldn't mix a free/release
> version of the component library with a debug version of a client,
> and vice-versa.  The debug version of complib added fields to
> structures that were not needed in the release version, resulting
> in different structure sizes between free and debug versions.
> This is probably still the case.

That's correct - structure definitions change between the debug and release
builds of complib.  The code above is there because in Linux, the library
created by complib has the same name in debug and release builds, so it is
possible to have a mismatch between the type of build for opensm and complib.
In Windows, I solved this by adding a debug-only suffix to the library name
(complibd vs. complib) so that the risk of linkage errors is eliminated.  I have
suggested in the past that the Linux complib adopt a similar naming scheme and
that doing runtime checks for linkage errors was indicative of a poor design.

This has been the basis for me pushing back on adding the cl_is_debug function
to the Windows version of complib.

- Fab




More information about the general mailing list