-4

Step Over, Step In, and Step Out.
I want a better understanding of what to expect when pressing these buttons in a debugger.

There are a lot of language & tool specific debugger entries, but I couldn't find a generic explanation of the feature.

BJ Myers
  • 6,617
  • 6
  • 34
  • 50
redlamp
  • 101
  • 6
  • First hit on Google: [Introduction to Debugger Terms and Concepts](http://zach.in.tu-clausthal.de/teaching/info_literatur/python/debugging/debugger_introduction.html#bct_sec_12) – 001 Jun 06 '14 at 17:39
  • @marcodejongh Like I mention, I didn't want tool specific answer. A lot of top results for coding searches are from SO, so it seems like it'd be nice to have a question recorded about the generic concept of making steps in a debugger. – redlamp Jun 06 '14 at 17:43
  • Could you explain what specifically you need to know about "Step In", or you are just trying to create a community wiki question? – Alexandre Santos Jun 06 '14 at 17:50
  • @AlexandreSantos, I'm new here so I'm not quite sure what a community wiki question is. My understanding of the concept is loose at best, so I'd rather see someone else's answer. – redlamp Jun 06 '14 at 17:55
  • *Oh the irony.* I ask an intentionally **generic** question and get answers framed on **specific tools**, the question I'm marked as duplicating is asking a **tool specific** question and getting **generic** answers. That and it's first comment calls it out as a duplicate of a question that's a year older. I feel this question is importantly a core level and doesn't need to be sullied by [firebug] or [javascript] tags when it applies to broader concepts. If you're not willing to see my reason for asking this question, at least have the decency to let me earn the *peer pressure* badge. – redlamp Jun 07 '14 at 07:47

2 Answers2

0

Simply put, this is how you advance ("step") through your code via the debugger, one line at a time. Here's an example of using Visual Studio debugger.

Suppose you have the following code:

public static void Main(string[] args)
{
  int x = 4;
  M(x);
}

private static void M(int x)
{
  Console.WriteLine(x);
}

Suppose you put a breakpoint on the M(x) line. When the debugger stops ("breaks"), you now have 3 options:

1. Step Over (F10)

If you press F10, you will step over the line M(x). The debugger will execute this method, but you will not go into it. On the console output, you will see 4.

2. Step Into (F11)

If you press F11, the debugger will take you inside the M() method, allowing you to single-step (with F10 or F11) inside the M() method. If you keep pressing F11, you will enter additional methods (provided you have their source code available)

3. Step Out (Shift-F11)

Instead of single-stepping one line at a time, you can press Shift-F11 to step out of the current method, and return to the calling method. In this case, if you press Shift-F11 while inside the M() method, you will be taken back to the calling Main() method.

I hope this makes it clearer.

P.S. This is not Visual Studio specific, but a general concept of debugging. With the debugger, you always single-step over instructions, be that lines of code or assembly instructions. Step over/in/out are concepts you will find in every debugger, and they all mean the same thing.

There are additional things some debuggers allow you to do, such as Run to selected line. Here's more info about Visual Studio debugging capabilities: http://msdn.microsoft.com/en-us/library/y740d9d3.aspx

Igal Tabachnik
  • 31,174
  • 15
  • 92
  • 157
  • The info is there, but I'd rather see it without the VS specific hotkeys. I have to use the debugger in Flash CS5 with ActionScript 2, it's so irrelevant now that I don't want to include those details in the question, and seeing niceties of other tools is just salt in the wound. – redlamp Jun 06 '14 at 17:59
  • Read the last part of my post. I gave an example using Visual Studio, but those concepts are universal, be that Flash, Pascal or Assembler. If you want to know how to BUILD a debugger that can do those things, that's a whoooole different topic. – Igal Tabachnik Jun 06 '14 at 18:00
  • I wanted a simple generic answer, the VS addition is static in an otherwise helpful answer. I'd up vote it if I had the rep her, but it's not the generic answer I'm looking for. – redlamp Jun 07 '14 at 07:49
0

This will be IDE specific, so your question is targeted as being too broad.

But in general, this is what these terms mean.

When debugging code, if the current line is the call to a function, let's call it M(y).

If you Step In, then the debugger will start stepping into the function M(y).

If you chose Step Over, then the function M(y) will be executed and the debugger will stop at the next line after the call of the function M(y).

Step Out only works if you are already inside of M(y). Let's say you are in the middle of M(y) and you realize the bug is not there, and you'd like to continue on the first line of code after the call to M(y). That's when you pick Step Out.

Again, this will vary from IDE to IDE, but on my experience (more than 11 IDEs) this is the standard behaviour.

Alexandre Santos
  • 8,170
  • 10
  • 42
  • 64