Debug Source Line Mismatch

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Debug Source Line Mismatch

891件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by scs on Fri Sep 23 08:16:45 MST 2011
I'm using the free v4 IDE with the LPCXpresso 1769 board. All worked well with the demo projects. I've started building a more complex project with a number of sources and linking to two libraries (the USB stack and the EFSL).  That worked too, but today I added an additional C source and suddenly the debugger has started showing the wrong source file lines maybe half the time. It will start showing the correct source line, say line 940 and then as I step through the function it will show a completely different source line, in the same source file, say line 425. Then with additional steps it will intermittently switch back to the correct source line.  When viewing the disassmebly, the assembly looks like the right code but about half the source lines will  be wrong, showing line 940 followed by line 425 followed by 941 or something similar.  This is inside my own source files, not the libraries I'm linking to. And both libraries and my project are using Debug builds.  I've tried a clean rebuild, restarting the IDE, and a different LPCXpresso board, all with the same results. I've also tried commenting out the entire most recently added source files on the theory it was a size issue, but it still happens.  The project build shows text 17888, data 12, bss 4644 bytes, all decimal, so it should not be to large for the free version. Any ideas?
0 件の賞賛
返信
2 返答(返信)

875件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by scs on Fri Sep 23 10:03:27 MST 2011
Thank you, that fixes it. For those who want more detail here is the answer again:

Mismatched source lines in the debugger can be caused by the linker eliminating unused sections of your code. To stop unused code elimination and stop the debugger from showing incorrect source file lines:

Right click on project and choose "Properties"
(Do the following only for the "Debug" configuration and not "Release")
Expand "C/C++ Build" and choose "Settings"
Expand "MCU Linker" and then choose "Miscellaneous"
Select "--gc-sections" and press X icon to remove that line
Press OK to exit from the settings
Rebuild the project
0 件の賞賛
返信

875件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Fri Sep 23 09:01:50 MST 2011
This thread may be of some help

http://knowledgebase.nxp.com/showthread.php?t=2302
0 件の賞賛
返信