亚洲国产精品久久久久久,欧美无乱码久久久免费午夜一区二区三区中文字幕 ,欧美一区二区三区久久综http://m.shnenglu.com/sandy/category/1244.html高性能服務器端計算zh-cnSat, 27 Sep 2008 10:58:16 GMTSat, 27 Sep 2008 10:58:16 GMT60使用Gflags來檢測heap問題http://m.shnenglu.com/sandy/archive/2008/09/27/62877.html小明小明Sat, 27 Sep 2008 02:59:00 GMThttp://m.shnenglu.com/sandy/archive/2008/09/27/62877.htmlhttp://m.shnenglu.com/sandy/comments/62877.htmlhttp://m.shnenglu.com/sandy/archive/2008/09/27/62877.html#Feedback2http://m.shnenglu.com/sandy/comments/commentRss/62877.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/62877.html閱讀全文

小明 2008-09-27 10:59 發表評論
]]>
LeakDiag使用手記http://m.shnenglu.com/sandy/archive/2008/08/18/59260.html小明小明Mon, 18 Aug 2008 11:12:00 GMThttp://m.shnenglu.com/sandy/archive/2008/08/18/59260.htmlhttp://m.shnenglu.com/sandy/comments/59260.htmlhttp://m.shnenglu.com/sandy/archive/2008/08/18/59260.html#Feedback2http://m.shnenglu.com/sandy/comments/commentRss/59260.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/59260.html閱讀全文

小明 2008-08-18 19:12 發表評論
]]>
遠程調試技術-使用vs2005http://m.shnenglu.com/sandy/archive/2008/07/28/57351.html小明小明Mon, 28 Jul 2008 07:20:00 GMThttp://m.shnenglu.com/sandy/archive/2008/07/28/57351.htmlhttp://m.shnenglu.com/sandy/comments/57351.htmlhttp://m.shnenglu.com/sandy/archive/2008/07/28/57351.html#Feedback2http://m.shnenglu.com/sandy/comments/commentRss/57351.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/57351.html閱讀全文

小明 2008-07-28 15:20 發表評論
]]>
VS2005 SP1的編譯兼容性問題http://m.shnenglu.com/sandy/archive/2008/04/18/47519.html小明小明Fri, 18 Apr 2008 10:01:00 GMThttp://m.shnenglu.com/sandy/archive/2008/04/18/47519.htmlhttp://m.shnenglu.com/sandy/comments/47519.htmlhttp://m.shnenglu.com/sandy/archive/2008/04/18/47519.html#Feedback0http://m.shnenglu.com/sandy/comments/commentRss/47519.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/47519.html閱讀全文

小明 2008-04-18 18:01 發表評論
]]>
C++源文件編碼問題http://m.shnenglu.com/sandy/archive/2007/04/05/21320.html小明小明Thu, 05 Apr 2007 07:30:00 GMThttp://m.shnenglu.com/sandy/archive/2007/04/05/21320.htmlhttp://m.shnenglu.com/sandy/comments/21320.htmlhttp://m.shnenglu.com/sandy/archive/2007/04/05/21320.html#Feedback5http://m.shnenglu.com/sandy/comments/commentRss/21320.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/21320.html閱讀全文

小明 2007-04-05 15:30 發表評論
]]>
UltraEdit的一個Bughttp://m.shnenglu.com/sandy/archive/2007/04/04/21231.html小明小明Wed, 04 Apr 2007 05:51:00 GMThttp://m.shnenglu.com/sandy/archive/2007/04/04/21231.htmlhttp://m.shnenglu.com/sandy/comments/21231.htmlhttp://m.shnenglu.com/sandy/archive/2007/04/04/21231.html#Feedback5http://m.shnenglu.com/sandy/comments/commentRss/21231.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/21231.html閱讀全文

小明 2007-04-04 13:51 發表評論
]]>
WinDBG(CDB)實踐1-新手指南http://m.shnenglu.com/sandy/archive/2007/03/13/19723.html小明小明Tue, 13 Mar 2007 06:39:00 GMThttp://m.shnenglu.com/sandy/archive/2007/03/13/19723.htmlhttp://m.shnenglu.com/sandy/comments/19723.htmlhttp://m.shnenglu.com/sandy/archive/2007/03/13/19723.html#Feedback0http://m.shnenglu.com/sandy/comments/commentRss/19723.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/19723.html閱讀全文

