1

Why debugger has to stop execution of code to display variable values ?

Obviously this can be done in explicit way e.g. label.text = var.tostring().

I can do this by grabbing variable address and than attaching memory scanner like CheatEngine to my process to view variable value during execution.

As it seems VS debugger as robust as it is does not provide me with this option as memory windows are blocked during execution.

It's quite possible I just don't understand some debugging paradigm.

5
  • in which cases do you need this kind functionality? Commented Feb 20, 2014 at 16:30
  • What version are you using? Is it a Express edition? Commented Feb 20, 2014 at 16:31
  • VS 2013 Express for Desktop Commented Feb 21, 2014 at 8:40
  • Whenever I need to watch variable during execution and rate of it's change does not call for breakpoints or breakpoints would happen are just distruptive to workflow. I guess most people do it by having explicit 'developer frame' but building it n-th time got me thinking. Commented Feb 21, 2014 at 9:44
  • Slowing down time is the primary requirement to debug. There is no conceivable way that a debugger can keep up with the rate at which a processor can alter variable values (nanoseconds) and the garbage collector moving them around (milliseconds). Your eyes are similarly constrained. You can write a "When Hit" expression to display a message to the Output window. Commented Mar 22, 2014 at 11:19

1 Answer 1

1

The VS debugger is really a thin layer across the CLR debugger (ICorDebug) and it requires that execution of a given thread be stopped in order to inspect values like locals, stack frames, make method calls, etc ...

Sure VS could allow for memory scanning at any time if it chose to because reading memory doesn't really require any sort of infrastructure. But it's not likely to be terribly useful to users because they don't really have a way to map the values they want to inspect (locals and this) to a given memory address. Even if they did this information is only relevant until the next GC call or until the current stack frame is popped. It would be a rather chaotic experience

Sign up to request clarification or add additional context in comments.

1 Comment

I see how this could cause chaos, when used wrong way especially in large enviroment where Frequent GC takes place for proper memory use. Indeed GC is a doom to memory scan method. That's why I thought of debugger in the first place so it could keep track of GC events, memory shifts etc. Thanks for answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.