星期二, 7月 27, 2010

VS2005 debugging在 Windows Mobile release版程式行數對不準的原因.

之前用VS2005 run debug mode要deug某支release版AP時,
會發生單步執行時,單行code的內容跟所執行的不太一致,
比如code執行到return或是function結尾,
程式卻繼續往下跑.

隨興看到這篇,
問題發生的原因可能是Optimization,
摘要重點如下,

Optimization can affect:
    *Local variables, which can be removed by the optimizer or moved to locations the debugger does not understand.
    *Positions inside a function, which are changed when the optimizer merges blocks of code.
    *Function names for frames on the call stack, which may be wrong if the optimizer merges two functions.

參考資料:
http://msdn.microsoft.com/en-us/library/606cbtzs%28v=VS.80%29.aspx

沒有留言:

張貼留言