小明 2007-03-13 14:39 發表評論
]]>
GDB 和 CDB 基本命令比較http://m.shnenglu.com/sandy/archive/2007/03/08/19425.html小明小明Thu, 08 Mar 2007 06:33:00 GMThttp://m.shnenglu.com/sandy/archive/2007/03/08/19425.htmlhttp://m.shnenglu.com/sandy/comments/19425.htmlhttp://m.shnenglu.com/sandy/archive/2007/03/08/19425.html#Feedback0http://m.shnenglu.com/sandy/comments/commentRss/19425.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/19425.html也許有人不知道CDB是什么,CDB是windbg的小兄弟,基于command line,對于我這個比較喜歡用command line的人,CDB比windbg更容易上手。

象GDB,CDB這些工具,命令都很多,但是我們只要熟記最常用的"三板斧"就可以工作了。

1.啟動
   1)直接調試:  
      gdb program [core]
      cdb program or cdb -z DumpFile
   2)attach方式
      gdb attach pid
      cdb -pn ExeName or cdb -p pid

2.顯示堆棧
   GDB: bt
   CDB: k

3. 設置斷點
   GDB: b [file:]line
   CDB: bp 'file:line'

4. 運行/繼續運行
   GDB: run [arglist] 
             c   繼續運行 
   CDB: g

5. 單步
   GDB : n (step over) s (step into)
   CDB : p

6. 打印變量的值
    GDB : p expr
    CDB: ? expr

說老實話,CDB過于復雜,學起來比GDB難.

BTW:用CDB之前設置一下symbol的path
set _NT_SYMBOL_PATH=srv*c:\symbols*http://msdl.microsoft.com/download/symbols
   
   



小明 2007-03-08 14:33 發表評論
]]>
[Tips]如何計算utf8下的字節數http://m.shnenglu.com/sandy/archive/2006/11/08/14841.html小明小明Wed, 08 Nov 2006 05:32:00 GMThttp://m.shnenglu.com/sandy/archive/2006/11/08/14841.htmlhttp://m.shnenglu.com/sandy/comments/14841.htmlhttp://m.shnenglu.com/sandy/archive/2006/11/08/14841.html#Feedback0http://m.shnenglu.com/sandy/comments/commentRss/14841.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/14841.html
<!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.0?Transitional//EN">
<HTML>
<HEAD>
<TITLE>?An?utf8?count?tool??</TITLE>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf16">
<script>
????
function?utf16to8(str)?{
????????
var?out,?i,?len,?c;

????????out?
=?"";
????????len?
=?str.length;
????????
for(i?=?0;?i?<?len;?i++)?{
????????c?
=?str.charCodeAt(i);
????????
if?((c?>=?0x0001)?&&?(c?<=?0x007F))?{
????????????out?
+=?str.charAt(i);
????????}?
else?if?(c?>?0x07FF)?{
????????????out?
+=?String.fromCharCode(0xE0?|?((c?>>?12)?&?0x0F));
????????????out?
+=?String.fromCharCode(0x80?|?((c?>>??6)?&?0x3F));
????????????out?
+=?String.fromCharCode(0x80?|?((c?>>??0)?&?0x3F));
????????}?
else?{
????????????out?
+=?String.fromCharCode(0xC0?|?((c?>>??6)?&?0x1F));
????????????out?
+=?String.fromCharCode(0x80?|?((c?>>??0)?&?0x3F));
????????}
????????}
????????
return?out;
????}
????
function?count()
????{
????????
var?temp?=?f1.value;
????????temp
=temp.replace(/\\r/g,"\r");
????????temp
=temp.replace(/\\n/g,"\n");
????????result.innerHTML
=utf16to8(temp).length;
????}
</script>
</HEAD>

<BODY>
<TEXTAREA?id="f1"?NAME="f1"?ROWS="10"?COLS="50"></TEXTAREA>
<br/>
<INPUT?TYPE="button"?value="count?length"?onclick="count()">
<div?id="result"></div>
</BODY>
</HTML>


小明 2006-11-08 13:32 發表評論
]]>
Quick Reference -- 工程師必備http://m.shnenglu.com/sandy/archive/2006/09/28/13114.html小明小明Thu, 28 Sep 2006 07:30:00 GMThttp://m.shnenglu.com/sandy/archive/2006/09/28/13114.htmlhttp://m.shnenglu.com/sandy/comments/13114.htmlhttp://m.shnenglu.com/sandy/archive/2006/09/28/13114.html#Feedback2http://m.shnenglu.com/sandy/comments/commentRss/13114.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/13114.html閱讀全文

