cancel
Showing results for 
Search instead for 
Did you mean: 

How to setup Conditional Watchpoints?

stmcoder
Associate II

I'm trying to track down a memory corruption bug in my code. I can setup a Watchpoint for a specific variable (Expression to watch: *(uint32_t*)0x20024840), and get the debugger to stop at a breakpoint whenever the variable is written to (good!).

However, my problem is that 99% of the time, it's a legitimate/intended write, and I'd like it to NOT break at those locations so I can focus on the problem area.

I've tried using the "Conditon:" field in the breakpoint property in 3 different ways:

1) Ignore breakpoint if at a specific address:  $pc != 0x80201cc

2) Ignore the breakpoint if in a specific function:  !$_is_in_function("my_func")

3) Ignore the breakpoint if the value being written to the variable is within a range:  *(uint32_t*)0x20024840<3000||*(uint32_t*)0x20024840>4000

In all 3 cases, it seems to have no filtering at all. I hit all the breakpoints any time the variable is written to no matter what I write on the "Conditon:" box. Is my syntax wrong? Do I need to enable something?

Any hints on how to get this to work? I do have optimizations set to None

1 REPLY 1
Ghofrane GSOURI
ST Employee

Hello @stmcoder 

I'm currently investigating your questions, I will get back to you as soon as possible with answers.

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.