This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Conditional / expression breakpoints not working on NRF52840DK or working poorly

Using SES, nrf52840DK, the onboard debugger.

I am able to set a breakpoint and use condition like x == 5.

I am unable to use anything but the == operator. In SES I get the red breakpoint with a white question mark over it.

Tried read/write/default, hardware vs software break, all manner of syntax, local and global variables. Nothing seems to work except ==.

Thoughts?

EDIT: I followed the advice for SES here studio.segger.com/index.htm and here studio.segger.com/index.htm

  • Hello,

    I am unable to use anything but the == operator.

    Are you certain that it is only the == operator that works for this? If so, how - what else have you tested, what other operations does not work to put a breakpoint on? It would be very helpful to see some code snippets here. Please use the "Insert->Code" option when sharing code on the forum.

    Please be advised that you will only encounter breakpoints which are set on instructions that the CPU will actually see during operation. During compilation the compiler optimizes away a lot of the code (such as declarations etc.), so the CPU will never actually encounter these. If you place a breakpoint on such an instruction, the debugger will jump right over it.

    Instructions like evaluations (==, >=, <=, etc) could also be optimized away if the two operators are constants, or if the compiler sees that they will never change, so that the evaluation always will have the same outcome.

    Best regards,
    Karl

  • Karl,

    I tested every other operator. Only == works. Everything else will make the breakpoint hover say "UNSUPPORTED BREAKPOINT OPERATION".

    Yes, this was tested on lines that will execute.

    These are not conditionals IN CODE. These are conditionals as breakpoint expressions. Nothing to optimize away.

    Can't post code, but found another project that I can post snippets from. Exact same errors.

    Doesn't work regardless of settings:

    Continues to work with all settings:

  • Hello again,

    Thank you for your patience with this.

    SRA said:

    I tested every other operator. Only == works. Everything else will make the breakpoint hover say "UNSUPPORTED BREAKPOINT OPERATION".

    Yes, this was tested on lines that will execute.

    Thank you for clarifying. This seems very strange.

    What optimization level is your project using? You can find this in Project Options->Code Generation->Optimization level.

    SRA said:
    Can't post code, but found another project that I can post snippets from. Exact same errors.

    Could you possible share this whole project with me? Right now I am unable to replicate this error, but if you send me this other project then I can take a look at the debugger/project settings, and see if I can spot something wrong.

    SRA said:
    These are not conditionals IN CODE. These are conditionals as breakpoint expressions.

    Please elaborate what you mean by this.

    Looking forward to resolving this issue together!

    Best regards,
    Karl

  • Optimization level: NONE

    No, I can't share the whole project. But a very close one would be on github.com

    https://github.com/aws/amazon-freertos  tag: 20201200 but it probably doesn't matter

    What I wrote was the conditionals I'm talking about are the breakpoint conditionals as per picture. Not code breakpoints like if I were to write if (x>10) and put a breakpoint there, because like you eluded to, that line might be removed because x can never be more than 10 and the compiler knew that. A data breakpoint of x > 10 is what I'm having problems with, a line or code breakpoint on a statement like if (x > 10) is not.

  • SRA said:
    No, I can't share the whole project. But a very close one would be on github.com

    I understand. Is this the same project you referred to when you said:

    SRA said:
    Can't post code, but found another project that I can post snippets from. Exact same errors.

    ?
    I also want to let you know that I can change the ticket to Private at any time, if you want to share code that can not be shared publicly. Private tickets are only viewable by yourself and the support staff here at Nordic. Please just let me know if I should make it private.

    SRA said:
    Optimization level: NONE
    SRA said:
    Not code breakpoints like if I were to write if (x>10) and put a breakpoint there, because like you eluded to, that line might be removed because x can never be more than 10 and the compiler knew that. A data breakpoint of x > 10 is what I'm having problems with, a line or code breakpoint on a statement like if (x > 10) is not.

    Thank you for clarifying - I only asked in order to avoid making any wrongful assumption about your issue.
    Looking into it, it seems this issue has been raised in Segger's forum earlier.
    Could you try the workaround proposed in this ticket?
    Since this is an issue in SES I would also recommend that you open a ticket with them, if the configurations / workaround they mention in my referenced post does not resolve the issue.

    Best regards,
    Karl

Related