projects/guix·blob librewolf-updates · refs

1137 lines · 48.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2015, 2016, 2017, 2019-2022 Eric Bavier <[email protected]>
3;;; Copyright © 2016-2018, 2020, 2021, 2025 Efraim Flashner <[email protected]>
4;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2018, 2019 Rutger Helling <[email protected]>
6;;; Copyright © 2019 Pkill -9 <[email protected]>
7;;; Copyright © 2020 Vincent Legoll <[email protected]>
8;;; Copyright © 2020, 2021 Morgan Smith <[email protected]>
9;;; Copyright © 2020, 2025 Maxim Cournoyer <[email protected]>
10;;; Copyright © 2021 Felix Gruber <[email protected]>
11;;; Copyright © 2021 Foo Chuan Wei <[email protected]>
12;;; Copyright © 2022 Michael Rohleder <[email protected]>
13;;; Copyright © 2022 Matthew James Kraai <[email protected]>
14;;; Copyright © 2023 Andy Tai <[email protected]>
15;;; Copyright © 2023 Ricardo Wurmus <[email protected]>
16;;; Copyright © 2024 Raven Hallsby <[email protected]>
17;;; Copyright © 2025 Nguyễn Gia Phong <[email protected]>
18;;; Copyright © 2025 Robin Templeton <[email protected]>
19;;;
20;;; This file is part of GNU Guix.
21;;;
22;;; GNU Guix is free software; you can redistribute it and/or modify it
23;;; under the terms of the GNU General Public License as published by
24;;; the Free Software Foundation; either version 3 of the License, or (at
25;;; your option) any later version.
26;;;
27;;; GNU Guix is distributed in the hope that it will be useful, but
28;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30;;; GNU General Public License for more details.
31;;;
32;;; You should have received a copy of the GNU General Public License
33;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34
35(define-module (gnu packages debug)
36 #:use-module (guix packages)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix download)
39 #:use-module (guix git-download)
40 #:use-module (guix utils)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system cmake)
43 #:use-module (guix build-system go)
44 #:use-module (guix build-system linux-module)
45 #:use-module (guix build-system pyproject)
46 #:use-module (guix build-system qt)
47 #:use-module (guix gexp)
48 #:use-module (gnu packages)
49 #:use-module (gnu packages attr)
50 #:use-module (gnu packages autotools)
51 #:use-module (gnu packages base)
52 #:use-module (gnu packages bash)
53 #:use-module (gnu packages bison)
54 #:use-module (gnu packages c)
55 #:use-module (gnu packages cpp)
56 #:use-module (gnu packages check)
57 #:use-module (gnu packages code)
58 #:use-module (gnu packages compression)
59 #:use-module (gnu packages flex)
60 #:use-module (gnu packages fontutils)
61 #:use-module (gnu packages gcc)
62 #:use-module (gnu packages gdb)
63 #:use-module (gnu packages glib)
64 #:use-module (gnu packages gtk)
65 #:use-module (gnu packages golang)
66 #:use-module (gnu packages golang-build)
67 #:use-module (gnu packages golang-web)
68 #:use-module (gnu packages golang-xyz)
69 #:use-module (gnu packages image)
70 #:use-module (gnu packages lesstif)
71 #:use-module (gnu packages libusb)
72 #:use-module (gnu packages linux)
73 #:use-module (gnu packages llvm)
74 #:use-module (gnu packages multiprecision)
75 #:use-module (gnu packages ncurses)
76 #:use-module (gnu packages ninja)
77 #:use-module (gnu packages perl)
78 #:use-module (gnu packages pkg-config)
79 #:use-module (gnu packages pretty-print)
80 #:use-module (gnu packages python)
81 #:use-module (gnu packages python-build)
82 #:use-module (gnu packages python-check)
83 #:use-module (gnu packages python-xyz)
84 #:use-module (gnu packages qt)
85 #:use-module (gnu packages readline)
86 #:use-module (gnu packages serialization)
87 #:use-module (gnu packages texinfo)
88 #:use-module (gnu packages virtualization)
89 #:use-module (gnu packages xdisorg)
90 #:use-module (gnu packages xorg)
91 #:use-module (ice-9 match)
92 #:use-module (srfi srfi-1))
93
94(define-public delta
95 (package
96 (name "delta")
97 (version "2006.08.03")
98 (source
99 (origin
100 (method url-fetch)
101 (uri (list
102 (string-append "mirror://debian/pool/main/d/delta/"
103 "delta_" version ".orig.tar.gz")))
104 (sha256
105 (base32
106 "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q"))))
107 (build-system gnu-build-system)
108 (inputs ;Installed programs are perl scripts
109 (list perl))
110 (arguments
111 `(#:phases
112 (modify-phases %standard-phases
113 (replace 'install
114 (lambda* (#:key outputs #:allow-other-keys)
115 ;; Makefile contains no install target
116 (let* ((out (assoc-ref outputs "out"))
117 (bin (string-append out "/bin"))
118 (doc (string-append out "/share/doc/delta-" ,version)))
119 (begin
120 (for-each (lambda (h)
121 (install-file h doc))
122 `("License.txt" ,@(find-files "www" ".*\\.html")))
123 (for-each (lambda (b)
124 (install-file b bin))
125 `("delta" "multidelta" "topformflat"))))
126 #t))
127 (delete 'configure)))) ; no configure script
128 (home-page
129 "https://web.archive.org/web/20200701152100/http://delta.tigris.org/")
130 (synopsis "Heuristical file minimizer")
131 (description
132 "Delta assists you in minimizing \"interesting\" files subject to a test
133of their interestingness. A common such situation is when attempting to
134isolate a small failure-inducing substring of a large input that causes your
135program to exhibit a bug.")
136 ;; See License.txt, which is a bsd-3 license, despite the project's
137 ;; home-page pointing to a bsd-2 license.
138 (license license:bsd-3)))
139
140(define-public c-reduce
141 (let ((commit "31e855e290970cba0286e5032971509c0e7c0a80")
142 (revision "0"))
143 (package
144 (name "c-reduce")
145 (version (git-version "2.10.0" revision commit))
146 (source
147 (origin
148 (method git-fetch)
149 (uri (git-reference
150 (url "https://github.com/csmith-project/creduce")
151 (commit commit)))
152 (file-name (git-file-name name version))
153 (sha256
154 (base32 "1yd3wvnkj7qgn2jj5byp58p3qq04w5d6agagrkgi5z5gb6z4qyqk"))))
155 (build-system gnu-build-system)
156 (arguments
157 (list
158 #:phases
159 #~(modify-phases %standard-phases
160 (replace 'check
161 (lambda _
162 (with-directory-excursion "tests"
163 ;; Running all tests can take a looong time, and tests 4 and 5
164 ;; require frama-c or kcc. So run just one for sanity.
165 (invoke "./run_tests" "1"))))
166 (add-after 'install 'set-load-paths
167 (lambda _
168 ;; Tell creduce where to find the perl modules it needs.
169 (wrap-program (string-append #$output "/bin/creduce")
170 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))))))
171 (native-inputs (list flex))
172 (inputs (list astyle
173 bash-minimal ;for wrap-program
174 llvm-18
175 clang-18
176 indent
177 perl
178 perl-exporter-lite
179 perl-file-which
180 perl-getopt-tabular
181 perl-regexp-common
182 perl-term-readkey))
183 (home-page "https://embed.cs.utah.edu/creduce")
184 (synopsis "Reducer for interesting code")
185 (description
186 "C-Reduce is a tool that takes a large C or C++ program that has a
187property of interest (such as triggering a compiler bug) and automatically
188produces a much smaller C/C++ program that has the same property. It is
189intended for use by people who discover and report bugs in compilers and other
190tools that process C/C++ code.")
191 (license license:ncsa))))
192
193(define-public cppdap
194 (package
195 (name "cppdap")
196 (version "1.58.0-a")
197 (source
198 (origin
199 (method git-fetch)
200 (uri
201 (git-reference
202 (url "https://github.com/google/cppdap")
203 (commit (string-append "dap-" version))))
204 (modules '((guix build utils)))
205 (snippet
206 '(delete-file-recursively "third_party"))
207 (patches (search-patches
208 "cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch"))
209 (file-name (git-file-name name version))
210 (sha256
211 (base32
212 "0fq2w35fw1lb5wya1nny45pk3a13b689k48calk1cmqmqpbcjn2b"))))
213 (build-system cmake-build-system)
214 (arguments
215 (list
216 #:configure-flags
217 #~(list
218 "-DCPPDAP_BUILD_TESTS=ON"
219 "-DCPPDAP_USE_EXTERNAL_GTEST_PACKAGE=ON"
220 ;; Only one of the following three can be enabled at the same time
221 ;; "-DCPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE=ON"
222 ;; "-DCPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE=ON"
223 "-DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON")
224 #:phases
225 (if (target-riscv64?)
226 #~(modify-phases %standard-phases
227 ;; We need to unconditionally link with libatomic on some
228 ;; architectures to successfully build cmake.
229 (add-after 'unpack 'link-with-libatomic
230 (lambda _
231 (substitute* "CMakeLists.txt"
232 (("cppdap_set_target_options\\(cppdap\\)" all)
233 (string-append
234 all "\n\n"
235 "target_link_libraries(cppdap PRIVATE atomic)"))))))
236 #~%standard-phases)))
237 (native-inputs
238 (list googletest))
239 ;; see lib/cmake/cppdap/cppdapConfig.cmake
240 ;; cmake file require propagate this.
241 (propagated-inputs
242 (list
243 ;; Only one of the following three can be enabled at the same time
244 ;; rapidjson
245 ;; jsoncpp
246 nlohmann-json))
247 (home-page "https://github.com/google/cppdap")
248 (synopsis "C++ library for the Debug Adapter Protocol")
249 (description
250 "cppdap is a C++11 library (\"SDK\") implementation of the Debug Adapter
251Protocol, providing an API for implementing a DAP client or server. cppdap
252provides C++ type-safe structures for the full DAP specification, and provides a
253simple way to add custom protocol messages.")
254 (license license:expat)))
255
256(define-public c-vise
257 (package
258 (name "c-vise")
259 (version "2.4.0")
260 (source
261 (origin
262 (method git-fetch)
263 (uri (git-reference
264 (url "https://github.com/marxin/cvise")
265 (commit (string-append "v" version))))
266 (sha256
267 (base32 "1i2z5q2pcwh1gpdqc24x1a2q5vzwhblzzq021nzwf304di7m18vl"))
268 (file-name (git-file-name name version))))
269 (build-system cmake-build-system)
270 (native-inputs
271 (list flex python-pytest python-pytest-flake8))
272 (inputs
273 (list bash-minimal clang llvm unifdef
274 python python-pebble python-psutil python-chardet))
275 (arguments
276 `(#:phases
277 (modify-phases %standard-phases
278 (add-after 'unpack 'fix-linkage
279 (lambda _
280 (substitute* "clang_delta/CMakeLists.txt"
281 (("\\$\\{LLVM_LINK_LLVM_DYLIB\\}") "True")
282 ((" LLVM") " LLVMSupport"))))
283 (add-before 'build 'hardcode-paths
284 (lambda _
285 (substitute* "cvise.py"
286 (("/bin/bash") (which "bash"))
287 (("(.*)# Special case for clang-format" & >)
288 (string-append > "# Special case for unifdef\n"
289 > "programs['unifdef'] = '" (which "unifdef") "'\n"
290 &)))))
291 (add-after 'install 'wrap
292 (lambda* (#:key outputs #:allow-other-keys)
293 (let ((out (assoc-ref outputs "out"))
294 (python-path (getenv "GUIX_PYTHONPATH")))
295 (wrap-program (string-append out "/bin/cvise")
296 `("PYTHONPATH" ":" prefix (,python-path)))
297 #t))))))
298 (home-page "https://github.com/marxin/cvise")
299 (synopsis "Reducer for interesting code")
300 (description
301 "C-Vise is a Python port of the C-Reduce tool that is fully compatible
302and uses the same efficient LLVM-based C/C++ @code{clang_delta} reduction
303tool.")
304 (license license:ncsa)))
305
306(define-public qemu-for-aflplusplus
307 (let ((base qemu-minimal)
308 (commit "60ebd5624c60589e276cf287516b925a9ee35b87")
309 (revision "1"))
310 (hidden-package
311 (package
312 (inherit base)
313 (name "qemu")
314 (version (git-version "5.2.50" revision commit))
315 (source
316 (origin
317 (method git-fetch)
318 (uri (git-reference (url "https://github.com/AFLplusplus/qemuafl")
319 (commit commit)
320 (recursive? #t)))
321 (file-name (git-file-name name version))
322 (sha256
323 (base32 "1vz7k1ssfnlimkpc01fqin27r2k4a23cwpxj2bbmsp7d3175bjbz"))))
324 (arguments
325 (substitute-keyword-arguments (package-arguments base)
326 ((#:configure-flags _ #~'())
327 #~(list (string-append
328 "--target-list="
329 ;; AFL++ only supports using a single afl-qemu-trace,
330 ;; so we only build qemu for the native target.
331 (match #$(let-system system system)
332 ("aarch64-linux" "aarch64-linux-user")
333 ("armhf-linux" "arm-linux-user")
334 ("i686-linux" "i386-linux-user")
335 ("mips64el-linux" "mips64el-linux-user")
336 ("powerpc-linux" "ppc-linux-user")
337 ("riscv64-linux" "riscv64-linux-user")
338 ("x86_64-linux" "x86_64-linux-user")))))
339 ((#:phases phases)
340 #~(modify-phases #$phases
341 (delete 'replace-firmwares)
342 (delete 'patch-embedded-shebangs)
343 (delete 'fix-optionrom-makefile)
344 (delete 'disable-unusable-tests)
345 (replace 'configure
346 (lambda* (#:key configure-flags #:allow-other-keys)
347 ;; The `configure' script doesn't understand some of the
348 ;; GNU options. Thus, add a new phase that's compatible.
349 (setenv "SHELL" (which "bash"))
350 ;; The binaries need to be linked against -lrt.
351 (setenv "LDFLAGS" "-lrt")
352 (apply invoke
353 "./configure"
354 (string-append "--cc=" #$(cc-for-target))
355 ;; Some architectures insist on using HOST_CC
356 (string-append "--host-cc=" #$(cc-for-target))
357 "--disable-debug-info" ; save build space
358 (string-append "--prefix=" #$output)
359 (string-append "--sysconfdir=/etc")
360 configure-flags)))
361 (add-after 'install 'install-qasan-header
362 (lambda _
363 (install-file "qemuafl/qasan.h"
364 (string-append #$output "/include"))))
365 (delete 'delete-firmwares)
366 #$@(if (target-riscv64?)
367 '((replace 'disable-some-tests
368 (lambda _
369 ;; qemu.qmp.QMPConnectError:
370 ;; Unexpected empty reply from server
371 (delete-file "tests/qemu-iotests/040")
372 (delete-file "tests/qemu-iotests/041")
373 (delete-file "tests/qemu-iotests/256")
374 ;; No 'PCI' bus found for device 'virtio-scsi-pci'
375 (delete-file "tests/qemu-iotests/127")
376 (delete-file "tests/qemu-iotests/267"))))
377 '())))))
378 (inputs (modify-inputs (package-inputs base)
379 (delete "dtc")))
380 (home-page "https://github.com/AFLplusplus/qemuafl")
381 (synopsis "QEMU for AFL++")))))
382
383(define-public aflplusplus
384 ;; TODO: Merge the duplicate application of modify-phases,
385 ;; due to the previous inheritance from american-fuzzy-lop.
386 (let* ((machine (match (or (%current-target-system)
387 (%current-system))
388 ("x86_64-linux" "x86_64")
389 ("i686-linux" "i386")
390 ("aarch64-linux" "aarch64")
391 ("armhf-linux" "arm")
392 ("mips64el-linux" "mips64el")
393 ("powerpc-linux" "ppc")
394 ;; Prevent errors when querying this package on unsupported
395 ;; platforms, e.g. when running "guix package --search="
396 (_ "UNSUPPORTED")))
397 (arguments-american-fuzzy-lop
398 `(#:make-flags '()
399 #:phases (modify-phases %standard-phases
400 (add-after 'unpack 'make-git-checkout-writable
401 (lambda _
402 (for-each make-file-writable (find-files "."))
403 #t))
404 (delete 'configure)
405 ,@(if (string=? (%current-system) (or "x86_64-linux"
406 "i686-linux"))
407 '()
408 '((add-before 'build 'set-afl-flag
409 (lambda _ (setenv "AFL_NO_X86" "1") #t))
410 (add-after 'install 'remove-x86-programs
411 (lambda* (#:key outputs #:allow-other-keys)
412 (let* ((out (assoc-ref outputs "out"))
413 (bin (string-append out "/bin/")))
414 (delete-file (string-append bin "afl-gcc"))
415 (delete-file (string-append bin "afl-g++"))
416 (delete-file (string-append bin "afl-clang"))
417 (delete-file (string-append bin "afl-clang++")))
418 #t))))
419 (add-after
420 ;; TODO: Build and install the afl-llvm tool.
421 'install 'install-qemu
422 (lambda* (#:key inputs outputs #:allow-other-keys)
423 (let ((qemu (assoc-ref inputs "qemu"))
424 (out (assoc-ref outputs "out")))
425 (symlink (string-append qemu "/bin/qemu-" ,machine)
426 (string-append out "/bin/afl-qemu-trace"))
427 #t)))
428 (delete 'check))))) ; tests are run during 'install phase
429 (package
430 (name "aflplusplus")
431 (version "4.35c")
432 (source (origin
433 (method git-fetch)
434 (uri (git-reference
435 (url "https://github.com/AFLplusplus/AFLplusplus")
436 (commit (string-append "v" version))))
437 (file-name (git-file-name name version))
438 (sha256
439 (base32
440 "0mwamvyv2ckfxrrns4cnhx9gf2dn9jjgi9dc1qp3cwjasbghg5lg"))))
441 (build-system gnu-build-system)
442 (arguments
443 (substitute-keyword-arguments arguments-american-fuzzy-lop
444 ((#:make-flags _ ''())
445 #~(list (string-append "PREFIX=" #$output)
446 (string-append "DOC_PATH=" #$output "/share/doc/"
447 #$(package-name this-package) "-"
448 #$(package-version this-package))
449 (string-append "CC=" #$(cc-for-target))
450 (string-append "CXX=" #$(cxx-for-target))
451 (string-append "LLVM_CONFIG="
452 (search-input-file %build-inputs "/bin/llvm-config"))
453 ;; Need to use LLD with the llvm_mode, because LTO in
454 ;; combination with binutils gold is currently broken.
455 ;;
456 ;; See: https://codeberg.org/guix/guix/issues/3307
457 (string-append "AFL_REAL_LD="
458 (search-input-file %build-inputs "/bin/ld.lld"))
459 (string-append "CLANG_BIN="
460 (search-input-file %build-inputs "/bin/clang"))
461 (string-append "CLANGPP_BIN="
462 (search-input-file %build-inputs "/bin/clang++"))
463 "LLVM_LTO=1"
464 "AFL_CLANG_FLTO=-flto=full"))
465 ((#:phases phases '%standard-phases)
466 #~(modify-phases #$phases
467 ;; Ensure that the build fails early if LLVM support fails to
468 ;; compile, makes the build log much easier to understand.
469 (add-after 'unpack 'fatal-llvm-failure
470 (lambda* (#:key inputs #:allow-other-keys)
471 (substitute* "GNUmakefile"
472 (("-\\$\\(MAKE\\) ..* -f GNUmakefile.llvm$" all)
473 (substring all 1))))) ; remove the leading '-'
474 ;; GNUmakefile.llvm tries to find clang/clang++ relative to the
475 ;; --bindir reported by llvm-config, but since llvm and clang
476 ;; have different store paths on Guix, this doesn't work here.
477 (add-after 'unpack 'patch-clang-path
478 (lambda* (#:key inputs #:allow-other-keys)
479 (substitute* "GNUmakefile.llvm"
480 (("^CC *= .*$")
481 (string-append
482 "override CC = "
483 (search-input-file inputs "/bin/clang")
484 "\n"))
485 (("^CXX *= .*$")
486 (string-append
487 "override CXX = "
488 (search-input-file inputs "/bin/clang++")
489 "\n")))))
490 ;; For GCC plugins.
491 (add-after 'unpack 'patch-gcc-path
492 (lambda* (#:key inputs #:allow-other-keys)
493 (substitute* "src/afl-cc.c"
494 (("alt_cc = \"gcc\";")
495 (format #f "alt_cc = \"~a\";"
496 (search-input-file inputs "bin/gcc")))
497 (("alt_cxx = \"g\\+\\+\";")
498 (format #f "alt_cxx = \"~a\";"
499 (search-input-file inputs "bin/g++"))))))
500 (add-after 'build 'build-qasan
501 (lambda* (#:key parallel-build? make-flags #:allow-other-keys)
502 (apply invoke "make" "-C" "qemu_mode/libqasan"
503 "-j" (number->string (if parallel-build?
504 (parallel-job-count)
505 "1"))
506 make-flags)))
507 ;; afl-qemu-trace is a symbolic link to QEMU's binary.
508 ;; Substituting its source code with AFL++'s output path
509 ;; would result in a dependency cycle.
510 (add-after 'install-qemu 'wrap-qemu
511 (lambda _
512 (wrap-program (string-append #$output "/bin/afl-qemu-trace")
513 `("AFL_PATH" = (,(string-append #$output "/lib/afl"))))))))))
514 (inputs (list llvm-20 clang-20 lld-20 gcc gmp python qemu-for-aflplusplus))
515 (native-inputs (list gcc))
516 (home-page "https://aflplus.plus/")
517 (synopsis "Security-oriented fuzzer")
518 (description
519 "AFLplusplus is a security-oriented fuzzer that employs a novel type of
520compile-time instrumentation and genetic algorithms to automatically discover
521clean, interesting test cases that trigger new internal states in the targeted
522binary. This substantially improves the functional coverage for the fuzzed
523code. The compact synthesized corpora produced by the tool are also useful for
524seeding other, more labor- or resource-intensive testing regimes down the road.
525It is a fork of American Fuzzy Lop fuzzer and features:
526@itemize
527@item A more recent qemu version.
528@item More algorithms like collision-free coverage, enhanced laf-intel &
529redqueen, AFLfast++ power schedules, MOpt mutators, unicorn_mode, etc.
530@end itemize")
531 (license license:asl2.0))))
532
533(define-public backward-cpp
534 (package
535 (name "backward-cpp")
536 (version "1.6")
537 (source (origin
538 (method git-fetch)
539 (uri (git-reference
540 (url "https://github.com/bombela/backward-cpp")
541 (commit (string-append "v" version))))
542 (file-name (git-file-name name version))
543 (sha256
544 (base32
545 "1b2h03iwfhcsg8i4f125mlrjf8l1y7qsr2gsbkv0z03i067lykns"))))
546 (arguments
547 (list
548 #:configure-flags
549 #~(list "-DBACKWARD_SHARED=ON")))
550 (build-system cmake-build-system)
551 (inputs
552 (list libiberty zlib))
553 (synopsis "Stack trace pretty printer for C++")
554 (description
555 "Backward-cpp is a stack trace pretty printer for C++.
556It can print annotated stack traces using debug info in the executable.")
557 (home-page "https://github.com/bombela/backward-cpp")
558 (license license:expat)))
559
560(define-public stress-make
561 (let ((commit "97815bed8060de33952475b3498767c91f59ffd9")
562 (revision "2")) ;No official source distribution
563 (package
564 (name "stress-make")
565 (version (git-version "1.0" revision commit))
566 (source
567 (origin
568 (method git-fetch)
569 (uri (git-reference
570 (url "https://github.com/lanl/stress-make")
571 (commit commit)))
572 (file-name (git-file-name name version))
573 (sha256
574 (base32
575 "0k55cy7x0hlc6rgpascl6ibhcfxaash3p9r9r8kwvbm3zag1rmac"))))
576 (build-system gnu-build-system)
577 (native-inputs
578 (list autoconf automake go))
579 (inputs
580 `(("make-source" ,(package-source gnu-make))))
581 (arguments
582 ;; stress-make's configure script insists on having a tarball and does
583 ;; not accept a directory name instead. To let the gnu-build-system's
584 ;; patch-* phases work properly, we unpack the source first, then
585 ;; repack before the configure phase.
586 (let ((make-dir (string-append "make-" (package-version gnu-make))))
587 `(#:configure-flags '("--with-make-tar=./make.tar.xz"
588 "make_cv_sys_gnu_glob=yes")
589 #:phases
590 (modify-phases %standard-phases
591 (add-after 'unpack 'unpack-make
592 (lambda* (#:key inputs #:allow-other-keys)
593 (invoke "tar" "xf" (assoc-ref inputs "make-source"))))
594 (add-after 'unpack-make 'set-default-shell
595 (lambda _
596 ;; Taken mostly directly from (@ (gnu packages base) gnu-make)
597 (substitute* (string-append ,make-dir "/src/job.c")
598 (("default_shell = .*$")
599 (format #f "default_shell = \"~a\";\n"
600 (which "sh"))))))
601 (add-before 'configure 'repack-make
602 (lambda _
603 (invoke "tar" "cJf" "./make.tar.xz" ,make-dir)))
604 (add-before 'build 'setup-go
605 ;; The Go cache is required starting in Go 1.12, and it needs
606 ;; to be writable.
607 (lambda _ (setenv "GOCACHE" "/tmp/go-cache") #t))))))
608 (home-page "https://github.com/lanl/stress-make")
609 (synopsis "Expose race conditions in Makefiles")
610 (description
611 "Stress Make is a customized GNU Make that explicitly manages the order
612in which concurrent jobs are run to provoke erroneous behavior into becoming
613manifest. It can run jobs in the order in which they're launched, in backwards
614order, or in random order. The thought is that if code builds correctly with
615Stress Make, then it is likely that the @code{Makefile} contains no race
616conditions.")
617 ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated,
618 ;; and patched GNU Make is under its own license.
619 (license (list (license:non-copyleft "LICENSE.md")
620 license:gpl3+)))))
621
622(define-public zzuf
623 (package
624 (name "zzuf")
625 (version "0.15")
626 (source
627 (origin
628 (method url-fetch)
629 (uri (string-append
630 "https://github.com/samhocevar/zzuf/releases/download/v"
631 version "/" name "-" version ".tar.gz"))
632 (file-name (string-append name "-" version ".tar.gz"))
633 (sha256
634 (base32
635 "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3"))))
636 (build-system gnu-build-system)
637 (native-inputs (list gcc-13))
638 (home-page "https://github.com/samhocevar/zzuf")
639 (synopsis "Transparent application input fuzzer")
640 (description "Zzuf is a transparent application input fuzzer. It works by
641intercepting file operations and changing random bits in the program's
642input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.")
643 (license license:wtfpl2)))
644
645(define-public scanmem
646 (package
647 (name "scanmem")
648 (version "0.17")
649 (source
650 (origin
651 (method git-fetch)
652 (uri (git-reference
653 (url "https://github.com/scanmem/scanmem")
654 (commit (string-append "v" version))))
655 (file-name (git-file-name name version))
656 (sha256
657 (base32
658 "17p8sh0rj8yqz36ria5bp48c8523zzw3y9g8sbm2jwq7sc27i7s9"))))
659 (build-system gnu-build-system)
660 (arguments
661 `(#:configure-flags '("--enable-gui")
662 #:phases
663 (modify-phases %standard-phases
664 (add-before 'configure 'hardcode-python
665 (lambda* (#:key inputs outputs #:allow-other-keys)
666 (substitute* "gui/GameConqueror.py"
667 (("/usr/bin/env python")
668 (search-input-file inputs "/bin/python")))))
669 (add-after 'install 'wrap-gameconqueror
670 (lambda* (#:key inputs outputs #:allow-other-keys)
671 (let ((out (assoc-ref outputs "out"))
672 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
673 (python-path (getenv "GUIX_PYTHONPATH")))
674 (wrap-program (string-append out "/share/gameconqueror/GameConqueror.py")
675 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
676 `("GUIX_PYTHONPATH" ":" prefix (,python-path))))
677 #t)))))
678 (native-inputs
679 (list libtool
680 python-wrapper
681 gobject-introspection
682 gtk+
683 intltool
684 automake
685 autoconf))
686 (inputs
687 (list bash-minimal
688 readline))
689 (propagated-inputs
690 (list python-pygobject))
691 (home-page "https://github.com/scanmem/scanmem")
692 (synopsis "Memory scanner")
693 (description "Scanmem is a debugging utility designed to isolate the
694address of an arbitrary variable in an executing process. Scanmem simply
695needs to be told the pid of the process and the value of the variable at
696several different times. After several scans of the process, scanmem isolates
697the position of the variable and allows you to modify its value.")
698 ;; The library is covered by LGPLv3 or later; the application is covered
699 ;; by GPLv3 or later.
700 (license (list license:lgpl3+ license:gpl3+))))
701
702(define-public remake
703 (package (inherit gnu-make)
704 (name "remake")
705 (version "4.3-1.6")
706 (source (origin
707 (method url-fetch)
708 (uri (let ((upstream-version
709 (match (string-split version #\-)
710 ((ver sub) (string-append ver "%2Bdbg-" sub)))))
711 (string-append "mirror://sourceforge/bashdb/"
712 "remake/" upstream-version "/"
713 "remake-" upstream-version ".tar.gz")))
714 (file-name (string-append "remake-" version ".tar.gz"))
715 (sha256
716 (base32
717 "11vvch8bi0yhjfz7gn92b3xmmm0cgi3qfiyhbnnj89frkhbwd87n"))
718 (patches (search-patches "remake-impure-dirs.patch"))))
719 (inputs
720 (modify-inputs (package-inputs gnu-make)
721 (prepend readline)))
722 (home-page "https://bashdb.sourceforge.net/remake/")
723 (description "Remake is an enhanced version of GNU Make that adds improved
724error reporting, better tracing, profiling, and a debugger.")
725 (license license:gpl3+)))
726
727(define-public rr
728 ;; Use a newer commit, which contains unreleased fixes to the
729 ;; zen-pmu-workaround.c kernel module, among others.
730 (let ((commit "7fe1e367c2b4e0df7647e020c20d66827badfad3")
731 (revision "0"))
732 (package
733 (name "rr")
734 (version (git-version "5.9.0" revision commit))
735 (source (origin
736 (method git-fetch)
737 (uri (git-reference
738 (url "https://github.com/mozilla/rr")
739 (commit commit)))
740 (sha256
741 (base32
742 "1zgxk4blwwq0bigi0g8dafgl330aid3kw9ym426825flc3pp1c3m"))
743 (file-name (git-file-name name version))))
744 (build-system cmake-build-system)
745 (arguments
746 `(#:configure-flags
747 ;; The 'rr_exec_stub' is a static binary, which leads CMake to fail
748 ;; with ‘file RPATH_CHANGE could not write new RPATH: ...’.
749 ;; Clear CMAKE_INSTALL_RPATH to avoid that problem.
750 (list "-DCMAKE_INSTALL_RPATH="
751 ;; Satisfy the ‘validate-runpath’ phase. This isn't a direct
752 ;; consequence of clearing CMAKE_INSTALL_RPATH.
753 (string-append "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath="
754 (assoc-ref %build-inputs "capnproto")
755 "/lib,-rpath=" (assoc-ref %build-inputs "zlib")
756 "/lib,-rpath=" (assoc-ref %build-inputs "zstd")
757 "/lib")
758 ,@(if (and (not (%current-target-system))
759 (member (%current-system)
760 '("x86_64-linux" "aarch64-linux")))
761 ;; The toolchain doesn't support '-m32'.
762 '("-Ddisable32bit=ON")
763 '()))
764
765 ;; XXX: Most tests fail with:
766 ;;
767 ;; rr needs /proc/sys/kernel/perf_event_paranoid <= 1, but it is 2.
768 ;;
769 ;; This setting cannot be changed from the build environment, so skip
770 ;; the tests.
771 #:tests? #f
772
773 #:phases (modify-phases %standard-phases
774 (add-before 'check 'set-home
775 (lambda _
776 ;; Some tests expect 'HOME' to be set.
777 (setenv "HOME" (getcwd)))))))
778 (native-inputs
779 (list lldb pkg-config which))
780 (inputs
781 (list gdb
782 capnproto
783 python
784 python-pexpect
785 zlib
786 `(,zstd "lib")))
787
788 ;; List of supported systems according to 'src/preload/raw_syscall.S'.
789 (supported-systems '("x86_64-linux" "i686-linux" "aarch64-linux"))
790
791 (home-page "https://rr-project.org/")
792 (synopsis "Record and replay debugging framework")
793 (description
794 "rr is a lightweight tool for recording, replaying and debugging
795execution of applications (trees of processes and threads). Debugging extends
796GDB with very efficient reverse-execution, which in combination with standard
797GDB/x86 features like hardware data watchpoints, makes debugging much more
798fun.")
799 (license license:expat))))
800
801(define-public rr-zen-pmu-workaround
802 (package
803 (name "rr-zen-pmu-workaround")
804 (version (package-version rr))
805 (source (package-source rr))
806 (build-system linux-module-build-system)
807 (arguments
808 (list
809 #:tests? #f ;no tests
810 #:phases
811 #~(modify-phases %standard-phases
812 (add-after 'unpack 'cd
813 (lambda _
814 (chdir "third-party/zen-pmu-workaround"))))))
815 (home-page "https://github.com/rr-debugger/rr/wiki/Zen")
816 (synopsis "AMD Zen workaround kernel module for rr")
817 (description "This is a Linux kernel module that implements
818 workarounds needed for using the @command{rr} debugger with AMD Zen
819@acronym{CPU, Central Processing Unit}.")
820 (license license:gpl2))) ;GPLv2 only, like the kernel
821
822(define-public libbacktrace
823 ;; There are no releases nor tags.
824 (let ((revision "2")
825 (commit "cdb64b688dda93bbbacbc2b1ccf50ce9329d4748"))
826 (package
827 (name "libbacktrace")
828 (version (git-version "1.0" revision commit))
829 (source (origin
830 (method git-fetch)
831 (uri (git-reference
832 (url "https://github.com/ianlancetaylor/libbacktrace")
833 (commit commit)))
834 (file-name (git-file-name name version))
835 (sha256
836 (base32
837 "0iwd41pgr2nxlmghqdfwfwxac27jbqxwxp07jihhq85a8s3igjgr"))))
838 (build-system gnu-build-system)
839 (arguments
840 `(#:parallel-tests? #f ;spurious failures when testing in parallel
841 #:make-flags '("CFLAGS=-fPIC")))
842 (home-page "https://github.com/ianlancetaylor/libbacktrace")
843 (synopsis "C library for producing symbolic backtraces")
844 (description "The @code{libbacktrace} library can be linked into a C/C++
845program to produce symbolic backtraces.")
846 (license license:bsd-3))))
847
848(define-public libleak
849 (package
850 (name "libleak")
851 (version "0.3.6")
852 (source (origin
853 (method git-fetch)
854 (uri (git-reference
855 (url "https://github.com/WuBingzheng/libleak")
856 (commit (string-append "v" version))))
857 (file-name (git-file-name name version))
858 (sha256
859 (base32
860 "1p6x20mm0dym2qn10d6cvwmh71m93xwcd319g94zkv88hj5q17n6"))))
861 (build-system gnu-build-system)
862 (arguments
863 `(#:tests? #f ;no test suite
864 #:parallel-build? #f ;jobserver unavailable
865 #:phases (modify-phases %standard-phases
866 (add-after 'unpack 'unbundle-libwuya
867 (lambda _
868 (substitute* "Makefile"
869 ((".*make -C libwuya.*") ""))
870 #t))
871 (add-before 'build 'set-CC
872 (lambda _
873 (setenv "CC" "gcc")
874 #t))
875 (delete 'configure) ;no configure script
876 (replace 'install
877 (lambda* (#:key outputs #:allow-other-keys)
878 (let* ((out (assoc-ref outputs "out")))
879 (install-file "libleak.so" (string-append out "/lib"))
880 #t))))))
881 (inputs (list libbacktrace libwuya))
882 (home-page "https://github.com/WuBingzheng/libleak")
883 (synopsis "Memory leaks detection tool")
884 (description "The libleak tool detects memory leaks by hooking memory
885functions such as @code{malloc}. It comes as a shared object to be pre-loaded
886via @code{LD_PRELOAD} when launching the application. It prints the full call
887stack at suspicious memory leak points. Modifying or recompiling the target
888program is not required, and the detection can be enabled or disabled while
889the target application is running. The overhead incurred by libleak is
890smaller than that of other tools such as Valgrind, and it aims to be easier to
891use than similar tools like @command{mtrace}.")
892 (license license:gpl2+)))
893
894(define-public cgdb
895 (package
896 (name "cgdb")
897 (version "0.8.0")
898 (source
899 (origin
900 (method url-fetch)
901 (uri (string-append "https://cgdb.me/files/cgdb-" version ".tar.gz"))
902 (sha256
903 (base32 "1w8ib2vg3pg68d9hh97fw5042c73i9nqavdddc87n9bpscjbaf0d"))))
904 (build-system gnu-build-system)
905 (inputs
906 (list bash-minimal ncurses readline gdb))
907 (native-inputs
908 (list flex texinfo))
909 (arguments
910 `(#:configure-flags
911 (list
912 (string-append "ac_cv_rl_version=" ,(package-version readline))
913 "ac_cv_file__dev_ptmx=no"
914 "ac_cv_file__proc_self_status=no"
915 "ac_cv_func_setpgrp_void=no")
916 #:phases
917 (modify-phases %standard-phases
918 (add-after 'unpack 'fix-paths
919 (lambda* (#:key inputs #:allow-other-keys)
920 (let ((gdb (search-input-file inputs "bin/gdb"))
921 (sh (search-input-file inputs "bin/sh")))
922 (substitute* "lib/util/fork_util.cpp"
923 (("GDB = \"gdb\"") (string-append "GDB = \"" gdb "\"")))
924 (substitute* "cgdb/cgdb.cpp" (("/bin/sh") sh))))))))
925 (home-page "https://cgdb.github.io")
926 (synopsis "Console front-end to the GNU debugger")
927 (description
928 "@code{cgdb} is a lightweight curses (terminal-based) interface to the
929GNU Debugger (GDB). In addition to the standard gdb console, cgdb provides
930a split screen view that displays the source code as it executes. The
931keyboard interface is modeled after vim, so vim users should feel at home
932using cgdb.")
933 (license license:gpl2+)))
934
935(define-public mspdebug
936 ;; Last official release was 24 July 2017
937 (let ((commit "4c4d94e43bc4a18ecf82070ff81cd38dd5641e3b")
938 (revision "0"))
939 (package
940 (name "mspdebug")
941 (version (git-version "0.25" revision commit))
942 (source (origin
943 (method git-fetch)
944 (uri (git-reference
945 (url "https://github.com/dlbeer/mspdebug")
946 (commit commit)))
947 (file-name (git-file-name name version))
948 (sha256
949 (base32 "1lgw1dsc1aglyja610ichadvgs5b0df3wlarinczb0ykf431gjln"))))
950 (build-system gnu-build-system)
951 (arguments
952 `(#:tests? #f ; no test suite
953 #:phases
954 (modify-phases %standard-phases
955 (delete 'configure)) ; no configure script
956 #:make-flags
957 (list (string-append "CC=" ,(cc-for-target))
958 "INSTALL=install"
959 (string-append "PREFIX=" %output))))
960 (inputs
961 (list libusb-compat readline))
962 (synopsis "Debugging tool for MSP430 MCUs")
963 (description "MspDebug supports FET430UIF, eZ430, RF2500 and Olimex
964MSP430-JTAG-TINY programmers, as well as many other compatible
965devices. It can be used as a proxy for gdb or as an independent
966debugger with support for programming, disassembly and reverse
967engineering.")
968 (home-page "https://github.com/dlbeer/mspdebug")
969 (license license:gpl2+))))
970
971(define-public seer-gdb
972 (package
973 (name "seer-gdb")
974 (version "1.16")
975 (source (origin
976 (method git-fetch)
977 (uri (git-reference
978 (url "https://github.com/epasveer/seer.git")
979 (commit (string-append "v" version))))
980 (file-name (string-append name "-" version "-checkout"))
981 (sha256
982 (base32
983 "0jdvyg2jab1pvf36pvkyrfsg2wyy8zp1qx0v2ksclgrnr1hja6k6"))))
984 (build-system qt-build-system)
985 (arguments
986 `(#:tests? #f ; Those are strangely manual
987 #:phases
988 (modify-phases %standard-phases
989 (add-after 'unpack 'chdir
990 (lambda _
991 (chdir "src"))))))
992 (inputs
993 (list qtbase-5 qtcharts-5 qtwayland-5))
994 (synopsis "GUI frontend for GDB")
995 (description "This package provides a frontend to GDB, the GNU debugger.")
996 (home-page "https://github.com/epasveer/seer")
997 ;; Note: Some icons in src/resources are creative commons 3.0 and/or 4.0.
998 (license license:gpl3+)))
999
1000(define-public ddd
1001 (package
1002 (name "ddd")
1003 (version "3.4.1")
1004 (source (origin
1005 (method url-fetch)
1006 (uri (string-append "mirror://gnu/ddd/ddd-" version ".tar.gz"))
1007 (patches (search-patches "ddd-build.patch"))
1008 (sha256
1009 (base32
1010 "12gfyh139rim49m56lxm36ckdyiiz4n3la3y6ik1aqgrqfk1fxdq"))))
1011 (build-system gnu-build-system)
1012 (arguments
1013 (list #:tests? #f ;tests require manual intervention
1014 #:configure-flags
1015 #~(list (string-append "--with-freetype-includes="
1016 #$(this-package-input "freetype") "/include/freetype2"))))
1017 (native-inputs
1018 (list pkg-config bison flex perl))
1019 (inputs
1020 (list libxaw libxft freetype motif ncurses gdb))
1021 (synopsis "Graphical front-end for GDB and other debuggers")
1022 (description "GNU DDD, the Data Display Debugger, is a graphical front-end
1023for command-line debuggers. Many back-end debuggers are supported, notably
1024the GNU debugger, GDB. In addition to usual debugging features such as
1025viewing the source files, DDD has additional graphical, interactive features
1026to aid in debugging.")
1027 (home-page "https://www.gnu.org/software/ddd/")
1028 (license license:gpl3+)))
1029
1030(define-public delve
1031 (package
1032 (name "delve")
1033 (version "1.25.2")
1034 (source
1035 (origin
1036 (method git-fetch)
1037 (uri (git-reference
1038 (url "https://github.com/go-delve/delve")
1039 (commit (string-append "v" version))))
1040 (file-name (git-file-name name version))
1041 (sha256
1042 (base32
1043 "1b6vp6m4vjx4wfs1djhpizvz40s563jwld9lgjq82svaiilrmlqa"))
1044 (snippet
1045 #~(begin (use-modules (guix build utils))
1046 (delete-file-recursively "vendor")))))
1047 (build-system go-build-system)
1048 (arguments
1049 (list
1050 #:install-source? #f
1051 #:import-path "github.com/go-delve/delve/cmd/dlv"
1052 #:unpack-path "github.com/go-delve/delve"
1053 ;; [1] Want mod github.com/go-delve/delve and dep
1054 ;; github.com/google/go-dap in the output.
1055 ;; [2] Output of go tool nm contains MethodByName.
1056 #:test-flags #~(list "-skip" "TestVersion|TestDeadcodeEliminated")))
1057 (native-inputs
1058 (list go-github-com-cilium-ebpf
1059 go-github-com-cosiner-argv
1060 go-github-com-creack-pty
1061 go-github-com-derekparker-trie
1062 go-github-com-go-delve-liner
1063 go-github-com-google-go-dap
1064 go-github-com-hashicorp-golang-lru
1065 go-github-com-mattn-go-colorable
1066 go-github-com-mattn-go-isatty
1067 go-github-com-spf13-cobra
1068 go-github-com-spf13-pflag
1069 go-go-starlark-net
1070 go-golang-org-x-arch
1071 go-golang-org-x-sys
1072 go-golang-org-x-telemetry
1073 go-golang-org-x-tools
1074 go-gopkg-in-yaml-v3))
1075 (home-page "https://github.com/go-delve/delve")
1076 (synopsis "Debugger for the Go programming language")
1077 (description "Delve is a debugger for the Go programming language.")
1078 (license license:expat)))
1079
1080(define-public fiu
1081 (package
1082 (name "fiu")
1083 (version "1.2")
1084 (source
1085 (origin
1086 (method url-fetch)
1087 (uri (string-append "https://blitiri.com.ar/p/libfiu/files/"
1088 version "/libfiu-" version ".tar.gz"))
1089 (sha256
1090 (base32 "0x4ncvi6sv22rqi9x61byybpmch0z1zvpr6p48axkk890ysv6fim"))))
1091 (build-system gnu-build-system)
1092 (arguments
1093 (list #:make-flags #~(list (string-append "PREFIX=" #$output)
1094 (string-append "CC=" #$(cc-for-target))
1095 (string-append "LDFLAGS=-Wl,-rpath="
1096 #$output "/lib"))
1097 #:phases #~(modify-phases %standard-phases
1098 (delete 'configure)
1099 (add-before 'check 'set-env
1100 ;; Shorten paths to sockets in tests.
1101 (lambda _ (setenv "TMPDIR" "/tmp"))))
1102 #:test-target "test"))
1103 (native-inputs (list python)) ; for tests
1104 (synopsis "Fault injector in userspace")
1105 (description "Fiu provides CLI utilities and a C library
1106to mark points of failure inside your code
1107and to enable/disable the failure of those points.")
1108 (home-page "https://blitiri.com.ar/p/libfiu")
1109 (license license:public-domain)))
1110
1111(define-public python-fiu
1112 (package
1113 (name "python-fiu")
1114 (version "1.2")
1115 (source (package-source fiu))
1116 (build-system pyproject-build-system)
1117 (arguments
1118 (list #:phases #~(modify-phases %standard-phases
1119 (add-after 'unpack 'enter-python-dir
1120 (lambda _ (chdir "bindings/python")))
1121 (add-before 'build 'set-env
1122 (lambda* (#:key inputs #:allow-other-keys)
1123 (setenv "PLIBPATH"
1124 (string-append (assoc-ref inputs "fiu")
1125 "/lib")))))
1126 #:tests? #f)) ; tests run in fiu
1127 (native-inputs (list python-setuptools python-wheel))
1128 (inputs (list fiu))
1129 (synopsis "Python binding for fiu (fault injection in userspace)")
1130 (description "This package includes two Python modules:
1131@enumerate
1132@item @code{fiu} is a wrapper for @code{libfiu}, the fault injection C library.
1133@item @code{fiu_ctrl} provide an easy way run a command
1134with @code{libfiu} enabled, and controlling the failure points dynamically.
1135@end enumerate")
1136 (home-page (package-home-page fiu))
1137 (license (package-license fiu))))