Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-dev] Why does DebugPlugin need eventlisteners in order to schedule runnables?

Thank you Jonah!

I have submitted a bug here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=573696

Best regards,
Anton

Den 2021-05-20 kl. 21:44, skrev Jonah Graham:
Hi Anton,

That code was written a long time ago (2004) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=30779 - so it may be difficult to get any first hand knowledge of the answer. 

When the code was first written that job (EventDispatchJob) would have nothing to do if there were no listeners as the job was only dispatching events to listeners.

Then in 2007 - see comment in https://bugs.eclipse.org/bugs/show_bug.cgi?id=178902#c2 - the same job was used to handle the event queue and asyncExec queue.

My best guess is that no one noticed until now as in (almost!) all debug sessions there will be at least one listener.

I recommend you submit a bug & gerrit that simply removes the optimization in shouldSchedule. And as a workaround in the meantime, you could add a dummy listener (DebugPlugin.addDebugEventListener) in your TCF session.

I hope that helps and let us know if the above solves your problem.
Jonah

~~~
Jonah Graham
Kichwa Coders
www.kichwacoders.com


On Thu, 20 May 2021 at 14:40, Anton Bäckström <anton.backstrom@xxxxxxxxxxx> wrote:

Hi,

I have a question about  the scheduling mechanism in org.eclipse.debug.core.DebugPlugin.
This code in particular:
     
public boolean shouldSchedule() {
            return !(isShuttingDown() || fEventListeners.isEmpty());
        }

Why does the DebugPlugin need to have EventListeners registered in order to schedule runnables?


Our use case is a debugger based on TCF. It uses the RunToLineAdaper from CDT, with an adapter from TCF, in order to perform a Run To Line action.

In CDT, this code will, through a few steps, end up calling the shouldSchedule() above:

private void runInBackground(Runnable r) {
        DebugPlugin.getDefault().asyncExec(r);
    }


There are no EventListeners related to the DebugPlugin regarding Run To Line in TCF, which makes me confused.

Run To Line just so happens to work if, and only if, I have the Memory View open, since it has EventListeners registered on the DebugPlugin. But those listeners are unrelated to Run To Line.

Perhaps I need to reach out to the TCF or CDT mailing list, but for starters I would be happy if someone could explain why the shouldSchedule() function looks like it does.

Best regards,

--
Anton Bäckström
Cobham Gaisler

Cobham Gaisler AB, Kungsgatan 12, SE-411 19, GÖTEBORG, Sweden.
+46 (0) 31 775 8650, www.cobhamaes.com/gaisler

Please consider the environment before printing this email

      
_______________________________________________
platform-dev mailing list
platform-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev

_______________________________________________
platform-dev mailing list
platform-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev
--
Anton Bäckström
Cobham Gaisler

Cobham Gaisler AB, Kungsgatan 12, SE-411 19, GÖTEBORG, Sweden.
+46 (0) 31 775 8650, www.cobhamaes.com/gaisler

Please consider the environment before printing this email

      

Back to the top