debug 資訊輸出

2021-06-19 07:30:44 字數 542 閱讀 1281

編譯器內建巨集:

先介紹幾個編譯器內建的巨集定義,這些巨集定義不僅可以幫助我們完成跨平台的原始碼編寫,靈活使用也可以巧妙地幫我們輸出非常有用的除錯資訊。

ansi c標準中有幾個標準預定義巨集(也是常用的):

__line__:在源**中插入當前源**行號;

__file__:在原始檔中插入當前源檔名;

__date__:在原始檔中插入當前的編譯日期

__time__:在原始檔中插入當前編譯時間;

__stdc__:當要求程式嚴格遵循ansi c標準時該標識被賦值為1;

__cplusplus:當編寫c++程式時該識別符號被定義。

編譯器在進行原始碼編譯的時候,會自動將這些巨集替換為相應內容。

debug(format,...) printf("file: "__file__", line: %d: "format"/n", __line__, ##__va_args__)

所有的debug資訊都會按照這樣的方式輸出:

file: ***, line: ***, …….

Flex輸出Debug資訊到檔案

mm.cfg檔案包含許多控制日誌資訊的設定項 如果只是記錄error和trace資訊到日誌檔案,只需要在mm.cfg檔案中加入下面兩行文字。errorreportingenable 1 traceoutputfileenable 1 設定之後,呼叫trace 方法就可以把輸出的日誌資訊寫入到flas...

cocos2d x 輸出debug資訊

include define log tag testgame define logv android log print android log verbose,log tag,va args define logd android log print android log debug,log ...

Debug 輸出字串 除錯資訊

使用工具 vc6.0,ida 當我們要在程式中輸出除錯資訊時,常常以字串的形式來輸出,例如 1.printf some debug information here n 1.if debug 2.printf some debug information here n 3.endif 這樣就達到了在...