<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # 調試子進程 ## 例子 #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { pid_t pid; pid = fork(); if (pid < 0) { exit(1); } else if (pid > 0) { exit(0); } printf("hello world\n"); return 0; } ## 技巧 在調試多進程程序時,gdb默認會追蹤父進程。例如: (gdb) start Temporary breakpoint 1 at 0x40055c: file a.c, line 8. Starting program: /data2/home/nanxiao/a Temporary breakpoint 1, main () at a.c:8 8 pid = fork(); (gdb) n 9 if (pid < 0) (gdb) hello world 13 else if (pid > 0) (gdb) 15 exit(0); (gdb) [Inferior 1 (process 12786) exited normally] 可以看到程序執行到第15行:父進程退出。 如果要調試子進程,要使用如下命令:“set follow-fork-mode child”,例如: (gdb) set follow-fork-mode child (gdb) start Temporary breakpoint 1 at 0x40055c: file a.c, line 8. Starting program: /data2/home/nanxiao/a Temporary breakpoint 1, main () at a.c:8 8 pid = fork(); (gdb) n [New process 12241] [Switching to process 12241] 9 if (pid < 0) (gdb) 13 else if (pid > 0) (gdb) 17 printf("hello world\n"); (gdb) hello world 18 return 0; 可以看到程序執行到第17行:子進程打印“hello world”。 這個命令目前Linux支持,其它很多操作系統都不支持,使用時請注意。參見[gdb手冊](https://sourceware.org/gdb/onlinedocs/gdb/Forks.html) ## 貢獻者 nanxiao
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看