Bug 571633 - [debug] Track object instantiation location
Summary: [debug] Track object instantiation location
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-02 19:23 EST by Jeremy Krieg CLA
Modified: 2021-03-05 04:55 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Krieg CLA 2021-03-02 19:23:13 EST
I'm trying to debug some asynchronous code in an Eclipse plugin, where a Job is created on one thread and ultimately executed in another.

I have currently the debugger stopped at a line of code in an executing Job, which is deadlocked waiting for another blocking job. In order to understand how it ended up in this state, I would like to understand the flow of how those Jobs were created. However, because they were created and executed asynchronously, the logical flow of how they were created is not in the stack trace of any one thread - it has been lost. It is very difficult to step back through the history of the logical flow.

I think it would be an extremely nifty feature if the JDT debugger could keep track of object instantiations, and kept a reference to the stack trace information for the thread for the line of code that instantiated them. This information could be stored and then displayed when you introspect the object's properties.

It is possible that such a feature would significantly slow down the execution of code being debugged. This could be mitigated by allowing you to selectively enable it for certain classes rather than for all classes (off by default).

Forgive me if such a feature or plugin already exists. I did try to do a search before raising this feature request.
Comment 1 Sarika Sinha CLA 2021-03-05 04:55:08 EST
Even if they are asynchronous threads, you can add watch points for the objects and you can specify if it stops on access/modify of the object. And when it stops we can access the stacktrace.

Also a profiler like Yourkit does track threads and their stacktraces.


Adding that inbuilt with Eclipse is a lot of work and if some one is ready to contribute, we can look into it.