in0
October 24, 2021, 6:29am
5
I'm glad to hear you are having some success with the debugger now. Thanks for taking the time to post an update.
I'll share with you a known bug with the Arduino IDE 2.x debugger which has resulted in some unexpected behavior for me:
opened 08:54AM - 06 Oct 21 UTC
closed 10:56AM - 27 Oct 21 UTC
conclusion: resolved
topic: code
type: imperfection
topic: debugger
criticality: medium
Clicking the **Stop** button in the debugger does not stop the debugger and an e… rror is produced.
### Steps to reproduce
1. Select your Arduino board in the board selection dropdown. Make sure the correct port is selected.
2. Create a new Sketch with this content:
```cpp
#define LED_PIN LED_BUILTIN
#define TIME_ON 500
#define TIME_OFF 500
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
Serial.begin(9600);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
delay(3000);
}
// the loop function runs over and over again forever
void loop() {
unsigned long msNow = millis();
digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(TIME_ON); // wait for a second
digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW
delay(TIME_OFF); // wait for a second
unsigned long exitTime = millis();
Serial.println(exitTime);
}
```
3. Enable _Optimize for Debugging_ in the **Sketch** menu
4. Upload the Sketch (even if the sketch is already uploaded do this again to ensure you have debug symbols in the _.elf_ file
5. Click the “Start Debugging” button on the toolbar at the top:

6. The debug server will take a moment to start. Then, these buttons will appear

7. Press the **Stop** button to exit execution.
8. The **Stop** button is still enabled. The debugger icon on the sidebar still has a “1” indicator. There is an error in the Output pane:
```kill failed for -3028Error: kill ESRCH```
(the `-3028` part will likely vary)
### Expected behavior
Clicking the **Stop** button in the debugger stops the debug session.
### Additional information
The **Stop** button works fine when using 2.0.0-beta.11.
It occurs both when following the instructions for “Arduino Zero”, “CMSIS-DAP compliant debug probe”, or link.
This problem is likely caused by this issue on eclipse-theia -> https://github.com/eclipse-theia/theia/issues/10164
and I believe it was introduced with this commit: https://github.com/eclipse-theia/theia/commit/5d52762969c9833055f7222960dd5fad14557891
### Environment
Version: 2.0.0-beta.11-snapshot.82b1853
Date: 2021-09-02T12:57:26.115Z
CLI Version: 0.18.3 alpha \[d710b642]
OS: Windows 10
This is specific to Arduino IDE 2.0.0-beta.12, so if you do encounter problems related to not being able to stop the debugger, you can roll back to Arduino IDE 2.0.0-beta.11, which is available for download here:
(downloads for each host operating system under the "Assets" section of that page)
But if Arduino IDE 2.0.0-beta.12 is working well for you then definitely stick with that version because there have been some nice advancements since 2.0.0-beta.11.