-1

I am caught up with a weird problem. I have one build that copies data using memcpy,
while another build does not. I don't understand why, because the relevant file is still the same.

I am using following code:

memcpy(pxCurrentInfo, &pxInfoBuffer->axgInfoBuffer[0], sizeof(tInfo));

Data in pxInfoBuffer is fine. When I check pxCurrentInfo they are all 0s.
tInfo is a structure.

To give a pointer, when I put the break point and change the value

pxCurrentInfo->xDL.eMethod=0

it automatically updates/copies all the correct info from pxInfoBuffer->axgInfoBuffer[0], afterwards. I don't know why.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user437777
  • 1,423
  • 4
  • 17
  • 28
  • 11
    Do you really think your problem can be solved by seeing the information you have provided? – Alok Save Mar 23 '12 at 04:46
  • Can you disassemble the code (or compile with -S if using gcc)? – pat Mar 23 '12 at 04:51
  • What is the difference in the builds? Without that only suggestions can be given to solve the problem. Things like, are you sure the pxInfoBuffer's data is valid. – Gangadhar Mar 23 '12 at 04:52
  • what platform is this? If the buffer was filled by DMA, there could be a cache coherency problem. Stopping the program in the debugger could invalidate the cache, causing the buffer to be fetched from memory when the program is restarted. – pat Mar 23 '12 at 04:58
  • 2
    As Als implies, you should post the code for tInfo, pxCurrentInfo, pxInfoBuffer etc.... – Tony Delroy Mar 23 '12 at 04:59
  • `MemCopy` is not synonymous with `memcpy`; both case and spelling are significant in C identifiers. I'll edit your question. – Keith Thompson Mar 23 '12 at 05:12
  • Not enough information is given to answer it, edit it or wait till some moderator close it... – Tomas Pruzina Mar 23 '12 at 16:39

0 Answers0