小明 2006-09-28 15:30 發表評論
]]>
[Tips]如何識別字符編碼http://m.shnenglu.com/sandy/archive/2006/09/27/13014.html小明小明Wed, 27 Sep 2006 02:00:00 GMThttp://m.shnenglu.com/sandy/archive/2006/09/27/13014.htmlhttp://m.shnenglu.com/sandy/comments/13014.htmlhttp://m.shnenglu.com/sandy/archive/2006/09/27/13014.html#Feedback2http://m.shnenglu.com/sandy/comments/commentRss/13014.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/13014.html閱讀全文

小明 2006-09-27 10:00 發表評論
]]>
代碼格式化工具http://m.shnenglu.com/sandy/archive/2006/07/14/9855.html小明小明Fri, 14 Jul 2006 08:32:00 GMThttp://m.shnenglu.com/sandy/archive/2006/07/14/9855.htmlhttp://m.shnenglu.com/sandy/comments/9855.htmlhttp://m.shnenglu.com/sandy/archive/2006/07/14/9855.html#Feedback2http://m.shnenglu.com/sandy/comments/commentRss/9855.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/9855.html閱讀全文

小明 2006-07-14 16:32 發表評論
]]>
C++代碼靜態分析工具-Prefasthttp://m.shnenglu.com/sandy/archive/2006/03/28/4689.html小明小明Tue, 28 Mar 2006 05:59:00 GMThttp://m.shnenglu.com/sandy/archive/2006/03/28/4689.htmlhttp://m.shnenglu.com/sandy/comments/4689.htmlhttp://m.shnenglu.com/sandy/archive/2006/03/28/4689.html#Feedback5http://m.shnenglu.com/sandy/comments/commentRss/4689.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/4689.html 1. 什么是Prefast

Prefast是一種代碼分析工具,它能夠幫助你找到編譯器不能找到的錯誤或者缺陷。Prefast首次被微軟集成到Visual Studio 2005 Team Suite中去,使用起來非常方便。

2.怎么使用Prefast
在vs2005 Team Suite中,使用Prefast非常簡單。修改你的工程屬性,設置Enable Code Analysis For C/C++為Yes.

prefast1.jpg

效果:
prefast2.jpg

注意到有可能錯誤的地方以淺灰色顯示在編輯器中了。

3.Prefast能幫你找到哪些錯誤

1)沒有初始化

// no?initial
void ?defect1()
{
????????
int ?a;
????????
int ?b;

????????b?
= ?a;
}

會報: d:\test\testcode\testcode.cpp(18) : warning C6001: Using uninitialized memory 'a': Lines: 15, 16, 18

2)空指針取值

// one?path?dereference?NULL
void ?defect4( int ?b,? int ?c)
{
????????
int ? * p? = ?NULL;
????????
int ?a? = ? 1 ;

????????
if ?(b? == ? 1 )?{
????????????????
if ?(c? == ? 1 )?{
????????????????????????p?
= ? & a;
????????????????}
????????????????
else ?{
????????????????????????????????????????????????
????????????????}
????????}
????????
else ?{
????????????????
if ?(c? == ? 1 )?{

????????????????}
????????????????
else ?{
????????????????????????p?
= ? & a;
????????????????}
????????}

????????
* p;

????????
return ;
}????

會報:d:\test\testcode\testcode.cpp(65) : warning C6011: Dereferencing NULL pointer 'p': Lines: 45, 46, 48, 57, 65

3)可能錯誤的運算符優先級

void ?defect5()
{
????????
int ?a? = ? 1 ;
????????
int ?b? = ? 1 ;
????????
int ?c? = ? 1 ;

????????
if ?(a? & ?b? == ?c)
????????????????
return ;
}

會報: d:\test\testcode\testcode.cpp(76) : warning C6281: Incorrect order of operations: relational operators have higher precedence than bitwise operators

4)可能的buffer overrun

void ?defect8()
{
????????
char ?buf[ 100 ];
????????
char ?buf2[ 200 ];
????????
int ?i? = ? 100 ;

????????sprintf(buf,?
" hello?world?%d " ,?i);
????????strcpy(buf,?buf2);
}

