1

I have a gear looking icon next to one lines of code in NetBeans saying

program counter of threads with breakpoints.

What does it mean?

Keiwan
  • 8,031
  • 5
  • 36
  • 49
sixtytrees
  • 1,156
  • 1
  • 10
  • 25

2 Answers2

2

In case of Java it tells three things:
(1) This is a multithreaded application (several threads are executed in parallel).
(2) A breakpoint is set here (program will stop execution if you run it in debugger mode.
(3) Several different threads are running this line (chances are - calling this class) and each of them will stop here at some point.

So, don't be surprised if this stop is hit several times. Right click on the icon during debugging and choose "set thread to" in order to choose the active thread. See https://netbeans.org/kb/docs/java/debug-multithreaded.html for a sample multithreaded code to experiment with a sample multithreaded app.

tryJava
  • 84
  • 3
1

If you understand the three different terms, it's pretty obvious:

  1. Program counter: The program counter (PC) holds the address of the next instruction to be executed

  2. Thread: This explains a thread much better than I could. In short, a thread has a program counter.

  3. Breakpoint: A breakpoint is a point in a program where execution will pause if the PC reaches it. So if the program counter hits line 30 and you have a break point on line 30, it will pause execution.

Community
  • 1
  • 1
Christopher Schneider
  • 3,745
  • 2
  • 24
  • 38