CP4349 - Debugging Autodesk® Product Plug-ins. Two bytes meet. The first byte asks, “Are you ill?” The second byte replies, “No, just feeling a bit off .”. Kevin Vandecar Principal Developer Consulting Engineer – M&E Sparks Autodesk Developer Network. bio: Kevin Vandecar. - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Most “plug-ins”, “add-ins”, “apps”, etc. for Autodesk applications are DLLs Use mainly the C++ language to demonstrate debugging techniques in AutoCAD and
3ds Max Touch on managed debugging, using Revit as an example. Take a look at how CER mini-dump may be helpful for you
Look at the Visual Studio debugging tools Nearly all of the techniques are the same between native (C++) and managed (C#,
Wikipedia: Debugging is a methodical process of finding and reducing the number of bugs,
or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another.
For the “coder” much easier to understand at the implementation time Code-time testing is important! aka Unit Testing document your code!
For the “inspector/debugger” much harder You may be debugging other people’s code Or it may be code from your distant past This makes it much more difficult
First verify problem and reproduce it… No use setting break points, stepping through code, etc. without
knowing how to repro it. helps to document steps smallest repro steps/sample is ideal
When communicating API problems beyond your code to Autodesk, it is ideal to have the smallest repro sample code possible.
Swigert: 'Okay, Houston, we've had a problem here.' Houston: 'This is Houston. Say again please.' Lovell: 'Houston, we've had a problem. We've had a main B bus under-volt.'
Simplest form: Use Output statements Debugger output (OutputDebugString) Application output (“printf”, “cout”, and other routines) Sometimes apps have their own output means
Caveat for x64 vs. win32 (x86) projects Edit and Continue STILL not supported in VS2010 for x64 targets
x64 Mixed-mode debugging also not available for .NET Framework 3.5 and prior. Only works in .NET Framework 4. The good news is that .NET Framework 4 is now supported by many Autodesk apps, but a C++ project has to be modified manually. See: http://adn.autodesk.com/adn/servlet/devnote?siteID=4814862&id=16002138&linkID=4900509
Can build x86 targets and run under WOW, but some Autodesk apps are not supported as x86 on x64 Operating Systems (NOTE: 3ds Max is!)
Using the Visual Studio debugger – tips/tricks/demo
Use the breakpoint window Helps you to see what break points and where You can also directly set breakpoints there Use labels with your break points
Disable, rather than delete breakpoints Call Stack break point Use Step into specific Run to Cursor (temp break point) Drag the execution pointer to another line Change values in the watch window Use the find tool in other windows (ie. it can help in output) Turn on/off output that may or may not be interesting for you debugging session. demo
Symbols also generated in “release” mode. Optimization can cause “tricky” debugging This is how it is possible to debug production software, using pdbs. AutoCAD and 3ds Max now have public symbol servers!
When using symbols, versions MUST MATCH internally a GUID is present and must match Symbol servers simplify this task, but there are more “unknowns” when it doesn’t work
Likely we have not uploaded proper symbols, so let us know Consider setting up a Symbol server internally for your own public builds