Sunday, October 01, 2006

Single stepping

With a stack language, single stepping has a certain intuitive appeal, and there is no ambiguity when it comes to what will happen next. Single stepping through C, on the other hand, is an exercise in frustration. Suppose you have a piece of code like:
foo(bar(),baz())
If I want to step over the calls to bar() and baz(), but step into foo(), it appears that I'm out of luck, at least in gdb. You can set a breakpoint on foo(), or just step into the nested function calls and then step out, but it wastes time and breaks concentration.
I like having a programmer-visible stack. It seems to shorten the 'round trip time' between my brain and the computer.

2 comments:

dfan said...

It's even worse in C++, where things like [] and new are often overloaded, so even seemingly innocent code is a minefield of implicit function calls.

One nice thing about the current version of Microsoft Visual Studio (and I'm not a Visual Studio fan) is that you can right-click on a line of code and choose which of the function calls on that line to step into.

Anonymous said...

s/With a stack language/With a stack language you design yourself/g

Its just as straightforward with assembly in this case...