【问题标题】:gdb debug error (exit code 134 (0x86) on MacOS (11.2.3))gdb 调试错误(MacOS (11.2.3) 上的退出代码 134 (0x86))
【发布时间】:2021-06-15 20:25:48
【问题描述】:

到目前为止,我在 Windows 上使用 gdb 没有任何问题。现在我已经切换到 MacOS。 成功遵循指南 (https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html) 后,通过 VS Code 进行调试时,我收到错误退出代码 134 (0x86)。

使用 Big Sur 11.2.3 和 VSCode 1.54.3、gdb 10.1

到目前为止,我已经尝试在我的工作区中调整 .json 文件,但没有任何成功:

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "gcc - Build and debug active file - mac",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}\\${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/local/bin/gdb",
            "setupCommands": [
                {
                  "description": "Enable pretty-printing for gdb",
                  "text": "-enable-pretty-printing",
                  "ignoreFailures": true
                }
              ],
            "preLaunchTask": "C/C++: gcc mac"
        }
    ]
}

我正在使用与 Windows 共享的工作区,因此是“C/C++: gcc mac”预启动任务。 我尝试在谷歌上搜索解决方案,但没有找到任何解决方案,因为我的一篇帖子由于不活动而被关闭。 这也是我的引擎日志:

1: (155) LaunchOptions{"name":"gcc - Build and debug active file - mac","type":"cppdbg","request":"launch","program":"/Users/asargon/Documents/Coding/C-Coding\\annesophie2","args":[],"stopAtEntry":false,"cwd":"/Users/asargon/Documents/Coding/C-Coding","environment":[],"externalConsole":false,"MIMode":"gdb","miDebuggerPath":"/usr/local/bin/gdb","setupCommands":[{"description":"Enable pretty-printing for gdb","text":"-enable-pretty-printing","ignoreFailures":true}],"preLaunchTask":"C/C++: gcc mac","logging":{"engineLogging":true},"__configurationTarget":5,"__sessionId":"e17ea5e6-28b1-4d7a-a871-4d1680682aee"}
1: (314) codeSign-stderr: Executable=/usr/local/Cellar/gdb/10.1_1/bin/gdb
1: (318) Starting: "/usr/local/bin/gdb" --interpreter=mi
1: (334) DebuggerPid=64932
1: (647) ->=thread-group-added,id="i1"
1: (648) ->~"GNU gdb (GDB) 10.1\n"
1: (649) ->~"Copyright (C) 2020 Free Software Foundation, Inc.\n"
1: (649) ->~"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
1: (649) ->~"\nType \"show copying\" and \"show warranty\" for details.\n"
1: (650) ->~"This GDB was configured as \"x86_64-apple-darwin20.2.0\".\n"
1: (650) ->~"Type \"show configuration\" for configuration details.\n"
1: (650) ->~"For bug reporting instructions, please see:\n"
1: (650) ->~"<https://www.gnu.org/software/gdb/bugs/>.\n"
1: (650) ->~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
1: (650) ->~"\n\n"
1: (650) ->~"For help, type \"help\".\n"
1: (650) ->~"Type \"apropos word\" to search for commands related to \"word\".\n"
1: (650) ->=cmd-param-changed,param="startup-with-shell",value="off"
1: (650) ->(gdb)
1: (655) <-1001-gdb-set target-async on
1: (656) ->1001^done
1: (656) ->(gdb)
1: (657) 1001: elapsed time 3
1: (669) <-1002-enable-pretty-printing

我也尝试通过终端进行调试,但是我收到了 taskgated 错误,这是没有意义的,因为 gdb 是由我按照堆栈溢出帖子中的指南进行代码签名的,如果我尝试对其进行代码签名,它已经说明了是。:

Reading symbols from ./testcode...
Reading symbols from /Users/asargon/Documents/Coding/C-Coding/testcode.dSYM/Contents/Resources/DWARF/annesophie2...
(gdb) break 5
Breakpoint 1 at 0x100003e77: file testcode.c, line 5.
(gdb) run
Starting program: /Users/asargon/Documents/Coding/C-Coding/testcode
Unable to find Mach task port for process-id 92670: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
(gdb) quit

我现在尝试在关闭 csrutil 的情况下进行签名和调试,但这也没有成功。 这是建议的 https://gist.github.com/gravitylow/fb595186ce6068537a6e9da6d8b5b96d

【问题讨论】:

    标签: c macos debugging visual-studio-code gdb


    【解决方案1】:

    尝试安装 CodeLLDB 扩展。然后它应该会检测到您的项目

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-20
      • 1970-01-01
      • 1970-01-01
      • 2017-04-30
      • 2012-04-18
      • 1970-01-01
      • 2019-07-11
      • 2022-09-27
      相关资源
      最近更新 更多