Setting Memory Breakpoints in Eclipse
Asked Answered
Y

3

15

How do you set memory breakpoints in Eclipse? That is, I would like to set a conditional breakpoint that triggers when the data at a given memory location changes.

This question has been asked before, but the only provided answer doesn't address the question and is essentially the same information that can be found in the Eclipse Online help.

What I am looking for is more detailed information (or an example would be good) for setting a conditional breakpoint in Eclipse that will trigger when the data at a specific memory address changes.

Yaekoyael answered 9/11, 2012 at 15:16 Comment(0)
D
12

You need to use a watchpoint. From the page:

  1. Highlight the variable in the editor, or select it in the Outline view.
  2. Click Run > Toggle Watchpoint.
  3. Do any of the following:
    • To stop execution when the watch expression is read, select the Read check box.
    • To stop execution when the watch expression is written to, select the Write check box.
  4. The watchpoint appears in the Breakpoints view list.
Dichlorodiphenyltrichloroethane answered 9/11, 2012 at 15:27 Comment(4)
Thanks, but what I would like to do is break on a change in memory, not necessarily a variable.Yaekoyael
Is this for Java or C/C++ or what?Dichlorodiphenyltrichloroethane
You can do this with a hardware breakpoint. Not sure whether eclipse offers any other facilities for this.Dichlorodiphenyltrichloroethane
Thanks. Here's more info: mcuoneclipse.com/2012/04/29/…Yaekoyael
C
2

Solution that works:

 1/ Select the variable representing the pointer you want to break on in a given context in the "Variables" tab
 2/ Right click, then select "Add Watchpoint (C/C++)
 3/ In the field "Expression to watch", just replace the name of the variable by the memory address to break on.
Courbevoie answered 1/10, 2014 at 8:16 Comment(1)
This worked for me on S32 Design Studio for ARM (S32K144 - Eclipse IDE from NXP). I had to open the Memory Browser, type my array of interest and add the expression as a breakpoint. Thanks.Cralg
T
1

Using a Watchpoint in Eclipse Oxygen:

  1. In the Expressions view (Window > Show View > Expressions), add an Expression such as: *(uint8_t*)0x231cc528. The cast tells Eclipse the memory location size.
  2. Right-click the added expression and select "Add Watchpoint".
  3. The resulting Watchpoint may be edited and controlled in the "Breakpoints" view.
  4. It may be important to edit the Watchpoint. If you want to e.g. detect changes done by other threads: right-click the Watchpoint in the "Breakpoints" view, select Breakpoint Properties... > Filter, UN-check "Restrict to Selected Processes and Threads"
Tharp answered 9/7, 2018 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.