Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Memory Breakpoints in Eclipse

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.

like image 411
Jim Fell Avatar asked Nov 09 '12 15:11

Jim Fell


2 Answers

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.
like image 166
Mike Kwan Avatar answered Sep 23 '22 14:09

Mike Kwan


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.
like image 29
MaximeD Avatar answered Sep 23 '22 14:09

MaximeD