gdb doesn't work on macos High Sierra 10.13.3

匿名 (未验证) 提交于 2019-12-03 01:28:01

问题:

I have installed gdb 8.1 with brew.

I have codesign gdb also and .gdbinit as below:

set startup-with-shell off.

I have disabled SIP feature:

$ csrutil status System Integrity Protection status: disabled. 

But gdb still doesn't work:

#include  using namespace std;  int main() {   cout 

Compile command:

g++ -g test.cpp 

gdb output:

GNU gdb (GDB) 8.1 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later  This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.  Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-apple-darwin17.3.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from a.out...Reading symbols from /Users/mypc/Downloads/a.out.dSYM/Contents/Resources/DWARF/a.out...done. done. (gdb) run Starting program: /Users/mypc/Downloads/a.out  [New Thread 0x2503 of process 802] [New Thread 0x2303 of process 802] During startup program terminated with signal ?, Unknown signal. (gdb)  

What correct steps to make gdb work on macos sierra?

回答1:

This is caused by latest gdb 8.1, degrade gdb to 8.0.1 could solve this problem.

How to degrade to gdb 8.0.1

  • Unlink current gdb: brew unlink gdb
  • Install gdb 8.0.1: brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/9ec9fb27a33698fc7636afce5c1c16787e9ce3f3/Formula/gdb.rb
  • Optional: avoid upgrade gdb with brew pin gdb


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!