[轉]QNX Momentics IDE無法進入源碼單步調試/無法定位源代碼文件

如果你認爲本系列文章對你有所幫助,請大家有錢的捧個錢場,點擊此處贊助,贊助額0.1元起步,多少隨意

聲明:本文只用於個人學習交流,若不慎造成侵權,請及時聯繫我,立即予以改正

鋒影

email:[email protected]

 

這個現象是由於編譯器進行了代碼優化導致:

1、找到項目屬性設置,編譯器選項設置,添加 -g -O0 選擇項:

2、如果還是無法進入源碼調試,將編譯器優化選項手動禁止:

3、如果無法進入靜態庫進行源碼調試,請將靜態庫項目的屬性按照上面的要求同樣設置。

 

原文:

http://eclipse.1072660.n5.nabble.com/No-source-available-for-quot-main-quot-td59554.html

Thanks! Following your suggestion, I solved both problems. It works 
like a charm! 

Best, 
Michael Chen 

On Wed, Nov 12, 2008 at 3:13 AM, Subs <[hidden email]> wrote:


> 1. Unable to debug: You probably haven't built for debug. Use the -g -O0 
> options to the compiler for debug build 
> 2. Highlight moving randomly: This is probably becuase you have built for 
> debug, but with a high level of optimisation. When optimised, the compiler 
> will move code around to make it optimal, but this pretty much break the 
> association with the source - hence what you are seeing. 

> Michael Chen wrote: 
>> 
>> hey, there, 
>> 
>> I imported an existing C project with working Makefiles. And in the 
>> project property, I ticked off "Use default build" and "Generate 
>> Makefile Automatically", and I supplied the Bulding command 
>> "/usr/bin/make". The project build smoothly and run without problem. 
>> And in the editor windows, CTRL+click on variable names, types or 
>> macros,  leads me to all right places. 
>> 
>> However I can not debug it. The error is No source available for 
>> "main() " . I setup the Source  in the Run/Debug Dialog in all 
>> possible ways I can imagine, and get the same error. There is another 
>> executable generated in a deep subdirectory, and I can at least see 
>> the debug window for it, click on Step Over, however, I see the 
>> highlights jumps around in its source file randomly. It seems that I 
>> missed something. Please help me out, thanks! 
>> 
>> 
>> Best Regards, 
>> Michael Chen 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章