Skip to content

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

Closed
@rei-vilo

Description

@rei-vilo

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);
    }
}

Activity

spoenemann

spoenemann commented on Mar 4, 2020

@spoenemann

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

rei-vilo

rei-vilo commented on Mar 4, 2020

@rei-vilo
Author

Thank you.

Waiting for Alpha 0.06 now!

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[/+] on Sep 2, 2020
rei-vilo

rei-vilo commented on Sep 2, 2020

@rei-vilo
Author

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

rei-vilo commented on Oct 13, 2020

@rei-vilo
Author

See #87

ubidefeo

ubidefeo commented on Oct 13, 2020

@ubidefeo

@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

rei-vilo commented on Oct 13, 2020

@rei-vilo
Author

@ubidefeo Thank you, great to know!

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

ubidefeo

ubidefeo commented on Feb 18, 2021

@ubidefeo

@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

ubidefeo commented on Feb 18, 2021

@ubidefeo

Seems like @per1234 can still reproduce it, hence reopening

rei-vilo

rei-vilo commented on Feb 18, 2021

@rei-vilo
Author

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

rei-vilo

rei-vilo commented on Feb 18, 2021

@rei-vilo
Author

@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

per1234 commented on Feb 18, 2021

@per1234
Contributor

@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

ubidefeo commented on Feb 18, 2021

@ubidefeo

@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 😬

1 remaining item

rei-vilo

rei-vilo commented on Mar 3, 2021

@rei-vilo
Author

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

rsora

rsora commented on Mar 19, 2021

@rsora
Contributor

@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

rei-vilo commented on Mar 19, 2021

@rei-vilo
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

ubidefeo commented on Mar 20, 2021

@ubidefeo

@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

rei-vilo commented on Mar 25, 2021

@rei-vilo
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.

added and removed
priority: highResolution is a high priority
on Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rei-vilo@ubidefeo@silvanocerza@spoenemann@per1234

        Issue actions

          Alpha 0.1.1 Debugging: breakpoints on local libraries are not considered · Issue #120 · arduino/arduino-ide