??xml version="1.0" encoding="utf-8" standalone="yes"?>伊人色综合久久天天人手人婷,亚洲人成网站999久久久综合,久久久久人妻一区二区三区vrhttp://www.shnenglu.com/sunicdavy/archive/2017/04/20/214874.html战魂筑战魂筑Thu, 20 Apr 2017 04:52:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2017/04/20/214874.htmlhttp://www.shnenglu.com/sunicdavy/comments/214874.htmlhttp://www.shnenglu.com/sunicdavy/archive/2017/04/20/214874.html#Feedback0http://www.shnenglu.com/sunicdavy/comments/commentRss/214874.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/214874.html使用Visual Studio Code调试Golang工程

  • 最单的调试ȝ
  • 多项目调? 适用个h开发和目开?/li>
  • 无需修改pȝ环境变量
  • 准备VSCode

    在官|下载最新版的VSCode:

    https://code.visualstudio.com/

    安装Golang插g

    • 打开扩展面板

      VSCode->查看->扩展

    • 扑ֈGo插g 在搜索框里输入Go, 扑ֈW二行写?Rich Go language support for Visual Studio Code的插? 点击安装

      注意不是排名最高的

    • 重启~辑?/p>

  • 打开调试面板

    VSCode->查看->调试

  • d调试目标

    ?没有调试"的下拉框中点?d配置.."

  • d目标调试配置

    例子:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch",
                "type": "go",
                "request": "launch",
                "mode": "debug",
                "remotePath": "",
                "port": 2345,
                "host": "127.0.0.1",
                "program": "${fileDirname}",
                "env": {
                    "GOPATH":"D:/Develop/vscodegolang"
                },
                "args": [],
                "showLog": true
            }
        ]
    }
  • 其中: "port", "host"都是go插g自动生成?/p>

    "env"|环境变? 讄Z的工E目录就可以(包含bin, src的文件夹)

    准备调试插g

    此时扑ֈmain.go按F5, 会报错提C?

    Failded to continue:"Cannot find Delve debugger. Install from https://github.com/derekparker/delve & ensure it is in your "GOPATH/bin" or "PATH"

    我们使用go命o行编译调试器

    go get github.com/derekparker/delve/cmd/dlv

    dlv调试器放在GOPATH(工程目录)的bin目录?/p>

    选中要调试的main.go, 点击F5, 既可以开始调?/p>

    调试快捷键和Visual StudiopM?/p>

    • F9 切换断点
    • F10 Step over
    • F11 Step in
    • Shift+F11 Step out

    注意?/p>

    • 某些l构体成员无法直接显C时, 可以直接选中变量? d到监? 或者右键点? "调试:求?

    在launch.json中可以添加多l调试入? 通过调试面板中选中对应的配|开启不同目标的调试

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "client",
                "type": "go",
                "request": "launch",
                "mode": "debug",
                "remotePath": "",
                "port": 2345,
                "host": "127.0.0.1",
                "program": "${fileDirname}",
                "env": {
                    "GOPATH":"D:/Develop/vscodegolang"
                },
                "args": [],
                "showLog": true
            },
    
            {
                "name": "server",
                "type": "go",
                "request": "launch",
                "mode": "debug",
                "remotePath": "",
                "port": 2345,
                "host": "127.0.0.1",
                "program": "${workspaceRoot}/src/server",
                "env": {
                    "GOPATH":"D:/Develop/vscodegolang"
                },
                "args": [],
                "showLog": true
            }
        ]
    }

    "program"中的"${fileDirname}"是以当前选中文g作ؓ启动?/p>

    更徏议?program"?${workspaceRoot}", 以包名作为启动点的方式进行配|?/strong>

    https://code.visualstudio.com/Docs/editor/debugging



    战魂筑 2017-04-20 12:52 发表评论
    ]]>使用delve调试GolangE序技?/title><link>http://www.shnenglu.com/sunicdavy/archive/2016/09/03/214254.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Sat, 03 Sep 2016 10:12:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2016/09/03/214254.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/214254.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2016/09/03/214254.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/214254.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/214254.html</trackback:ping><description><![CDATA[<p style="margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1; margin-top: 0px !important;"></p><p style="margin-right: 0px; margin-bottom: 10px; margin-left: 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1; margin-top: 0px !important;">Google官方为Golang的调试例子默认用了gdb</p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">然? 使用gdb调试goE序会遇到goroutine的各c问? 因ؓgdb不懂go</p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">因此, q里使用delve黑科技来进行Golang的程序调?/p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">U命令行调试Ҏ(gu)在网上很Ҏ(gu)搜烦? 本文主要以LiteIDE来进行程序调?/p><h1>关闭~译器优?/h1><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">正常go build/install出的goE序是完全优化过? 使用调试器挂接调试时, 某些local变量/lamda表达式捕L(fng)变量会直接进入寄存器, 无法使用调试器查?/p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">删掉所有的pkg, 为build或install参数加入关闭~译器优化的参数 -gcflags "-N -l"</p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">例如:</p><pre linenums="" prettyprinted"="" style="margin-top: 10px; margin-bottom: 10px; border: 1px solid #e1e1e8; font-size: 13px; line-height: 19px; overflow: auto; padding: 10px; border-radius: 3px; word-wrap: break-word; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; box-shadow: #fbfbfc 40px 0px 0px inset, #ececf0 41px 0px 0px inset; widows: 1; background-color: #f7f7f9;"><ol style="margin: 0px; padding-left: 30px !important; color: #1e347b;"><li style="margin: 0px; color: #bebec5; line-height: 18px; padding-left: 12px !important; list-style-type: decimal !important;"><code style="margin: 0px; padding: 0px; border: none; border-radius: 3px; word-wrap: break-word; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; max-width: 100%; background: transparent;"><span style="color: #48484c; margin-top: 0px;"> go install </span><span style="color: #93a1a1;">-</span><span style="color: #48484c;">gcflags </span><span style="color: #dd1144;">"-N -l"</span><span style="color: #48484c;"> svc\gamesvc</span></code></li></ol></pre><h2>delve调试器安装方?/h2><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">LiteIDE自带了gdb, 但是没有delve调试? 需要自行安? 命o如下</p><pre linenums="" prettyprinted"="" style="margin-top: 10px; margin-bottom: 10px; border: 1px solid #e1e1e8; font-size: 13px; line-height: 19px; overflow: auto; padding: 10px; border-radius: 3px; word-wrap: break-word; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; box-shadow: #fbfbfc 40px 0px 0px inset, #ececf0 41px 0px 0px inset; widows: 1; background-color: #f7f7f9;"><ol style="margin: 0px; padding-left: 30px !important; color: #1e347b;"><li style="margin: 0px; color: #bebec5; line-height: 18px; padding-left: 12px !important; list-style-type: decimal !important;"><code style="margin: 0px; padding: 0px; border: none; border-radius: 3px; word-wrap: break-word; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; max-width: 100%; background: transparent;"><span style="color: #48484c; margin-top: 0px;">go </span><span style="color: #1e347b;">get</span><span style="color: #48484c;"> github</span><span style="color: #93a1a1;">.</span><span style="color: #48484c;">com</span><span style="color: #93a1a1;">/</span><span style="color: #48484c;">derekparker</span><span style="color: #93a1a1;">/</span><span style="color: #48484c;">delve</span><span style="color: #93a1a1;">/</span><span style="color: #48484c;">cmd</span><span style="color: #93a1a1;">/</span><span style="color: #48484c;">dlv</span></code></li></ol></pre><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">delve调试器会被放C的GOPATH/bin?/p><h1>LiteIDE中的delve调试器配|?/h1><h2>选择调试?/h2><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">在LiteIDE菜单中选择 调试->debugger/delve</p><h2>delve环境变量讄</h2><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">q个时? LiteIDE依然找不到delve, 因ؓ它不在环境变量PATH? q里无需修改环境变量, 只需要LiteIDE的环境配|?/p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">在LiteIDE菜单中选择 查看->~辑当前环境, 在弹出的文档中修?/p><pre linenums="" prettyprinted"="" style="margin-top: 10px; margin-bottom: 10px; border: 1px solid #e1e1e8; font-size: 13px; line-height: 19px; overflow: auto; padding: 10px; border-radius: 3px; word-wrap: break-word; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; box-shadow: #fbfbfc 40px 0px 0px inset, #ececf0 41px 0px 0px inset; widows: 1; background-color: #f7f7f9;"><ol style="margin: 0px; padding-left: 30px !important; color: #1e347b;"><li style="margin: 0px; color: #bebec5; line-height: 18px; padding-left: 12px !important; list-style-type: decimal !important;"><code style="margin: 0px; padding: 0px; border: none; border-radius: 3px; word-wrap: break-word; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; max-width: 100%; background: transparent;"><span style="color: #48484c; margin-top: 0px;">PATH</span><span style="color: #93a1a1;">=</span><span style="color: #48484c;">c</span><span style="color: #93a1a1;">:</span><span style="color: #48484c;">\mingw32\b</span><span style="color: #1e347b;">in</span><span style="color: #93a1a1;">;%</span><span style="color: #48484c;">GOROOT</span><span style="color: #93a1a1;">%</span><span style="color: #48484c;">\b</span><span style="color: #1e347b;">in</span><span style="color: #93a1a1;">;%</span><span style="color: #48484c;">PATH</span><span style="color: #93a1a1;">%;</span><span style="color: #48484c;">c</span><span style="color: #93a1a1;">:</span><span style="color: #48484c;">\y</span><span style="color: #1e347b;">our</span><span style="color: #48484c;">\path\to\delve</span></code></li></ol></pre><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">LPATH前的注释#, ?PATH%d分号, 然后和你到delve调试器的路径</p><h2>开始调?/h2><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">选择你的工程, 点击F5, q入调试模式</p><h2>调试器显C变量?/h2><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;"><img src="file:///D:/Documents/My%20Knowledge/temp/6f9eec62-fe6c-4f28-89ad-acbade688a96/4/index_files/2be001ea-878e-4e38-9209-76ef93d427f0.png" style="border: 0px; max-width: 100%; margin: 2px 0px; height: auto !important;" alt="" /></p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">LiteIDE使用delve调试? 无法?变量 监视{窗口中正确捕捉delve调试q回数据(因ؓ格式太复杂了…)</p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">没关p? 我们使用命o行配合显C即?/p><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">LiteIDE控制台或调试输出H口在delve调试? 实际上是一个标准命令行 <br />命o如下</p><ul style="margin: 10px 0px; padding-left: 32px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; font-size: 15px; line-height: 24px; widows: 1;"><li style="margin: 0px 0px 5px;"><p style="margin: 0px;">p 变量名可以查看变量?/p></li><li style="margin: 5px 0px;"><p style="margin: 0px;">locals查看局部变?/p></li><li style="margin: 5px 0px;"><p style="margin: 0px;">ls可查看当前文?/p></li><li style="margin: 5px 0px;"><p style="margin: 0px;">stack查看?/p></li><li style="margin: 5px 0px;"><p style="margin: 0px;">help可以查看各种帮助</p></li></ul><h2>调试外部E序</h2><p style="margin: 10px 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1;">如果你的E序是外部程? 或者用go install安装到GOPATH/bin目录的程? 那么使用delve调试器启动程序时, 可能会碰到启动\径错误的问题</p><p style="margin-top: 10px; margin-right: 0px; margin-left: 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1; margin-bottom: 0px !important;">使用LiteIDE菜单 调试->调试其他应用E序… 填入你要调试E序的\径以及工作目? 可以解决q个问题</p><p style="margin-top: 10px; margin-right: 0px; margin-left: 0px; font-size: 15px; font-family: Helvetica, "Hiragino Sans GB", 微Y雅黑, "Microsoft YaHei UI", SimSun, SimHei, arial, sans-serif; line-height: 24px; widows: 1; margin-bottom: 0px !important;"></p><img src ="http://www.shnenglu.com/sunicdavy/aggbug/214254.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2016-09-03 18:12 <a href="http://www.shnenglu.com/sunicdavy/archive/2016/09/03/214254.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>lua调试的工具选择http://www.shnenglu.com/sunicdavy/archive/2014/09/28/208441.html战魂筑战魂筑Sun, 28 Sep 2014 07:19:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2014/09/28/208441.htmlhttp://www.shnenglu.com/sunicdavy/comments/208441.htmlhttp://www.shnenglu.com/sunicdavy/archive/2014/09/28/208441.html#Feedback7http://www.shnenglu.com/sunicdavy/comments/commentRss/208441.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/208441.html最q看C个关于vs的lua调试插g, 装了vs2012试了? 忍不住发此文ȝ下lua各种调试工具

    Decoda

        q是C地球上调试lua5.1最方便的工? 没有之一. 强大的注入式调试, 性能极高.支持 挂接q程, 变量展开, 断点{各U日常所需.

    早期的Decoda是收费工? 因此质量非常?

        Decoda现在已经停止开发ƈ开源了, 调试lua5.2会crash. 源代码可以作ZU技术参? 很多dll注入修改技? 灰常牛X

    image

    LuaStudio

       比较优秀的调试工?因ؓ收费), 可以调试lua5.1/5.2, 界面属于vs2008cd, 土豪可以考虑买几套试?/p>

     

    ZeroBrane Studio

    对lua5.1支持较好, 5.2也能调但偶尔q是会crash, Zq程调试方式, 所以性能略低.

    RemDebug

    没有IDE, U命令行方式调试? 但因为简? 所以可以参考后写一个自qE序内徏调试?/p>

    Babe Lua

    把这货放在最后是有原因的, q记得那句老话: 老外一开? 我们有自主研发? 对的, q货一定是参考了Decoda的代码后搞出个vs的插件来, 虽然不收? 但是不提下参考对象的行ؓq是值得Ҏ(gu)? q货在中文博客上? 不支持挂接到q程(Decoda支持), 不支?4位调?LuaStudio支持), 调试30~50ơ偶挂1?? ? 毕竟只是代码搬运? 不生产代?

    q货装上, 能用, ?.2是不行的, 5.1比Decoda方便? 毕竟vs支持(zhn)Q昄变量.

     

    说了那么? 其实对于lua5.2版本的调? q是没有免费的比较合适的Ҏ(gu), 如果实在惌? q是可以参考下RemDebug的原理及lua官方调试文档, 自己通过c api调用写一套适合自己的远E调试工? 其实没有多复? 但L不调试的?img class="wlEmoticon wlEmoticon-smile" style="border-top-style: none; border-bottom-style: none; border-right-style: none; border-left-style: none" alt="微笑" src="http://www.shnenglu.com/images/cppblog_com/sunicdavy/Windows-Live-Writer/lua_D2A5/wlEmoticon-smile_2.png">



    战魂筑 2014-09-28 15:19 发表评论
    ]]>
    E序异常VC调试器无法定位的处理http://www.shnenglu.com/sunicdavy/archive/2013/06/27/201339.html战魂筑战魂筑Thu, 27 Jun 2013 03:05:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2013/06/27/201339.htmlhttp://www.shnenglu.com/sunicdavy/comments/201339.htmlhttp://www.shnenglu.com/sunicdavy/archive/2013/06/27/201339.html#Feedback0http://www.shnenglu.com/sunicdavy/comments/commentRss/201339.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/201339.html最q调试程序发现空指针老无法定? 使用一个最单的main函数做空指针查也一? 具体症状见图

    image

    pdb加蝲是正常的, 但是堆栈没显C如此简单的I指针访问位|? Google了以?/p>

    http://blogs.msdn.com/b/debugger/archive/2010/05/12/visual-studio-debugger-fails-to-catch-unhandled-exception-for-a-windows-form-or-wpf-application.aspx

    解决Ҏ(gu): Debug->Exception中将所有异常勾选即?/p>

     

    不知道哪里的讄D如此诡异的问? 害的我重装一?.



    战魂筑 2013-06-27 11:05 发表评论
    ]]>
    D闪退的根源cocos2dx的^台实现大?/title><link>http://www.shnenglu.com/sunicdavy/archive/2013/06/14/201007.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Fri, 14 Jun 2013 09:15:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2013/06/14/201007.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/201007.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2013/06/14/201007.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/201007.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/201007.html</trackback:ping><description><![CDATA[<p>最q将cocos2dx的程序移植到Android? 某阶D늪然发现开始闪退. 日志方式跟了很久, 发现有内存被修改. 因ؓ不能像VC那样有内存断? 只有靠日志l跟t? l了很久, l于发现一个问?/p> <p>CCApplication::sharedApplication()->run(); 在Windows下除了初始化回调? q有Windowsq_Ҏ(gu)的消息@? 既然是@? q个run函数会一直阻塞到E序退? 因此我自然的在run后添加自q资源卸蝲</p> <p>换到Android上呢CCApplication::sharedApplication()->run();的实现变? ׃Android上没有Windows的消息@? 所有事仉是通过java方式的事仉知. 因此CCApplication::sharedApplication()->run();变成了非d, 可是我在run后添加了资源卸蝲. l果Dpȝ刚初始化卸载了资源, 内存直接不可? D后面cocos2dx的API部分使用无问? 而自己引擎的API调用闪退.</p> <p>cocos2dx的这个run函数命名有严重问?. 被坑了好? q一直怀疑NDK内存理是否有特D之? D不?.</p><img src ="http://www.shnenglu.com/sunicdavy/aggbug/201007.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2013-06-14 17:15 <a href="http://www.shnenglu.com/sunicdavy/archive/2013/06/14/201007.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>最便捷的Android环境部vcocos2dxE序http://www.shnenglu.com/sunicdavy/archive/2013/06/09/200904.html战魂筑战魂筑Sun, 09 Jun 2013 09:55:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2013/06/09/200904.htmlhttp://www.shnenglu.com/sunicdavy/comments/200904.htmlhttp://www.shnenglu.com/sunicdavy/archive/2013/06/09/200904.html#Feedback0http://www.shnenglu.com/sunicdavy/comments/commentRss/200904.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/200904.html本文整个部vq程无需下蝲及安装用Cygwin环境Q?以下部vq程需要用到的E序及版?

    h意下载对应你pȝ的版? 64位系l请保证后文全系使用64位程? 以免遇到不必要的ȝ

    1.JDK&JRE       JAVAq行时及开发包

    2.ADT               是Eclipse的一个插Ӟq一步是Z理安卓开发库

    http://developer.android.com/sdk/index.html

    作ؓ新手, 请下载ADT Bundle For Windows, q个版本已经包含

    ADKQ安卓开发包Q? CDTQEclipse的C/C++开发插Ӟ及对应的Eclipse, 可以避免W一ơ部|出现的各种烦心!

    3.NDK              只有ADT已经可以q行普通的AndriodE序Q但是如果需要编译C/C++E序Q?q需要NDK

    http://developer.android.com/tools/sdk/ndk/index.html

    4. cocos2dx 2.0.4版本

     

    准备SDK API

    下蝲好ADT后解压, 有如下目?/p>

    eclipse\      <- 开发环?/p>

    sdk\           <- Andriod SDK

    SDK Manager.exe     <-- Android开发包理? ׃Andriod版本较多, 所以此理器可以方便开发者选择部v目标机器

    打开SDK Manager在Android 2.2(API 8)里的 SDK Platform, Google APIs前打? 点击右下角的Instal packages

    如果感觉下蝲速度? 可以ULq里http://my.oschina.net/heguangdong/blog/17443, 选择Andriodȝ下蝲

    q里是下载链?/p>

    http://dl-ssl.google.com/android/repository/google_apis-8_r02.zip

    http://dl-ssl.google.com/android/repository/android-2.2_r02-windows.zip

    https://dl-ssl.google.com/android/repository/usb_driver_r04-windows.zip

    把android开头的文g解压到platforms目录?/p>

    把goole_apis开头的文g解压到add-ons目录?/p>

    把usb_driver_r03-windows.zip解压到usb_driver目录下?/p>

    Eclipse导入工程

    打开Eclipse

    导入Cocos2dx例子工程:

    Eclipse中File->New->Other...选择Andriod Project from Existing Code

    在Import Projects的Root Directory中导入D:\Develop\RevWar\sdk\cocos2d-2.0-x-2.0.4\samples\HelloCpp\proj.android\

    注意, 不要选中 Copy project into workspace, 否则路径~ؕ很难~译成功

     

    导入cocos2dx的java框架

    在src目录中new package, 输入org.cocos2dx.lib, 在org.cocos2dx.lib的package中点Import-> FileSystem

    选中目录D:\Develop\RevWar\sdk\cocos2d-2.0-x-2.0.4\cocos2dx\platform\android\java\src\org\cocos2dx\lib\, 炚w所有java文g

    工程Properties->Builder->New->Program

    在Main标签中填?/strong>

    填写NDK~译命o?D:\Develop\android-ndk-r8e\ndk-build.cmd

    点击Browser Workspace选中当前工程,出现${workspace_loc:/HelloCpp}

    切换到Environment标签中填?/strong>

    新徏NDK_MODULE_PATH 填写D:\Develop\RevWar\sdk\cocos2d-2.0-x-2.0.4\;D:\Develop\RevWar\sdk\cocos2d-2.0-x-2.0.4\cocos2dx\platform\third_party\android\prebuilt\

    修改cocos2dx的Android.mk, diff如下

    @@ -153,6 +153,7 @@

    LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static

    LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libxml2_static

    LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libtiff_static

    +LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static

    # define the macro to compile through support/zip_support/ioapi.c              

    LOCAL_CFLAGS := -DUSE_FILE32API

    @@ -164,3 +165,4 @@

    $(call import-module,libpng)

    $(call import-module,libxml2)

    $(call import-module,libtiff)

    +$(call import-module,CocosDenshion/android)

    F&Q

    andriod-8问题

    修改D:\Develop\RevWar\sdk\cocos2d-2.0-x-2.0.4cocos2dx\platform\android\java\project.properties中的target=android-8Ҏ(gu)你需要的版本

    resources.ap_ does not exist

    assert目录中有资源出问? 排查卛_

    例如: cocos2d-2.0-x-2.0.4\samples\TestCpp\proj.android\assets\Images\*.pvr.gz

    启动Android模拟器时的Failed to allocate memory: 8问题

    调整内存?h内存太大D

    api版本q低DJAVA Symbol未定义问?/strong>

    setEGLContextClientVersion undefined

    api8(andriod 2.2)后的版本, 才支持openGL es 2.0

    自己做工E遇到的问题D:\Develop\RevWar\sdk\cocos2d-2.0-x-2.0.4\/cocos2dx/platform/android/jni/JniHelper.h:28:18: fatal error: string: No such file or directory

    cocos2dx例子中的Application.mk拯? 修改下内部名U即?/p>

    调试请尽量用真? 模拟器速度很慢

    米2默认只能理文g, 无法用adb q接, 因此需要安装驱? USB驱动直接在插入电(sh)脑后的虚拟盘里找.. q个太坑?.

    保证每次都能部v最新的E序

    h行每ơClean, Build project, Debug.  真机上在需要时, 会弹出安?..

    Android启动日志

    带有ADT的Eclipse中有一个logcatH口, 里面有系l及E序本n的日? 可以做过?方便查问? 如需自己打日? 可以使用cocos2dx中的LOGD宏来? 原型是__android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)

     

    Remark

    dassert? F5h后再~译
    NDK build?默认从工E的jni目录开?

    Andriod.mk的import 原则$(call import-module,模块? q里的模块名必须与目录名, 模块make file中的名称报纸一?

    参考文?/strong>

    http://www.cnblogs.com/ybgame/archive/2012/06/07/2540693.html

    发文? Andriod Studio已经发布了一D|? 虽然是测试版, 但将代表未来更方便的Andriod发布工具



    战魂筑 2013-06-09 17:55 发表评论
    ]]>
    捕获LinuxD错?Segment fault)q且打印错误堆栈http://www.shnenglu.com/sunicdavy/archive/2012/12/29/196809.html战魂筑战魂筑Sat, 29 Dec 2012 09:53:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2012/12/29/196809.htmlhttp://www.shnenglu.com/sunicdavy/comments/196809.htmlhttp://www.shnenglu.com/sunicdavy/archive/2012/12/29/196809.html#Feedback3http://www.shnenglu.com/sunicdavy/comments/commentRss/196809.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/196809.htmlLinux上跑服务器如果遇到程序崩溃是一件很苦恼的事? 再碰到重现很隄BUG, 估计只能通过传统的排查方法进?

    在编写本文前, W者用过诸如libunwind{库q行错误时堆栈打? 但是其本w由于需要引用第三方? 使用q是E微ȝ.

    l过Google? 居然扑ֈ一?a >好文, 光过捕获SIGSEGV信号, q迫使程序进入gdb调试阶段, 利用gdb强大的调试功能可以进行各U错误跟t? 此法已与Windows下程序崩溃后弹出VC调试几乎接近.

    我在此文基础? 扩展了其通用性及便利?/p>

    1. 使用gdb?-ex参数, 在挂接程序后, 执行bt指o打出E序堆栈

    2. 信息重定向到自定义的文?在多q程都需要进行后台输出时带来更大的灵zL? 同时也解决了gdb只能在前台调试的问题

    代码如下

    #include <stdio.h>
    #include <stdlib.h>
    #include <signal.h>
    #include <string.h>
    
    void dump(int signo)
    {
            char buf[1024];
            char cmd[1024];
            FILE *fh;
    
            snprintf(buf, sizeof(buf), "/proc/%d/cmdline", getpid());
            if(!(fh = fopen(buf, "r")))
                    exit(0);
            if(!fgets(buf, sizeof(buf), fh))
                    exit(0);
            fclose(fh);
            if(buf[strlen(buf) - 1] == '/n')
                    buf[strlen(buf) - 1] = '/0';
            snprintf(cmd, sizeof(cmd), "gdb %s %d -ex=bt > ./a.txt", buf, getpid());
            system(cmd);
    
            exit(0);
    }

    在服务器开启时,d signal(SIGSEGV, &dump ); q行信号处理挂接卛_

     

     

    引用: http://blog.csdn.net/kakaka2011/article/details/6597857  作? kakaka2011



    战魂筑 2012-12-29 17:53 发表评论
    ]]>
    让VC调试器正显CUTF-8字符?/title><link>http://www.shnenglu.com/sunicdavy/archive/2012/02/14/165566.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Tue, 14 Feb 2012 07:21:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2012/02/14/165566.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/165566.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2012/02/14/165566.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/165566.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/165566.html</trackback:ping><description><![CDATA[<p>默认? VC调试器只能正常显CANSI字符串及UNICODE字符? 而UTF-8字符串及其他格式则无法显C?/p> <p>q里无需~写插g及修攚w|文?只需要将要显C的字符串拉到Watch?q在变量后面d,s8卛_昄</p> <p><a href="http://www.shnenglu.com/images/cppblog_com/sunicdavy/Windows-Live-Writer/165611ed03f8_D62F/image_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.shnenglu.com/images/cppblog_com/sunicdavy/Windows-Live-Writer/165611ed03f8_D62F/image_thumb_1.png" width="233" height="42"></a> --> <a href="http://www.shnenglu.com/images/cppblog_com/sunicdavy/Windows-Live-Writer/165611ed03f8_D62F/image_2.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.shnenglu.com/images/cppblog_com/sunicdavy/Windows-Live-Writer/165611ed03f8_D62F/image_thumb.png" width="173" height="51"></a></p> <p>同样cd的功能也应该很熟(zhn)?/p> <p>,数字  变量拆分ؓ数组昄, 数字是要昄多少? 此法对const char*q类原始字符串非常有?/p> <p>,x 16q制查看</p> <p>,hr  查看Windows HRESULT解释</p> <p>,wm Windows消息,例如0x0010, wm 昄 WM_CLOSE</p><img src ="http://www.shnenglu.com/sunicdavy/aggbug/165566.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2012-02-14 15:21 <a href="http://www.shnenglu.com/sunicdavy/archive/2012/02/14/165566.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC中用SetThreadName引v的线E死?/title><link>http://www.shnenglu.com/sunicdavy/archive/2011/10/12/158109.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Wed, 12 Oct 2011 01:50:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2011/10/12/158109.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/158109.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2011/10/12/158109.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/158109.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/158109.html</trackback:ping><description><![CDATA[<p>我在工程里用以下函数给U程讄一个方便调试的名称</p> <div id="wgqpzjt" class="csharpcode"><pre class="alt"> typedef <span id="rmdqaoy" class="kwrd">struct</span> tagTHREADNAME_INFO</pre><pre> {</pre><pre class="alt"> DWORD dwType; <span id="escivue" class="rem">// must be 0x1000</span></pre><pre> LPCSTR szName; <span id="qtwkuto" class="rem">// pointer to name (in user addr space)</span></pre><pre class="alt"> DWORD dwThreadID; <span id="uionmlv" class="rem">// thread ID (-1=caller thread)</span></pre><pre> DWORD dwFlags; <span id="cupkues" class="rem">// reserved for future use, must be zero</span></pre><pre class="alt"> } THREADNAME_INFO;</pre><pre> </pre><pre class="alt"> <span id="uevxdyt" class="kwrd">void</span> SetThreadName( DWORD dwThreadID, LPCSTR szThreadName )</pre><pre> {</pre><pre class="alt"> THREADNAME_INFO info;</pre><pre> info.dwType = 0x1000;</pre><pre class="alt"> info.szName = szThreadName;</pre><pre> info.dwThreadID = dwThreadID;</pre><pre class="alt"> info.dwFlags = 0;</pre><pre> </pre><pre class="alt"> <span id="jbpvxsg" class="rem">// Visit http://www.shnenglu.com/sunicdavy for original article</span></pre><pre> __try</pre><pre class="alt"> {</pre><pre> RaiseException( 0x406D1388, 0, <span id="fisjakj" class="kwrd">sizeof</span>(info)/<span id="jbsuaou" class="kwrd">sizeof</span>(DWORD), (DWORD*)&info );</pre><pre class="alt"> }</pre><pre> __except(EXCEPTION_CONTINUE_EXECUTION)</pre><pre class="alt"> {</pre><pre> <span id="lavbwku" class="kwrd">int</span> a =1;</pre><pre class="alt"> }</pre><pre> }</pre></div> <style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <p>使用期间一直正? 随着工程需求变?我需?strong>频繁?/strong>一个被命名的线E创建工作一D|间后<strong>马上l束释放资源q新创?/strong>,出现了死锁问?/p> <p>死锁L发生在主U程的Sleep或者是SetEvent两个WindowsAPI函数. 而且仅仅在Visual Studio 2008里调试时会发生死?q调试环境一切正?</p> <p>我开始打日志调试, l果发现死锁前能够正常创建线E?但是U程函数Ҏ(gu)没有调用q入.之后在ȝESleep处死锁了.</p> <p>׃SetThreadName没有使用正规的API接口,而是使用抛异常方? 而且U程名称应该只在Visual Studio IDE中才能显C? MSDN对RaiseException的描q里也有说明可以使用<b>WaitForDebugEvent</b>接收应用E序抛得异常.因此可以推断是SetThreadName造成的问? 屏蔽SetThreadName,试通过</p><img src ="http://www.shnenglu.com/sunicdavy/aggbug/158109.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2011-10-12 09:50 <a href="http://www.shnenglu.com/sunicdavy/archive/2011/10/12/158109.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[原创]怎样自动启动VC调试器调试被另外一个程序启动的E序http://www.shnenglu.com/sunicdavy/archive/2010/11/16/133823.html战魂筑战魂筑Tue, 16 Nov 2010 13:22:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2010/11/16/133823.htmlhttp://www.shnenglu.com/sunicdavy/comments/133823.htmlhttp://www.shnenglu.com/sunicdavy/archive/2010/11/16/133823.html#Feedback4http://www.shnenglu.com/sunicdavy/comments/commentRss/133823.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/133823.html调试中M遇到q样的情况,比如Q需要调试一个被另外一个进E启动的E序。最单的Ҏ(gu)莫过于直接在IDE中Attach到进E,但是q样的方法做一ơ还行。要是一直需要调试,~译后需要再调试Q就会让你抓狂?/p>

    qx安装有VC IDE的机器一定会到q样的情况:如果E序有crashQ会弹出一个JIT的调试对话框Q询问用何U调试器q行调试。这U情况同样会出现在用dump文g时。这个对话框也是我们今天需要用到的?/p>

    如果需要调试一个被另外q程启动的进E,那么需要让q个被启动的U程能启动调试器Q方法如下:

    假定我们需要调试的应用E序名称为myapp.exe

     

    1. 打开注册?/p>

    2. 在HKEY_LOCAL_MACHINE\Software\Microsoftware\Windows NT\CurrentVersion\Image File Execution Options中寻找myapp.exe文g?/p>

    3. 如果q个文g夹不存在Q那么就新徏一个,例如Qmyapp.exe

    4. 在文件夹里新Z个字W串键,名称为debuggerQgؓvsjitdebugger.exe

    5. 如果使用的不是VC调试器,那么需要在环境变量中添加这个exe的启动\?/p>

     

    q行你需要被调试的程序试试吧Q爽了吧Q?/p>

     

    转蝲h明此文来?战魂筑博客 http://www.shnenglu.com/sunicdavy



    战魂筑 2010-11-16 21:22 发表评论
    ]]>
    修改U程名称,q在VC调试器中昄http://www.shnenglu.com/sunicdavy/archive/2010/05/04/114342.html战魂筑战魂筑Tue, 04 May 2010 07:28:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2010/05/04/114342.htmlhttp://www.shnenglu.com/sunicdavy/comments/114342.htmlhttp://www.shnenglu.com/sunicdavy/archive/2010/05/04/114342.html#Feedback0http://www.shnenglu.com/sunicdavy/comments/commentRss/114342.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/114342.html
    #define MS_VC_EXCEPTION 0x406d1388
     
    typedef struct tagTHREADNAME_INFO
    {
        DWORD dwType;        // must be 0x1000
        LPCSTR szName;       // pointer to name (in same addr space)
        DWORD dwThreadID;    // thread ID (-1 caller thread)
        DWORD dwFlags;       // reserved for future use, most be zero
    } THREADNAME_INFO;
     
    void SetThreadName(DWORD dwThreadID, LPCTSTR szThreadName)
    {
        THREADNAME_INFO info;
        info.dwType = 0x1000;
        info.szName = szThreadName;
        info.dwThreadID = dwThreadID;
        info.dwFlags = 0;
     
        __try
        {
            RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD),
    (DWORD *)&info);
        }
        except (EXCEPTION_CONTINUE_EXECUTION)
        {
        }
    }

     

    U程名称限制?个ANSI字符?调用q个函数?触发一个调试器异常,VC调试器将会把字符串设|ؓU程名称,q在调试器中昄



    战魂筑 2010-05-04 15:28 发表评论
    ]]>
    CRT未构造全局对象问题http://www.shnenglu.com/sunicdavy/archive/2010/04/23/113358.html战魂筑战魂筑Fri, 23 Apr 2010 09:47:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2010/04/23/113358.htmlhttp://www.shnenglu.com/sunicdavy/comments/113358.htmlhttp://www.shnenglu.com/sunicdavy/archive/2010/04/23/113358.html#Feedback6http://www.shnenglu.com/sunicdavy/comments/commentRss/113358.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/113358.html引擎中的每个工程均以静态库方式链接到最后的exe. 代码中包含有静态类成员,W一ơ运行正?后面不知什么原? q些静态类成员不会被初始化, ?crtexec.c 的CRT 初始化全局cL员函?/p>

    static void __cdecl _initterm (
    #endif  /* CRTDLL */
            _PVFV * pfbegin,
            _PVFV * pfend
            )
    {
            /*
             * walk the table of function pointers from the bottom up, until
             * the end is encountered.  Do not skip the first entry.  The initial
             * value of pfbegin points to the first valid entry.  Do not try to
             * execute what pfend points to.  Only entries before pfend are valid.
             */
            while ( pfbegin < pfend )
            {
                /*
                 * if current table entry is non-NULL, call thru it.
                 */
                if ( *pfbegin != NULL )
                    (**pfbegin)();
                ++pfbegin;
            }
    }

     

     

    q个函数会初始化所有链接到exe中的全局函数构? 跟踪q个地方, 发现,只有1个lib中的能被正确调用,但是出问题的那个lib中所有构造都不能被调? 试调整~译序无果

    唯一的方法只有修Ҏ(gu)构ؓ在winmain内进行构?/p>

    如果有这斚w调试l验的同学可以回?谢谢



    战魂筑 2010-04-23 17:47 发表评论
    ]]>
    C/C++ 语句{__asm int 3;} 能在VC下编译的q么Q?/title><link>http://www.shnenglu.com/sunicdavy/archive/2010/02/24/108353.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Wed, 24 Feb 2010 09:11:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2010/02/24/108353.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/108353.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2010/02/24/108353.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/108353.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/108353.html</trackback:ping><description><![CDATA[<p>今天在写一个宏时始l报</p> <p>fatal error C1075: end of file found before the left brace '{' at 'd:\xxx.cpp(49)' was matched</p> <p>查排除代码,去除了宏Q留下了一?/p> <p>{__asm int 3;} </p> <p>大括号LQ能~译成功。去?也能~译成功</p> <p>我就奇了怪了Q查了MSDN文档Q里面是q么写的Q?/p> <p>__asm <i>assembly-instruction</i> [ ; ] <p>__asm { <i>assembly-instruction-list</i> } [ ; ] <dl> <dt><i>asm-statement</i>: <dd> <p><b>__asm </b><i>assembly-instruction </i><b>;</b><sub>opt</sub> <p><b>__asm { </b><i>assembly-instruction-list </i><b>};</b><sub>opt</sub></p></dd></dl> <dl> <dt><i>assembly-instruction-list</i>: <dd> <p><i>assembly-instruction</i><b>;</b><sub>opt</sub> <p><i>assembly-instruction</i><b>;</b><i>assembly-instruction-list</i><b>;</b><sub>opt</sub></p></dd></dl> <p>也就是说 分号是可选的Q这个类glua</p> <p>不加分号也可以这样写</p><pre>__asm mov al, 2 __asm mov dx, 0xD007 __asm out dx, al</pre><pre> </pre><pre>于是乎,我想q成了一个VC的bug</pre><pre> </pre><pre>~译环境vs2008 c/c++</pre><img src ="http://www.shnenglu.com/sunicdavy/aggbug/108353.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2010-02-24 17:11 <a href="http://www.shnenglu.com/sunicdavy/archive/2010/02/24/108353.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Lua脚本点转整形bug分析http://www.shnenglu.com/sunicdavy/archive/2010/02/04/107161.html战魂筑战魂筑Thu, 04 Feb 2010 04:49:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2010/02/04/107161.htmlhttp://www.shnenglu.com/sunicdavy/comments/107161.htmlhttp://www.shnenglu.com/sunicdavy/archive/2010/02/04/107161.html#Feedback9http://www.shnenglu.com/sunicdavy/comments/commentRss/107161.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/107161.html前面一?a href="http://www.shnenglu.com/sunicdavy/archive/2010/02/04/107155.html">文章中lua出现的bugQ其实是lua本nl构问题D的:

    lua中,数g用double来存储,包含整Ş和double。而解析出来的整Ş也是被强转ؓdoubleq行存储Q这样就会出问题?/p>

    举一个简单的例子Q?/p>

    double f = (double)0xffffffff;
    int a = int(f);

    a肯定不是-1

    q里的文章说明这个类型{换问题的~由?/p>

     

    ?a >Squirrel脚本中就不会有这个问?/p>

    local a = 0xffffffff

    print( a )

    l果?1

    查看其源代码Q?/p>

    typedef union tagSQObjectValue
    {
        struct SQTable *pTable;
        struct SQArray *pArray;
        struct SQClosure *pClosure;
        struct SQGenerator *pGenerator;
        struct SQNativeClosure *pNativeClosure;
        struct SQString *pString;
        struct SQUserData *pUserData;
        SQInteger nInteger;
        SQFloat fFloat;
        SQUserPointer pUserPointer;
        struct SQFunctionProto *pFunctionProto;
        struct SQRefCounted *pRefCounted;
        struct SQDelegable *pDelegable;
        struct SQVM *pThread;
        struct SQClass *pClass;
        struct SQInstance *pInstance;
        struct SQWeakRef *pWeakRef;
        SQRawObjectVal raw;
    }SQObjectValue;

     

    可以看到

    SQInteger nInteger;
    SQFloat fFloat;

    是分开存储的,因此׃会有q个问题

     

    lua解决Ҏ(gu)Q?/p>

    1. 十六进制换?0q制存储

    2. {待大侠或者官方修改代码,做出patch



    战魂筑 2010-02-04 12:49 发表评论
    ]]>
    Lua在Release版本下的一个bughttp://www.shnenglu.com/sunicdavy/archive/2010/02/04/107155.html战魂筑战魂筑Thu, 04 Feb 2010 02:59:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2010/02/04/107155.htmlhttp://www.shnenglu.com/sunicdavy/comments/107155.htmlhttp://www.shnenglu.com/sunicdavy/archive/2010/02/04/107155.html#Feedback2http://www.shnenglu.com/sunicdavy/comments/commentRss/107155.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/107155.html最q将自己的UI工程在Release版下~译Q发现有部分控g的颜色居然偏黄,惛_液晶也不至于老化的那么厉宻I随机开始将工程加入调试信息q行跟踪Q排除UI工程Q及自己写的lua装问题Q将问题~小为:

    lua代码Q?/p>

    t = {}

    t.FillColor = 0xFFFFFFFF

    foo( t )

    在C++中注册一个foo函数Q然后获取table t中的FillColor成员

    发现取得的值居然ؓ0x80000000

     

    使用lua c api试代码

    lua_newtable( L );
    lua_setglobal( L, "t");

    lua_getglobal( L, "t");
    lua_pushstring(L,"FillColor");
    lua_pushinteger( L, 0xffffffff );
    lua_pushinteger( L, -1 );
    lua_settable( L, -3 );

    lua_getglobal( L, "t");
    lua_pushstring( L, "FillColor");
    lua_gettable( L, -2 );
    int t = lua_tointeger( L, -1 );

    l果t也是0x80000000

     

    然后十六进制的0xFFFFFFFF换成十进制的4294967295Q测试结果正显C?1

    再用几个样本测?

    0xFF5F5F5F = 4284440415 会被Ҏ(gu)0xFF5F5F00

     

    q个bug倒是很好解决Q将代码中的十六q制数全换ؓ10q制卛_。但是ؓ什么只在Release版本发生呢?

    本h使用的是lua 5.1.4 原生



    战魂筑 2010-02-04 10:59 发表评论
    ]]>
    一个C++标准库导致的错误http://www.shnenglu.com/sunicdavy/archive/2009/11/11/100712.html战魂筑战魂筑Wed, 11 Nov 2009 08:49:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2009/11/11/100712.htmlhttp://www.shnenglu.com/sunicdavy/comments/100712.htmlhttp://www.shnenglu.com/sunicdavy/archive/2009/11/11/100712.html#Feedback4http://www.shnenglu.com/sunicdavy/comments/commentRss/100712.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/100712.html    最q将代码调整为release版时Q碰到这样一个奇怪的错误Q直接运行程序,q没有进入main入口时就宕掉。这个exe工程链接q一个公用的静态库和一个底层功能的静态库。在debug版完全没有问题?/p>

        随即开始隔M码分析,当隔d一个承公用静态库Ӟ隔离后不会宕机。这表示静态库与exe之间的链接出了一些问题。再ơ观察挂掉的地方昄streambuf一cȝ东西Q这是包含在iostream里的东西Ql点d栈向上跟t。结果在wcout.cpp里发C

    __PURE_APPDOMAIN_GLOBAL static wfilebuf wfout(_cpp_stdout);

    所有问题迎刃而解Q应该是恶心的iostream的静态变量,在多重静态库链接时的错误Q导致exe启动QCRT为其分配内存时的宕机。马上屏蔽所有用过wcout及iostream的所有代码。release版正常运行,不再宕机



    战魂筑 2009-11-11 16:49 发表评论
    ]]>
    l典的C++内存分配Dcrash的案?/title><link>http://www.shnenglu.com/sunicdavy/archive/2009/09/03/95218.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Thu, 03 Sep 2009 08:10:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2009/09/03/95218.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/95218.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2009/09/03/95218.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/95218.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/95218.html</trackback:ping><description><![CDATA[ <p>今天qq某大侠问我,为啥他的代码会crash</p><pre class="csharpcode"><span id="vntojxp" class="kwrd">char</span>* pdata = <span id="cgqwjbp" class="kwrd">new</span> <span id="bntobeh" class="kwrd">char</span>(14245); ::memset( pdata, 0, 14245 ); </pre> <p>我马上运行代码,l果果真是Access Violent?/p> <p>之后试过malloc都没有问?/p> <p>随机我把q段代码删除Q过了几分钟后,我按照记忆,重新写下代码</p><pre class="csharpcode"><span id="uvqezqa" class="kwrd">char</span>* pdata = <span id="rdjlcqp" class="kwrd">new</span> <span id="widupzj" class="kwrd">char</span>[14245]; ::memset( pdata, 0, 14245 ); l果不crash了。细l一?/pre><pre class="csharpcode">?/pre><pre class="csharpcode">?/pre><pre class="csharpcode">?/pre><pre class="csharpcode"> </pre><pre class="csharpcode"> </pre><pre class="csharpcode"> </pre><pre class="csharpcode"> </pre><pre class="csharpcode"> </pre><pre class="csharpcode"> </pre><pre class="csharpcode">为啥要调用char的构造函C?4245的参数呢Q这样只能new出来1个字节,但是memset又写?4245个字节,不挂才有g</pre><pre class="csharpcode">之后问过很多人,基本都没看出来,可见q个写法极其骗h</pre><img src ="http://www.shnenglu.com/sunicdavy/aggbug/95218.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2009-09-03 16:10 <a href="http://www.shnenglu.com/sunicdavy/archive/2009/09/03/95218.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对C++ delete[] 一直忽略的问题http://www.shnenglu.com/sunicdavy/archive/2009/08/20/93934.html战魂筑战魂筑Thu, 20 Aug 2009 10:22:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2009/08/20/93934.htmlhttp://www.shnenglu.com/sunicdavy/comments/93934.htmlhttp://www.shnenglu.com/sunicdavy/archive/2009/08/20/93934.html#Feedback3http://www.shnenglu.com/sunicdavy/comments/commentRss/93934.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/93934.html    C++中用deleteq行单个对象的析构及内存删除Q用delete[]q行对象数组的析构及内存删除

        记得某次友h层说q,delete[]在Windowsq_上都是用HeapFree来实现的Q因此delete[]和delete来删除对象数l时都是一L(fng)。之后我也参考过很多的内存管理器及new/delete重蝲实现,基本都是q个道理?/p>

        最q突然发玎ͼ如果是对象数l的话,使用delete实能删除内存,但是对象数组中的每个对象的析构就不能被调用了。幸好^时一直都q是保持良好的C++习惯Q一直用delete[]Qƈ且用new[]大部分是charcdQ不需要析?/p>

    战魂筑 2009-08-20 18:22 发表评论
    ]]>
    lua库用经验一?/title><link>http://www.shnenglu.com/sunicdavy/archive/2009/07/20/90632.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Mon, 20 Jul 2009 08:20:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2009/07/20/90632.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/90632.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2009/07/20/90632.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/90632.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/90632.html</trackback:ping><description><![CDATA[ <p>今天部分工E从静态链接库改ؓ动态链接库Qƈ使用接口方式创徏Ӟ原来lua调用的地方居然挂掉了Q挂的地Ҏ(gu)table在清除时Qcrash在newkey</p> <p>google了一下,扑ֈ了一颇有参考h(hun)值的<a >文章</a></p> <p> </p><pre>A common error is to link C extension modules (shared libraries) with the static library. The linker command line for extension modules must not ever contain -llua or anything similar!</pre><pre>I.e. check your build process. If you are unsure where the two copies of the Lua core come from, grep the binaries for some characteristic error message, like "table index is nil".</pre><pre>我的lua装库是与lua源码一起封装在一个静态链接库提供l所有程序链接用。有些工E只?个dll或者exe单独链接Q不会出现问题。问题很大程度上发生于一个lua源码构成的库链接l多个dll或者exeQ或者؜杂链接,q样极易出现莫名其妙的table讉K到dummy_node的错误情?/pre><pre>因此Q马上调_试这个库改ؓdll。但是在一些模板函数偏特化上出C链接问题。最后发玎ͼ动态链接库完全是模板的噩耗,虽然模板函数是内联,对于全局的模板函敎ͼ其攑֜头文件中׃出现多重引用问题。因此放弃,lua5.1的源码放在一个dll中,封装库攑֜静态库中,q样qҎ(gu)有Q何问?/pre><img src ="http://www.shnenglu.com/sunicdavy/aggbug/90632.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2009-07-20 16:20 <a href="http://www.shnenglu.com/sunicdavy/archive/2009/07/20/90632.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>诡异的Visual Studio 的调试bughttp://www.shnenglu.com/sunicdavy/archive/2009/07/17/90351.html战魂筑战魂筑Fri, 17 Jul 2009 08:06:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2009/07/17/90351.htmlhttp://www.shnenglu.com/sunicdavy/comments/90351.htmlhttp://www.shnenglu.com/sunicdavy/archive/2009/07/17/90351.html#Feedback0http://www.shnenglu.com/sunicdavy/comments/commentRss/90351.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/90351.html 

    工程l构

    包含有静态库

    motion.lib 一个UI逻辑的库

    HGErender.lib  使用一个motion的接口实现的HGE渲染器,与motion.lib没有链接和依赖关p?/p>

    一个exe静态链接motion.lib和HGErender.lib

     

    motion中加入了一些flash支持Q将flash的包含放C预编译头文gQ这部分头文件exe是没有引用的

    表现症状

    exe可以正常q行Q但是在motion中新d的flashcd例化后无法看到成?/p>

    重编Q重新l(f)inkQ清I重~无?/p>

    换用vs2005Q依然无用,但是报了一个Error: error in OMF type information 错误

    解决Ҏ(gu)

    试flash包含到预~译头的文g攑ֈ对外包含中,让exe也能看到q一部分

    问题解决

    分析

    VS的调试系lƈ不是完全开发,因此我们只能从一些表象来分析一些调试器原理及行?/p>

    q个bug的原因就?作ؓ调试入口的exeq没有获得完全的motion里调试的信息。如果将motion作ؓdll加蝲Q理论分析不会出现这U问题。dll被作ؓ一个单独的调试入口Q需要单独加载独立的pdb?/p>

    本例中,静态库中的调试信息q没有链接到exeQ因此看不到成员的Q何信?/p>

    扩展

    大多数的游戏或应用程序都是用静态库来做链接Q这h论是~写q是代码安全都有所兼顾。但对于工程模块之间的互盔R,C/C++静态库本n的毛病(CRT内存分配及静态,全局变量问题Q就变得ؓ严重?/p>

    而用动态链接库的接口方式也是有一部分E序q样使用的,如果Z安全或者加密,可以动态链接库攑ֈ自己的包内,使用从内存读取dll的技术,q样安全Q工E架构又清晰



    战魂筑 2009-07-17 16:06 发表评论
    ]]>
    lua退出时内存删除的诡异异常及处理http://www.shnenglu.com/sunicdavy/archive/2009/06/20/88152.html战魂筑战魂筑Sat, 20 Jun 2009 02:47:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2009/06/20/88152.htmlhttp://www.shnenglu.com/sunicdavy/comments/88152.htmlhttp://www.shnenglu.com/sunicdavy/archive/2009/06/20/88152.html#Feedback0http://www.shnenglu.com/sunicdavy/comments/commentRss/88152.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/88152.html      最q在使用自己住的一套lua库用中遇到q样一个问题,多注册一个类成员函数后,即便一个lua文g都没加蝲Q都会在lua_close中的freestack函数中crash

          我的lua装非常单,支持C++cL员函数调用上也是在luaplus基础上改造而来的:

        void register_helper( lua_State* L, int tableindex, const char* funcname, lua_CFunction dispatcher, void* func, int sizeoffunc, const void* userdata, int sizeofud )
        {
            // function | userdata = lightuserdata
            unsigned char* buffer = (unsigned char*)lua_newuserdata( L, sizeoffunc + sizeofud );
            memcpy( buffer, (void*)func, sizeoffunc );
            memcpy( buffer + sizeoffunc, &userdata, sizeofud );
    
            lua_pushstring( L, funcname );
            lua_pushlightuserdata( L, (void*)buffer);  
            lua_pushcclosure(L, dispatcher, 1);
            lua_settable( L, tableindex );
        }
        
     

    查发玎ͼ貌似是lua_newuserdata的问题,其换ؓmallocQ问题解决了?/p>

    虽然支持google了一下类似的问题Qƈ且也在gc库内打过断点Qnew出来的内存绝非简单的被gc回收Q而有可能是lua某些机制造成的,毕竟q样lC++做绑定是很常见的

    马上做了一个list保存指针Qƈ在lua_close之前清除q些指针Q所有问题迎刃而解



    战魂筑 2009-06-20 10:47 发表评论
    ]]>
    断点无效到C++ 全局cL造规律研I?/title><link>http://www.shnenglu.com/sunicdavy/archive/2009/06/14/87619.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Sun, 14 Jun 2009 02:51:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2009/06/14/87619.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/87619.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2009/06/14/87619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/87619.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/87619.html</trackback:ping><description><![CDATA[ <p>最q遇C个vs2008 C++中断Ҏ(gu)法工作的问题Q具体表CؓQ? </p><p>1. 某个修改后,断点无法工作Q之前版本依然正? </p><p>2. 只是某个文g中断Ҏ(gu)法工? </p><p>3. 断点打在 引用另外DLL中的cd象A </p><p>文gl构Q? </p><p>Core.dll </p><p>A.cpp </p><pre class="csharpcode"><span id="pnizxwz" class="kwrd">class</span> A { <span id="ejiocma" class="kwrd">public</span>: A( ) { printf(<span id="zescmto" class="str">"constructor of a"</span>); } } </pre> <style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <pre class="csharpcode"> </pre> <style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <p>UI.dll </p><p>Manager.cpp </p><pre class="csharpcode"><span id="hmakjma" class="kwrd">class</span> Manager { <span id="ejpgqwo" class="kwrd">public</span>: Manager( ) { printf(<span id="glrtzui" class="str">"constructor of Manager"</span>); } } </pre> <style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <p>  </p><p>Button.cpp </p><p>A ins; // 断点打在q里 </p><p>Run.exe </p><pre class="csharpcode"><span id="ziscxwg" class="kwrd">void</span> main() { Manager ins; <span id="ndfarcp" class="rem">// 实例?</span> } </pre> <style type="text/css">.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> <p>q里发现<strong>AҎ(gu)不会被C runtime在执行main之前构?/strong>Q因此断Ҏ(gu)法打? </p><p>已经排除Ҏ(gu)字符影响的原因,按照|上的方法是Q将文g保存为UNICODEQ问题依? </p><p>开始用排除隔离法确定问题位|,最后发现这样一个规律: </p><p><strong>只要在Manager.cpp里构造一个Button </strong> </p><p><strong>Button insB; </strong> </p><p><strong>q样做了以后Q断定必定能起作用?</strong> </p><p>因此推断CRT层的全局构造是需要一个链表来推动? </p><p>因ؓManager需要构造,因此CRT肯定会扫描这个CPP对应OBJ链接到exe里的D,让这个段里的全局构造函数都初始化,但是Button因ؓ没有使用Q因此也不会构造。这样局部扫描应该是Z效率. </p><p>解决q个问题q有一个方法就是全部用静态链接方式,q样构造代码都攑ֈ最后的exe中,׃会出现这L(fng)问题 </p><img src ="http://www.shnenglu.com/sunicdavy/aggbug/87619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2009-06-14 10:51 <a href="http://www.shnenglu.com/sunicdavy/archive/2009/06/14/87619.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>破解VC的断点保存位|?/title><link>http://www.shnenglu.com/sunicdavy/archive/2009/06/10/87346.html</link><dc:creator>战魂筑</dc:creator><author>战魂筑</author><pubDate>Wed, 10 Jun 2009 09:36:00 GMT</pubDate><guid>http://www.shnenglu.com/sunicdavy/archive/2009/06/10/87346.html</guid><wfw:comment>http://www.shnenglu.com/sunicdavy/comments/87346.html</wfw:comment><comments>http://www.shnenglu.com/sunicdavy/archive/2009/06/10/87346.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/sunicdavy/comments/commentRss/87346.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/sunicdavy/services/trackbacks/87346.html</trackback:ping><description><![CDATA[ <p>一直不是很清除VC的断点保存于何处Q让我们看几个证据: </p><ol style="margin-left: 90pt"><li>多h开发中Q经常更新别人的代码后,H然停在某个自己没打q的断点上,我们l称之ؓ附送断炏V? </li><li>q且无论VSSq是SVN{代码管理工具都会出q样的问题。但是你提交的只有代码,没有其他单独的配|文? </li><li>VC2005中,即便打过SP1Q也会碰到某个文件突然无法打断点的BUGQ排除没有重~,打错文g断点{低U错误)Q解军_法是Q打开C本,这个文件的代码全部_脓(chung)到记事本Q再帖回? </li><li>VB中的代码文gQ用记事本打开Ӟ可以看到比IDE里看到更多的配置型代? </li></ol><p>lg所qͼ基本可以断定VC的断点被保存于代码的N的某个位|,看不见的一些字W?/p><img src ="http://www.shnenglu.com/sunicdavy/aggbug/87346.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/sunicdavy/" target="_blank">战魂筑</a> 2009-06-10 17:36 <a href="http://www.shnenglu.com/sunicdavy/archive/2009/06/10/87346.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>韩文操作pȝ中输入中文的问题http://www.shnenglu.com/sunicdavy/archive/2009/05/20/83451.html战魂筑战魂筑Wed, 20 May 2009 03:32:00 GMThttp://www.shnenglu.com/sunicdavy/archive/2009/05/20/83451.htmlhttp://www.shnenglu.com/sunicdavy/comments/83451.htmlhttp://www.shnenglu.com/sunicdavy/archive/2009/05/20/83451.html#Feedback2http://www.shnenglu.com/sunicdavy/comments/commentRss/83451.htmlhttp://www.shnenglu.com/sunicdavy/services/trackbacks/83451.html    最q聊天系l测Z个问题:试人员使用的是韩文操作pȝQ在上面安装了搜狗中文输入法。他们互怹间发送韩文聊天是没有q的,但是我们和他们互总中文发送时Q会出现q情况。随卌行测试发C下问题:

        对于 "德国"

        他们发送的~码数据?d3 ec 3f

        而我们的中文pȝ?b5 c2 b9 fa

        因ؓ聊天pȝ采用ANSI的架构,但是Z么同是东方语ap,一个会是UTF8,一个是ANSI双字节,因此聊天系l整体发送换成纯UNICODEq行试



    战魂筑 2009-05-20 11:32 发表评论
    ]]>
    þۺɫˮ99ž| þùһƬѹۿ| avttþþƷ| ҹƷƬþ| þĻר| ͵͵þþþվ| 99þþƷ⿴һ| þ99Ʒŷ| þˬˬav| þþþAVר| ݺݾƷþþĻ | 2021ƷþþƷ| Ʒݾþþþ| þۺɫһ | þӰӹ| þùƷӰԺ| þþþƷ| ٸ޾þþþþ4| þþþavר| þĻר| һձþþ| ۺϾƷ㽶þ| ŷ龫Ʒþþþþ| ɫۺϾþ۾Ʒ| þþһƷ99þþƷ88| ɫۺϾþ| þ91ƷۺϹҳ| ˬˬƬaþ| þþƷAV鶹վ | Ʒþ»| þþþһƷ޹ۺAV| ޾ƷþרӰҵ| þۺϳDž| þþƷ99þ˿| ݺɫ˾þþƷۺ| 99þþù| ɫۺϾþۺ| Ʒþþþ龫Ʒ| þ޹ŷ޾Ʒһ| þۺϾɫۺϾƷ| þþùƷ|