Variable location extraction

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

At the moment through the JTAG interface on my mega128 I can use AVR Studio to observe the data SRAM, that's fine. The problem that I run in to is that if I can see a bit of data being corrupted, I don't know which variable that block of data corresponds to. I can place watches on all the likely suspects and see how we go but in a project of 10's of 1000's of lines of c, this is a bit tricky. Does anybody know of any way of extracting the variable allocation table from the debug file (or otherwise) to see which variables live where? You can use the map file for statically linked variables, but does any body know where to get the same info for all variables? Of course the same bit of SRAM may be used for multiple variables each of limited scope, but I'd still like to see a list of all those variables.

Anyway, any help would be much appreciated!

S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are using JTAG and Studio then can you not put a data breakpoint on the location that is being corrupted? On the debug menu select "new breakpoint" and on the sub-menu "Data Breakpoint"

The likely corruptions are either the stack growing down over the end of the BSS and maybe even the .data or a rogue pointer - a code review (maybe by another programmer?) might tun up anything that looks suspicious - pay particular attention to how pointers are being used!

Cliff