gdb.scm 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2015, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2015, 2016, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
  5. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  6. ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
  7. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  8. ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  9. ;;;
  10. ;;; This file is part of GNU Guix.
  11. ;;;
  12. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  13. ;;; under the terms of the GNU General Public License as published by
  14. ;;; the Free Software Foundation; either version 3 of the License, or (at
  15. ;;; your option) any later version.
  16. ;;;
  17. ;;; GNU Guix is distributed in the hope that it will be useful, but
  18. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. ;;; GNU General Public License for more details.
  21. ;;;
  22. ;;; You should have received a copy of the GNU General Public License
  23. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  24. (define-module (gnu packages gdb)
  25. #:use-module (gnu packages)
  26. #:use-module (gnu packages hurd)
  27. #:use-module (gnu packages ncurses)
  28. #:use-module (gnu packages readline)
  29. #:use-module (gnu packages dejagnu)
  30. #:use-module (gnu packages texinfo)
  31. #:use-module (gnu packages multiprecision)
  32. #:use-module (gnu packages xml)
  33. #:use-module (gnu packages guile)
  34. #:use-module (gnu packages pretty-print)
  35. #:use-module (gnu packages python)
  36. #:use-module (gnu packages pkg-config)
  37. #:use-module ((guix licenses) #:select (gpl3+))
  38. #:use-module (guix packages)
  39. #:use-module (guix download)
  40. #:use-module (guix build-system gnu)
  41. #:use-module ((guix build utils) #:select (alist-replace))
  42. #:use-module (srfi srfi-1))
  43. (define-public gdb-10
  44. (package
  45. (name "gdb")
  46. (version "10.2")
  47. (source (origin
  48. (method url-fetch)
  49. (uri (string-append "mirror://gnu/gdb/gdb-"
  50. version ".tar.xz"))
  51. (sha256
  52. (base32
  53. "0aag1c0fw875pvhjg1qp7x8pf6gf92bjv5gcic5716scacyj58da"))))
  54. (build-system gnu-build-system)
  55. (arguments
  56. `(#:tests? #f ; FIXME "make check" fails on single-processor systems.
  57. #:out-of-source? #t
  58. #:modules ((srfi srfi-1)
  59. ,@%gnu-build-system-modules)
  60. #:phases (modify-phases %standard-phases
  61. (add-after
  62. 'configure 'post-configure
  63. (lambda _
  64. (for-each patch-makefile-SHELL
  65. (find-files "." "Makefile\\.in"))
  66. #t))
  67. (add-after
  68. 'install 'remove-libs-already-in-binutils
  69. (lambda* (#:key native-inputs inputs outputs
  70. #:allow-other-keys)
  71. ;; Like Binutils, GDB installs libbfd, libopcodes, etc.
  72. ;; However, this leads to collisions when both are
  73. ;; installed, and really is none of its business,
  74. ;; conceptually. So remove them.
  75. (let* ((binutils (or (assoc-ref inputs "binutils")
  76. (assoc-ref native-inputs "binutils")))
  77. (out (assoc-ref outputs "out"))
  78. (files1 (with-directory-excursion binutils
  79. (append (find-files "lib")
  80. (find-files "include"))))
  81. (files2 (with-directory-excursion out
  82. (append (find-files "lib")
  83. (find-files "include"))))
  84. (common (lset-intersection string=?
  85. files1 files2)))
  86. (with-directory-excursion out
  87. (for-each delete-file common)
  88. #t)))))))
  89. (inputs
  90. `(("expat" ,expat)
  91. ("mpfr" ,mpfr)
  92. ("gmp" ,gmp)
  93. ("readline" ,readline)
  94. ("ncurses" ,ncurses)
  95. ("guile" ,guile-3.0)
  96. ("python-wrapper" ,python-wrapper)
  97. ("source-highlight" ,source-highlight)
  98. ;; Allow use of XML-formatted syscall information. This enables 'catch
  99. ;; syscall' and similar commands.
  100. ("libxml2" ,libxml2)
  101. ;; The Hurd needs -lshouldbeinlibc.
  102. ,@(if (hurd-target?) `(("hurd" ,hurd)) '())))
  103. (native-inputs
  104. `(("texinfo" ,texinfo)
  105. ("dejagnu" ,dejagnu)
  106. ("pkg-config" ,pkg-config)
  107. ,@(if (hurd-target?)
  108. ;; When cross-compiling from x86_64-linux, make sure to use a
  109. ;; 32-bit MiG because we assume target i586-pc-gnu.
  110. `(("mig" ,(if (%current-target-system)
  111. mig/32-bit
  112. mig)))
  113. '())))
  114. ;; TODO: Add support for the GDB_DEBUG_FILE_DIRECTORY environment
  115. ;; variable in GDB itself instead of relying on some glue code in
  116. ;; the Guix-provided .gdbinit file.
  117. (native-search-paths (list (search-path-specification
  118. (variable "GDB_DEBUG_FILE_DIRECTORY")
  119. (files '("lib/debug")))))
  120. (home-page "https://www.gnu.org/software/gdb/")
  121. (synopsis "The GNU debugger")
  122. (description
  123. "GDB is the GNU debugger. With it, you can monitor what a program is
  124. doing while it runs or what it was doing just before a crash. It allows you
  125. to specify the runtime conditions, to define breakpoints, and to change how
  126. the program is running to try to fix bugs. It can be used to debug programs
  127. written in C, C++, Ada, Objective-C, Pascal and more.")
  128. (license gpl3+)))
  129. ;; This version of GDB is required by some of the Rust compilers, see
  130. ;; <https://github.com/rust-lang/rust/issues/79009>.
  131. (define-public gdb-9.2
  132. (package
  133. (inherit gdb-10)
  134. (version "9.2")
  135. (source (origin
  136. (method url-fetch)
  137. (uri (string-append "mirror://gnu/gdb/gdb-"
  138. version ".tar.xz"))
  139. (sha256
  140. (base32
  141. "0mf5fn8v937qwnal4ykn3ji1y2sxk0fa1yfqi679hxmpg6pdf31n"))))
  142. (inputs
  143. (alist-replace "guile" (list guile-2.0)
  144. (package-inputs gdb-10)))))
  145. (define-public gdb
  146. ;; This is the fixed version that packages depend on. Update it rarely
  147. ;; enough to avoid massive rebuilds.
  148. gdb-10)
  149. (define-public gdb-minimal
  150. (package/inherit
  151. gdb
  152. (name "gdb-minimal")
  153. (inputs (fold alist-delete (package-inputs gdb)
  154. '("libxml2" "ncurses" "python-wrapper" "source-highlight")))))