Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eclipse Lock up when debugging with Jlink #619

Open
ilg-ul opened this issue Oct 5, 2024 Discussed in #618 · 4 comments
Open

Eclipse Lock up when debugging with Jlink #619

ilg-ul opened this issue Oct 5, 2024 Discussed in #618 · 4 comments
Assignees
Labels

Comments

@ilg-ul
Copy link
Contributor

ilg-ul commented Oct 5, 2024

Discussed in #618

Originally posted by trampas October 4, 2024
I have been having long term issue where Eclipse locks up when debugging with Jlink. Read here for more detail: eclipse-cdt/cdt#906 (comment)

@ilg-ul ilg-ul added the bug label Oct 5, 2024
@ilg-ul ilg-ul self-assigned this Oct 5, 2024
@ilg-ul
Copy link
Contributor Author

ilg-ul commented Oct 5, 2024

There are quite a lot of exceptions in the logs, this is probably a bug.

I'll try to investigate, but it might take some time.

@SnowyTulip
Copy link

Hello, Liviu Ionescu,

I am very interested in this issue and have been working to reproduce it.

Here is my setup:

  • SEGGER J-Link GDB Server V7.96g
  • Windows 11
  • STM32F407 development board
  • J-Link V9 (SWD interface)
  • Debug version of Eclipse Embed-CDT built from the source code in this repository

The steps to reproduce the issue are as follows:

  1. Connect the J-Link to the STM32 development board.
  2. Create a new LED template project using Embed-CDT.
  3. Set up a new J-Link debugging configuration and start debugging.
  4. After hitting a breakpoint, unplug the J-Link (please note that this is not the same as disconnecting the power supply to the development board. Based on my testing, removing the power supply does not reproduce the issue).

Result
The IDE suddenly becomes extremely slow and eventually freezes without reporting any errors.
eclipse_error.log

The debug log I captured is almost identical to the one shared here. Strangely, even though the freeze in Eclipse is caused by J-Link, there are almost no J-Link-related exceptions in the log. Instead, there are many exceptions related to SWT handles and the UI event loop.

Solution

Since the issue seems related to the UI events, I noticed that there appears to be an anomaly in J-Link's semi-hosting mode, where there are many unrecognized characters being printed. The issue seems to stem from here! The semi-hosting thread continuously printing data likely consumes a large number of SWT handles. As a result, the UI is not actually frozen; instead, the excessive printing in semi-hosting mode consumes so many resources that Eclipse runs very slowly.

To verify my hypothesis, I modified the input/output stream part of the SemihostingProcess in the code. I added a 1-second delay each time it printed to the console. After making this change, when I repeated the steps above, the IDE no longer froze! (In fact, I also tried disabling the console output, and the result was the same.)
error_print
code

@SnowyTulip
Copy link

I am interested in the Eclipse Embed IDE and would love to fix this bug myself, though I may need some guidance along the way. This would also be my first time submitting code to an open-source project. Unfortunately, I am currently in the middle of my university's exam week, so the next couple of weeks will be quite busy. However, I hope to be able to work on it once things settle down.

If you would be open to this, I would be truly grateful for the opportunity.

Thank you for your time and consideration!

@ilg-ul
Copy link
Contributor Author

ilg-ul commented Dec 8, 2024

Frankly, the Eclipse Embedded GDB code is very old and I have difficulties to follow the details. We'll need someone from the Eclipse CDT project to help us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants