question

Axel Kohonen avatar image
0 Likes"
Axel Kohonen asked Jordan Johnson answered

Would it be possible to get the global macro values to show in the debugger instead of the values?

Hi,

Development proposal: Would it be possible to see macro defitions rather than their values in the debugger? Or give the user the option to choose which one to see. I often have macros like the below

#define MSG_RESUME_UTILIZE_STATE 5

And it would be more helpful to see the macro definition rather than the number 5 in the debugger.

Thank you!

Kind regards,

Axel

FlexSim 16.0.1
debugdebuggermacro
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Jordan Johnson avatar image
5 Likes"
Jordan Johnson answered

This is a question that has come up a couple times. I agree that would be nice in some cases, but it would be extremely difficult. For example, here is some code you can run in your script window:

#define MSG_RESUME_UTILIZE_STATE 5
#define DO_MATH 11 / 2
int w = MSG_RESUME_UTILIZE_STATE;
int x = DO_MATH;
int y = x;
int z = w;
return x;

In this case, w, x, y, and z all have the value 5. It is more helpful for the debugger to show that the value of x is 5, and not 5.5. If the debugger showed DO_MATH, the user might never realize that they had lost the decimal portion of the value, which is one of the purposes of the debugger.

Additionally, we would need to make a way for the debugger to differentiate between all of the 5's it encounters. There are more than 60 macros in FlexSim that produce the value 5, and not all 5's in FlexScript are derived from a macro. So when the debugger sees a 5, it would need to somehow know that this particular 5 came from a macro in the first place, and which macro it came from. That information is currently discarded during the build process. Keeping it would mean a monumental increase in memory use, and a decrease in FlexScript performance.

For these reasons, it is unlikely that this feature will come out any time soon. Even in C++, that is the cost of using macros; they are easy to use, and they can simplify your code, but they are difficult to debug.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.