Skip to content

Alpha 0.1.1 Debugging: breakpoints on local libraries are not considered #120

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

Closed
rei-vilo opened this issue Feb 28, 2020 · 17 comments
Closed
Labels
conclusion: resolved Issue was resolved criticality: high Of high impact topic: debugger Related to the integrated debugger type: imperfection Perceived defect in any part of project

Comments

@rei-vilo
Copy link

Describe the bug

Breakpoints defined on local libraries are not considered.

To Reproduce

Very basic example with 3 files: Blink.ino, LocalLibrary.h, LocalLibrary.cpp
Two breakpoints defined: one in Blink.ino, another in LocalLibrary.cpp

Expected behavior

Breakpoints defined on local library LocalLibrary.cpp should be considered.

Actually, all the files are duplicated under a temporary folder, /private/var/folders/wn/n7qqb8ss0k3bvpqwfcdwp_7r0000gn/T/arduino-sketch-7CD787D3756B222A4A3572C34ED19F79/sketch/

The breakpoint on Blink.ino is kept, but not the breakpoint on LocalLibrary.cpp.

Workaround

Launch the debugging session.
Define the breakpoint on the local library again.

Screenshots

  • Initial project folder during editing

Capture 2020-02-28 à 15 02 53

  • Initial project folder during debugging

Capture 2020-02-28 à 14 51 28

  • Copy to temporary folder during debugging

Capture 2020-02-28 à 14 50 21

Desktop (please complete the following information):

  • macOS 10.15
  • Arduino Pro IDE 0.0.5
  • SAMD core 1.8.5

Code

  • Blink.ino
#include "LocalLibrary.h"
uint8_t myLED;

void setup()
{
    Serial.begin(9600);
    delay(500);
    Serial.println(__FILE__);

    myLED = LED_BUILTIN;

    pinMode(myLED, OUTPUT);
}

void loop()
{
    Serial.println(millis());

    blinkLED(myLED, 3, 333);
    delay(1000);
}
  • LocalLibrary.h
#include "Arduino.h"

#ifndef blink_LocalLibrary_h
#define blink_LocalLibrary_h

///
/// @brief      Blink a LED
/// @details	LED attached to pin is turned on then off
/// @note       Total cycle duration = ms
/// @param      pin pin to which the LED is attached
/// @param      times number of times
/// @param      ms cycle duration in ms
/// @param		level level for HIGH, default=true=positive logic, false=negative logic
///
void blinkLED(uint8_t pin, uint8_t times, uint16_t ms, bool level = true);
// !!! Help: https://bit.ly/2Bwmyk6

#endif // blink_LocalLibrary_h
  • LocalLibrary.cpp
#include "LocalLibrary.h"

// Code
void blinkLED(uint8_t pin, uint8_t times, uint16_t ms, bool level)
{
    for (uint8_t i = 0; i < times; i++)
    {
        digitalWrite(pin, level ? HIGH : LOW);
        delay(ms >> 1);
        digitalWrite(pin, level ? LOW : HIGH);
        delay(ms >> 1);
    }
}
@spoenemann
Copy link

I think this must be fixed in the CLI. I created an issue here:
arduino/arduino-cli#601

@rei-vilo
Copy link
Author

rei-vilo commented Mar 4, 2020

Thank you.

Waiting for Alpha 0.06 now!

@rei-vilo rei-vilo changed the title Alpha 5 Debugging: breakpoints on local libraries are not considered Alpha 0.1.1 Debugging: breakpoints on local libraries are not considered Sep 2, 2020
@rei-vilo
Copy link
Author

rei-vilo commented Sep 2, 2020

Unfortunately, same issue with Alpha 0.1.1.

Capture 2020-09-02 à 16 56 32

The breakpoint defined on line 27 of LocalLibrary.cpp labelled LocalLibrary.cpp .../Users/......

Capture 2020-09-02 à 17 01 14

...isn't used on LocalLibrary.cpp .../Private/... when debugging

Capture 2020-09-02 à 17 01 18

@rei-vilo
Copy link
Author

See #87

@ubidefeo
Copy link

