This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253450 - Unable to debug the Thread.Run() method
Summary: Unable to debug the Thread.Run() method
Status: RESOLVED INCOMPLETE
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P1 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-14 04:52 UTC by anilkumar763
Modified: 2015-07-14 09:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description anilkumar763 2015-07-14 04:52:01 UTC
I am using NetBeans IDE (8.0.2) J2EE Version.


Can't hit run() method of thread while debugging.

It is showing the message in status bar as


"Breakpoint hit at line15 by JavaApplicaion7 by Thread.MailThread"
Comment 1 Martin Entlicher 2015-07-14 07:39:13 UTC
Can you please explain in more details?
There was a message "Breakpoint hit at line15..." thus did the application actually stop there? Do you see the appropriate stack trace in the Debugging view?
Can you please check the breakpoint's properties, is the Suspend action set to suspend the breakpoint thread?
Can you please post a full content of Output -> Debugger Console?
Comment 2 Martin Entlicher 2015-07-14 07:40:36 UTC
Or, is it possible for you to attach a sample application here with exact steps to reproduce?
Comment 3 anilkumar763 2015-07-14 07:42:49 UTC
package javaapplication7;

/**
 *
 * @author sys6002
 */
public class JavaApplication7 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
         Mailthread1 mt1 = new Mailthread1();
  Thread pt = new Thread(mt1);
  pt.setName("Mailthread");
  pt.start();
  
    }
    
}


package javaapplication7;

/**
 *
 * @author sys6002
 */
class Mailthread1 implements Runnable {

    public void run() {
        
        System.out.println("Hi");
        System.out.println("Hi");
    }

}
Comment 4 anilkumar763 2015-07-14 07:44:54 UTC
I put breakpoints at the lines 
   
        System.out.println("Hi");
        System.out.println("Hi");

and from My  main() method, I'm stepping into(F7)

  pt.start();
.

Then that message is shown. But not actually moving to the breakpoints
Comment 5 Martin Entlicher 2015-07-14 07:58:51 UTC
It works for me.
The breakpoint is hit when I add it on line with System.out.println("Hi");
You can not step into from pt.start(); to the run() method, because a new thread is started to execute the run() method. Thus if you add a breakpoint into run() method, it's hit by a different thread.
Open Window -> Debugging -> Debugging and you'll see the threads there.
Comment 6 anilkumar763 2015-07-14 09:17:02 UTC
Now it is working by following your steps.

But In my application, One class itself implements Runnable.
And i cannot debug the run method of it.



It will be like

main()
{
   initiliaize()
}
========================

 public void initialize() {
        try {
            if (bound) {
                try {
                    Thread thredeven = new Thread(this);
                    thredeven.setName("Mailthread");
                    thredeven.start();
                  
                } catch (Exception eintialize) {
                  
                }
            }
====================
public void run()
{
              System.out.println("Cannot reach this line while debugging");

}
Comment 7 anilkumar763 2015-07-14 09:18:18 UTC
I cant find the thread name in Threads window, and 
after
 thredeven.start()

call, cursor is moving to the end of that block.