會報: d:\test\testcode\testcode.cpp(133) : warning C6202: Buffer overrun for 'buf', which is possibly stack allocated, in call to 'strcpy': length '200' exceeds buffer size '100'

5)可能的無窮循環

// infinite?loop
void ?defect14()
{
????????signed?
char ?i;

????????
for ?(i? = ? 100 ;?i? >= ? 0 ;?i ++ )?{
????????????????;?
????????}
}

會報: d:\test\testcode\testcode.cpp(198) : warning C6292: Ill-defined for-loop: counts up from maximum

6)格式字符串錯誤

// Format?string?mismatch
void ?defect21()
{
????????
char ?buff[ 5 ];
????????sprintf(buff,?
" %s?%s " ,? " a " );
}

會報: d:\test\testcode\testcode.cpp(277) : warning C6063: Missing string argument to 'sprintf' that corresponds to conversion specifier '2'

7)安全問題

void ?defect27()
{
????????CreateProcess(NULL,
???????????????
" c:\\program?files\\Project.exe?arg1 " ,? // correct?"\"c:\\program?files\\Project.exe\"?arg1",
???????????????NULL,
???????????????NULL,
???????????????
false ,
???????????????
0 ,
???????????????NULL,
???????????????NULL,
???????????????NULL,
???????????????NULL);???????????????
}

會報: d:\test\testcode\testcode.cpp(327) : warning C6277: NULL application name with an unquoted path in call to 'CreateProcessA': results in a security vulnerability if the path contains spaces

8)=和==誤用

void ?defect32()
{
????????
int ?a? = ? 1 ;

????????
if ?(a? = ? 2 )
????????????????
return ;
}

會報: d:\test\testcode\testcode.cpp(405) : warning C6282: Incorrect operator: assignment of constant in Boolean context. Consider using '==' instead

9)邏輯運算問題

// always?false
void ?defect45()
{
????????
int ?x;

????????
if ?( 0 ? && ?x ++ )?{
????????????????;
????????}
}

會報: d:\test\testcode\testcode.cpp(564) : warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and might have side effects

10)其他







小明 2006-03-28 13:59 發表評論
]]>
C++跨平臺開發方法/工具http://m.shnenglu.com/sandy/archive/2006/03/24/4544.html小明小明Fri, 24 Mar 2006 08:45:00 GMThttp://m.shnenglu.com/sandy/archive/2006/03/24/4544.htmlhttp://m.shnenglu.com/sandy/comments/4544.htmlhttp://m.shnenglu.com/sandy/archive/2006/03/24/4544.html#Feedback15http://m.shnenglu.com/sandy/comments/commentRss/4544.htmlhttp://m.shnenglu.com/sandy/services/trackbacks/4544.html  閱讀全文

小明 2006-03-24 16:45 發表評論
]]>
久久无码国产专区精品| 日韩亚洲欧美久久久www综合网| 亚洲国产成人久久综合碰| 久久伊人精品青青草原日本| 亚洲国产精品嫩草影院久久| 99久久国产亚洲综合精品| 97久久婷婷五月综合色d啪蜜芽| 亚洲精品无码久久久久去q| 久久精品国产亚洲AV高清热| 日本久久久精品中文字幕| 思思久久99热只有频精品66| 久久国产精品无码一区二区三区| 色综合合久久天天综合绕视看| 久久精品亚洲乱码伦伦中文| 国产精品成人久久久| 久久精品国产亚洲AV香蕉| 精品人妻伦九区久久AAA片69 | 日本高清无卡码一区二区久久 | 久久中文字幕人妻熟av女| 成人国内精品久久久久一区| 久久久久这里只有精品 | 婷婷伊人久久大香线蕉AV| 亚洲国产成人久久精品动漫| 亚洲第一永久AV网站久久精品男人的天堂AV| 香蕉久久夜色精品升级完成| 久久人人爽人人爽人人片AV麻豆| 亚洲国产精品一区二区久久hs| 久久综合丁香激情久久| 2020国产成人久久精品| 99久久国产综合精品网成人影院| 久久久久亚洲av成人网人人软件| 久久不射电影网| 无码AV中文字幕久久专区| 久久这里只有精品视频99| 成人妇女免费播放久久久| 狠狠综合久久综合88亚洲| 精品人妻伦九区久久AAA片69 | 日本五月天婷久久网站| 777久久精品一区二区三区无码| 久久亚洲精精品中文字幕| 性做久久久久久久久浪潮|