久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <tfoot id='6AUPe'></tfoot>

        <legend id='6AUPe'><style id='6AUPe'><dir id='6AUPe'><q id='6AUPe'></q></dir></style></legend>
        <i id='6AUPe'><tr id='6AUPe'><dt id='6AUPe'><q id='6AUPe'><span id='6AUPe'><b id='6AUPe'><form id='6AUPe'><ins id='6AUPe'></ins><ul id='6AUPe'></ul><sub id='6AUPe'></sub></form><legend id='6AUPe'></legend><bdo id='6AUPe'><pre id='6AUPe'><center id='6AUPe'></center></pre></bdo></b><th id='6AUPe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6AUPe'><tfoot id='6AUPe'></tfoot><dl id='6AUPe'><fieldset id='6AUPe'></fieldset></dl></div>
        • <bdo id='6AUPe'></bdo><ul id='6AUPe'></ul>

        <small id='6AUPe'></small><noframes id='6AUPe'>

      1. 如何使用 MinGW gdb 調試器在 Windows 中調試 C++ 程序

        How do I use the MinGW gdb debugger to debug a C++ program in Windows?(如何使用 MinGW gdb 調試器在 Windows 中調試 C++ 程序?)
        <tfoot id='oAwYf'></tfoot>

            <tbody id='oAwYf'></tbody>
          <legend id='oAwYf'><style id='oAwYf'><dir id='oAwYf'><q id='oAwYf'></q></dir></style></legend>
        1. <small id='oAwYf'></small><noframes id='oAwYf'>

              <i id='oAwYf'><tr id='oAwYf'><dt id='oAwYf'><q id='oAwYf'><span id='oAwYf'><b id='oAwYf'><form id='oAwYf'><ins id='oAwYf'></ins><ul id='oAwYf'></ul><sub id='oAwYf'></sub></form><legend id='oAwYf'></legend><bdo id='oAwYf'><pre id='oAwYf'><center id='oAwYf'></center></pre></bdo></b><th id='oAwYf'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='oAwYf'><tfoot id='oAwYf'></tfoot><dl id='oAwYf'><fieldset id='oAwYf'></fieldset></dl></div>

                  <bdo id='oAwYf'></bdo><ul id='oAwYf'></ul>
                  本文介紹了如何使用 MinGW gdb 調試器在 Windows 中調試 C++ 程序?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  限時送ChatGPT賬號..

                  我已經查找了有關此的文檔,但一無所獲.我安裝了 MinGW,效果很好.我只是不知道如何使用調試器.

                  I have looked for documentation on this and found nothing. I have MinGW installed and it works great. I just don't know how to use the debugger.

                  給定一些簡單的代碼,比如在一個名為mycode.cpp"的文件中:

                  Given some simple code, say in a file called "mycode.cpp":

                  int main()
                  {
                      int temp = 0;
                  
                      for (int i = 0; i < 5; ++i)
                          temp += i;
                  
                      return 0;
                  }
                  

                  ...我將如何調試它.我在 Windows 中使用 MinGW 和 GDB 調試代碼的命令是什么?我可以像在 Visual Studio 中一樣通過命令行單步執行代碼嗎?如果是這樣,我使用什么命令來做到這一點?

                  ...how would I debug this. What are the commands that I use to debug code with MinGW and GDB in windows? Can I step through the code via the command line like in Visual Studio? If so what commands do I use to do that?

                  是否有使用 GDB 的教程?我找不到任何東西,但如果有人能指導我找到一個,那也太棒了.我厭倦了編寫大量 std::cout 語句來調試復雜代碼.

                  Are there any tutorials for using GDB out there? I couldn't find any, but if anyone could direct me to one that would be great too. I'm tired of writing tons of std::cout statements to debug complex code.

                  推薦答案

                  第一步是使用 -g 編譯您的程序,以在可執行文件中包含調試信息:

                  The first step is to compile your program with -g to include debugging information within the executable:

                  g++ -g -o myprog.exe mycode.cpp
                  

                  然后程序就可以加載到gdb中:

                  Then the program can be loaded into gdb:

                  gdb myprog.exe
                  

                  一些讓您入門的命令:

                  • break main 將在調用 main 時導致調試器中斷.您還可以使用 break FILENAME:LINENO 中斷代碼行.例如,只要程序到達 mycode.cpp 的第 4 行,break mycode.cpp:4 就會中斷執行.
                  • start 啟動程序.在您的情況下,您需要在啟動程序之前設置斷點,因為它會快速退出.
                  • break main will cause the debugger to break when main is called. You can also break on lines of code with break FILENAME:LINENO. For example, break mycode.cpp:4 breaks execution whenever the program reaches line 4 of mycode.cpp.
                  • start starts the program. In your case, you need to set breakpoints before starting the program because it exits quickly.

                  在斷點處:

                  • 打印 VARNAME.這就是您打印變量值的方式,無論是局部的、靜態的還是全局的.例如,在 for 循環中,您可以鍵入 print temp 以打印出 temp 變量的值.
                  • step 這相當于步入".
                  • nextadv +1 前進到下一行(如step over").您還可以使用例如 adv mycode.cpp:8 前進到特定文件的特定行.
                  • bt 打印回溯.這本質上是一個堆棧跟蹤.
                  • continue 與可視化調試器的繼續"操作完全一樣.它使程序繼續執行,直到下一個斷點或程序退出.
                  • print VARNAME. That's how you print values of variables, whether local, static, or global. For example, at the for loop, you can type print temp to print out the value of the temp variable.
                  • step This is equivalent to "step into".
                  • next or adv +1 Advance to the next line (like "step over"). You can also advance to a specific line of a specific file with, for example, adv mycode.cpp:8.
                  • bt Print a backtrace. This is a stack trace, essentially.
                  • continue Exactly like a "continue" operation of a visual debugger. It causes the program execution to continue until the next break point or the program exits.

                  最好閱讀GDB 用戶手冊.

                  這篇關于如何使用 MinGW gdb 調試器在 Windows 中調試 C++ 程序?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Why do two functions have the same address?(為什么兩個函數的地址相同?)
                  Why the initializer of std::function has to be CopyConstructible?(為什么 std::function 的初始化程序必須是可復制構造的?)
                  mixing templates with polymorphism(混合模板與多態性)
                  When should I use the keyword quot;typenamequot; when using templates(我什么時候應該使用關鍵字“typename?使用模板時)
                  Dependent name resolution amp; namespace std / Standard Library(依賴名稱解析命名空間 std/標準庫)
                  gcc can compile a variadic template while clang cannot(gcc 可以編譯可變參數模板,而 clang 不能)
                    <tbody id='SBLGY'></tbody>
                    <tfoot id='SBLGY'></tfoot>

                  1. <i id='SBLGY'><tr id='SBLGY'><dt id='SBLGY'><q id='SBLGY'><span id='SBLGY'><b id='SBLGY'><form id='SBLGY'><ins id='SBLGY'></ins><ul id='SBLGY'></ul><sub id='SBLGY'></sub></form><legend id='SBLGY'></legend><bdo id='SBLGY'><pre id='SBLGY'><center id='SBLGY'></center></pre></bdo></b><th id='SBLGY'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='SBLGY'><tfoot id='SBLGY'></tfoot><dl id='SBLGY'><fieldset id='SBLGY'></fieldset></dl></div>

                    • <small id='SBLGY'></small><noframes id='SBLGY'>

                      <legend id='SBLGY'><style id='SBLGY'><dir id='SBLGY'><q id='SBLGY'></q></dir></style></legend>

                          <bdo id='SBLGY'></bdo><ul id='SBLGY'></ul>

                            主站蜘蛛池模板: 亚洲综合色丁香婷婷六月图片 | 午夜影院在线免费观看视频 | 九色网址 | 亚洲图片视频一区 | h视频在线观看免费 | 亚洲综合色 | 精品视频国产 | 久久99久久久久 | 久久精品久久久 | 一区二区三区高清不卡 | 蜜臀久久99精品久久久久久宅男 | 涩涩视频在线观看免费 | 一区中文字幕 | 精品国产乱码久久久久久丨区2区 | 欧美视频日韩 | 国产美女久久 | 亚洲国产精品久久久 | 欧美日韩国产一区二区三区 | 草樱av| 国产羞羞视频在线观看 | 中文字幕在线精品 | 日本不卡一区二区三区 | 男女视频在线观看网站 | 一区二区三区四区日韩 | 欧美日韩国产传媒 | 国产片侵犯亲女视频播放 | 欧美激情精品久久久久 | 国产精品三级 | 久久国产精品99久久久久久丝袜 | 日本精品视频一区二区三区四区 | 免费在线观看一区二区三区 | 天天拍天天插 | 成人超碰| 久久综合一区二区三区 | 欧美网址在线观看 | 亚洲一区二区三区免费在线观看 | 欧美精品一区二区三区在线 | 国产在线视频网 | 自拍第一页 | 久久久久九九九女人毛片 | 欧美精品一二三 |