class Gdb < Formula desc "GNU debugger" homepage "https://www.gnu.org/software/gdb/" url "https://ftp.gnu.org/gnu/gdb/gdb-13.2.tar.xz" mirror "https://ftpmirror.gnu.org/gdb/gdb-13.2.tar.xz" sha256 "fd5bebb7be1833abdb6e023c2f498a354498281df9d05523d8915babeb893f0a" license "GPL-3.0-or-later" head "https://sourceware.org/git/binutils-gdb.git", branch: "master" bottle do sha256 ventura: "3bdf74b4973ed42f7f3fc1620d7dc50b3834d883067882a74ea1ddf9c7cb92a5" sha256 monterey: "1d69dacbbccd725c1b30efcf381d0239785999c6b14dacfc7b10caefe2686ebd" sha256 big_sur: "fdede992bdd9289f728b721d6489c96e93a37299ab64d817fab2a025a61ff4d7" sha256 x86_64_linux: "21e2853f8bb446b674fd50382799fab4257f067268fd2eab8858e18001920c77" end depends_on arch: :x86_64 # gdb is not supported on macOS ARM depends_on "gmp" depends_on "python@3.11" depends_on "xz" # required for lzma support uses_from_macos "expat" uses_from_macos "libxcrypt" uses_from_macos "ncurses" on_system :linux, macos: :ventura_or_newer do depends_on "texinfo" => :build end on_linux do depends_on "pkg-config" => :build depends_on "guile" end fails_with :clang do build 800 cause <<~EOS probe.c:63:28: error: default initialization of an object of const type 'const any_static_probe_ops' without a user-provided default constructor EOS end fails_with gcc: "5" def install args = %W[ --enable-targets=all --prefix=#{prefix} --disable-debug --disable-dependency-tracking --with-lzma --with-python=#{Formula["python@3.11"].opt_bin}/python3.11 --disable-binutils ] mkdir "build" do system "../configure", *args system "make" # Don't install bfd or opcodes, as they are provided by binutils system "make", "install-gdb", "maybe-install-gdbserver" end end def caveats on_macos do <<~EOS gdb requires special privileges to access Mach ports. You will need to codesign the binary. For instructions, see: https://sourceware.org/gdb/wiki/PermissionsDarwin EOS end end test do system bin/"gdb", bin/"gdb", "-configuration" end end