@rei-vilo
For the next minor alpha release we planned on addressing a lot of debugger related issues, and this is one of them.
Cannot give you an ETA, but I can say that it won't be 2 months ;)

@rei-vilo
Copy link
Author

@ubidefeo Thank you, great to know!

I know software development isn't easy, especially when targeting so many boards...

@ubidefeo
Copy link

@rei-vilo
would you care to give a shot at the last released alpha? (0.1.4)
we have brought a lot of enhancements to the debugger

Will close it because I cannot reproduce it anymore, but feel free to reopen if you're still affected.

@ubidefeo
Copy link

Seems like @per1234 can still reproduce it, hence reopening

@ubidefeo ubidefeo reopened this Feb 18, 2021
@rei-vilo
Copy link
Author

Sure, I plan to try the new release with the same project.

@rei-vilo
Copy link
Author

rei-vilo commented Feb 18, 2021

@ubidefeo After searching a bit for the procedure, I finally found it here at https://github.com/arduino/arduino-pro-ide/issues/366#issuecomment-775734448, and I ran the very same example.

Unfortunately, only the breakpoint on the main sketch is considered. The breakpoint on the library is listed, but not active.

Capture 2021-02-18 à 19 26 55

On the example, the debugger only stops at breakpoint 1. Breakpoint 2 is ignored.

@per1234
Copy link
Contributor

per1234 commented Feb 18, 2021

@per1234 can still reproduce it

That's correct. When I follow rei-vilo's instructions from https://github.com/arduino/arduino-pro-ide/issues/217#issue-572776322, the breakpoint in LocalLibrary.cpp is grayed out in the debugger's "Breakpoints" section, and is an empty circle rather than the expected red dot in the sketch tab. The breakpoint's tooltip says this:

No source file named c:\Users\per\Documents\Arduino\debug\NonInoTab\LocalLibrary.cpp. (from break-insert "c:\Users\per\Documents\Arduino\debug\NonInoTab\LocalLibrary.cpp:8")

If I add a breakpoint to the .ino file, it works perfectly.

@ubidefeo
Copy link

@rsora and I also got to that conclusion and opened an internal task which @cmaglie and @kittaakos are going to look into.
Essentially anything without the .ino extension is referenced from the temp folder, so it opens in a new tab.
You can add a breakpoint to that file and it will work fine.
The original source file is simply ignored.
It's very likely just a mapping issue, and I think @cmaglie can fix that.
It's a good bug 😬

@rsora rsora transferred this issue from arduino/arduino-pro-ide Mar 1, 2021
@rsora rsora added the priority: high Resolution is a high priority label Mar 1, 2021
@rei-vilo
Copy link
Author

rei-vilo commented Mar 3, 2021

@ubidefeo Nice to know it is a "good bug" :-)

@rsora
Copy link
Contributor

rsora commented Mar 19, 2021

@rei-vilo Please check the beta.4 version, your issue should be solved (the fix was done here arduino/arduino-cli#1224)

Feel free to close the issue if you don't experience the problem anymore.

Happy coding!

@rei-vilo
Copy link
Author

@rsora Thank you for the update. I’ll give a try when I return home.

I am a bit lost between this alpha 0.1.1 and the beta 2.0.

Are they the same project? How do they compare?

@ubidefeo
Copy link

@rei-vilo
Over the past few months we have brought the most important parts of Pro IDE into this new IDE 2.0,
which is now the base of development for advanced features we'll be adding from this point on.

Please try IDE 2.0 Beta 4 like suggested by @rsora and let us know.
If your issue is resolved, please close this issue 👍🏼

@rei-vilo
Copy link
Author

Sorry for the late answer. Simple breakpoint works now on libraries.

However, conditional breakpoint doesn't seem to work yet. I am opening a new ticket at #268.

@rsora rsora added type: imperfection Perceived defect in any part of project topic: debugger Related to the integrated debugger labels Sep 22, 2021
@per1234 per1234 added the conclusion: resolved Issue was resolved label Nov 1, 2021
@rsora rsora removed the priority: high Resolution is a high priority label Nov 2, 2021
@rsora rsora added the criticality: high Of high impact label Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved criticality: high Of high impact topic: debugger Related to the integrated debugger type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

6 participants