Preventing Visual Studio 2017 debugger from confusing static variables with equal name

Viewed 76

I have observed the following phenonem in the VS 2017 debugger:
if there are two static variables of the same name and type in different files, it confuses the two.

pseudo code of variable declarations

file A:
static char msg[2048];

file B:
static char msg[64];

if I debug file B the debugger shows the contents of file A's msg.

My guess would be that the case of equally named static variables was not foreseen when the debugger was developed and which variable it shows depends on the compilation order.

Question:
how can the VS 2017 debugger be "forced" to access the static variables of the currently debugged file without changing the code that is being debugged?

The trivial advice of renaming the variables is not an option for me and IMHO also not in the spirit of static variables.

1 Answers
Related