Hi MicroStation Programmers,
I am supporting a Pure MDL application (compiled with mcomp, etc) in V8i. How can I debug it? What tool can I use?
I tried to find a way to debug in the SDK programmer's guide, but didn't find too much beside the instruction of adding the "DEBUG" keyword in "MDL LOAD" key-in command.
Is there other tool or instruction that can help me?
Thank you!
Sui Huang said:I tried to find a way to debug in the SDK programmer's guide
Search help for keyword debug. Here's the first of several sections about debugging in the MDL Programmer's Guide.
Debugging The first time a particular MDL application is to be debugged, its name must be specified. To load an application and activate the MDL debugger from MicroStation, key in the following, where is the application name:
MDL LOAD DEBUG APPLICATION
To debug a previously loaded application, key in the following:
MDL DEBUG APPLICATION
The application name is an optional part of the command, and need only be specified if the MDL application is unloaded, or another MDL application has been loaded since you last debugged the first application. If the application is loaded with the MDL LOAD command without the DEBUG modifier, MDL loads the symbol table before activating the debugger. Otherwise, it only activates the debugger. MDL DEBUG operates as an immediate command. It does not disrupt the state of the currently active MicroStation command.
It is possible to have debugging information loaded for more than 1 application at a time, but the debugger can only be in command mode for 1 application at a time. For example, it is possible to load 3 MDL applications with debugging, but when the debugger prompts for a command it is only possible to set breakpoints and display values for the same application.
The mdlSystem_enterDebug function activates the debugger from an MDL application. If the application does not have the debugging information loaded, MDL loads the symbol table.
This answers your question about debugging MDL in MicroStation V8i and earlier. With MicroStation CONNECT, we can use the Viz Studio debugger for .NET and C++ development.
Regards, Jon Summers LA Solutions
Hi Jon,
Then seems typing DEBUG in key-in is the only way, I will try it. Thank you!
Sui Huang said:Then seems typing DEBUG in key-in is the only way
If your question is: "Is there an interactive MDL debugger?" then the answer is no. MDL was invented around 1990, and reflects the technology of that era. These days we can develop using VBA, .NET or C++ and there are interactive debuggers available for those languages.
Jon Summers said:This answers your question about debugging MDL in MicroStation V8i and earlier. With MicroStation CONNECT, we can use the Viz Studio debugger for .NET and C++ development.
This is not precise formulation in my opinion. It's possible to use Visual Studio debugger in V8i without any issue as well! The only unsupported option is the discussed MDL pseudocode.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Hi Sui,
Sui Huang said:Is there other tool or instruction that can help me?
as Jon answered already, MDL pseudocode debugging is pretty limited and text-only.
Because MDL in V8i is treated as obsolete, in my opinion there is a question whether it makes sense to migrate pseudocode to native C, where it's possible to use Visual Studio to debug the code. It's hard to guess without knowing context and the application lifecycle, but maybe the benefit will be bigger than investment to the code migration.
Hi Jan,
When you mention "MDL pseudocode", are you referring to the code in the .mc file, which is human-readable C-like code? or the .ma file which is already compiled?
If you are referring to the later, does it mean I can interactively debug the .mc code with Visual Studio?
Sui
Sui Huang said:When you mention "MDL pseudocode"
I use "pseudocode" for compiled version (.mo, linked to .ma), as .mc is usually referred as MDL source coude.
The problem with "MDL" name itself is that because of long history and technological changes, MDL today means "anything related to MicroStation development", whereas in history it was C-like language, later extended by MDL API, which has become available also as native code... ;-)
Sui Huang said:If you are referring to the later, does it mean I can interactively debug the .mc code with Visual Studio?
Not quite. To use Visual Studio for debuggin, the application has to be native C/C++ code, which requires to migrate .mc to .cpp and to compile it using Microsoft VisualC compiler (Visual Studio 2005 Professional in the case of V8i).
Because the migration does not require to rewrite the whole application (but when the code is dirty, it can be a huge amount of work), in my opinion the advantage of debugging (and also much stricter check of the code by compiler), benefits are bigger than investment into migration.
I understand the situation now. Thank you for your explanation.