- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have never been able to get variable watchpoints to work correctly. For example, I have a function something like
int run_test() { int retval = 0; if(a) retval = 1; if(!b) retval = 1; if(b && c) retval = 1; return retval; } In Eclipse, if I put a watchpoint on retval and check the Write box, I expect the program to stop any time retval is written. However, I often get to the bottom of the function, retval has been written to a 1, and the program never stopped to tell me where it was happening. Has anyone else had this problem, and is there maybe some setting I'm missing? Thanks.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to be using one of the more advanced version of the Nios core.
On the page where you select the level of pipelining, MMU, and other such things, I think there is a description that says which versions support variable watch points. Select that and I think it will work.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Data watchpoints won't work on items that the compiler assigns to a register, only on writes to real memory.
Even without the optimiser it is possible that 'retval' doesn't exist as a memory item (or at least the allocated item isn't used. If you move 'retval' outside the function and define it as 'volatile int retval' then the writes are required to be generated and the watchpoint should trap.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Those are both excellent answers. Thank you, I will look into it.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page