Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Bug of the Month - October 2011

Matt Schuetze1 Absent Member.
Absent Member.
0 0 974

October marked the passing of Dennis Ritchie, a titan in the software and computer science world. His technical contributions in C and UNIX are legendary, and without him and those that followed in making C and C++ bedrock standards in application and systems development, BoundsChecker and other DevPartner tools simply would no way resemble their shape today, if indeed they would exist at all.

The irony is that the ghost of Mr. Ritchie haunted our lab, right in the midst of our prepping for annual Halloween celebrations. In fact, the item that spooked us came in through the Forum under this topic:

http://community.microfocus.com/Forums/9_DevPartner/2686_BoundsChecker_instrumentation_overwriting_function_parameters_with_uninitialized_values

Two days after Mr. Ritchie’s passing, using this thread Rick and IJPrest started a lively discussion in the Forum, wherein Rick determined indeed BoundsChecker had overlooked classic K&R style external function declarations, and so in fact did the VC++ PDB generator in the same way.

Rick is much better at raw code than me, so overnight he dreamed up this simple five line change:

       // Fix up any K&R style parameters we might not have detected.
       CVariableInfo *pLocalVar = pFunctionInfo->GetFirstVariable() ;
       while ( pLocalVar ) {
              if ( pLocalVar->StartOffset() >= cbBelowReturn )
                     pLocalVar->SetState ( CVariableInfo::eVarFormal ) ;
              pLocalVar = (CVariableInfo*) pLocalVar->ListGetNext ( ) ;
       } /* endwhile */

whereas I needed to reach back into my dank, graying, musty copy of K&R’s The C Programming Language that I keep on the floor under my desk for a refresher on what he and IJPrest were even talking about. Way towards the back in Appendix A., Section 10.1, Page 204 there indeed resides a topic on External Function Definitions. Given that my edition is copyrighted 1978, it shouldn’t be a shocker that there are no mentions of PDBs anywhere in this chapter.  Mr. Ritchie was a titan, but not so much on VC++ when writing this book in the late 1970s.

For that we need to turn to John Robbins, DevPartner alumnus and another industry titan, for more on PDBs: http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/05/11/pdb-files-what-every-developer-must-know.aspx. To Rick’s credit, he gets the fun task of figuring out when the PDBs are not telling the truth. Ghostly--and ghastly--levels of debugging indeed!

Godspeed Mr. Ritchie. A fix to your function declarations will ship in DevPartner Studio 10.5.3, which we dedicate to your lasting memory.

 

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.