gnu: qemu-for-american-fuzzy-lop: Fix build.
[jackhill/guix/guix.git] / gnu / packages / debug.scm
CommitLineData
8d809faf 1;;; GNU Guix --- Functional package management for GNU
4dfbebdb 2;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2020 Eric Bavier <bavier@posteo.net>
b82cc0b9 3;;; Copyright © 2016, 2017, 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
968b1a3e 4;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
f20c64ed 5;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com>
a778f270 6;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com>
a5a2d79b 7;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
11f1001c 8;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
bc23c3ec 9;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
8d809faf
EB
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages debug)
27 #:use-module (guix packages)
c9164d30 28 #:use-module ((guix licenses) #:prefix license:)
8d809faf 29 #:use-module (guix download)
b718bef0 30 #:use-module (guix git-download)
426fde9a 31 #:use-module (guix utils)
8d809faf 32 #:use-module (guix build-system gnu)
8a49e63b 33 #:use-module (guix build-system cmake)
268efd97
LF
34 #:use-module (gnu packages)
35 #:use-module (gnu packages attr)
b718bef0
EB
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages base)
426fde9a 38 #:use-module (gnu packages bash)
268efd97 39 #:use-module (gnu packages bison)
bc23c3ec 40 #:use-module (gnu packages c)
8a49e63b 41 #:use-module (gnu packages code)
268efd97 42 #:use-module (gnu packages compression)
426fde9a 43 #:use-module (gnu packages flex)
8a49e63b 44 #:use-module (gnu packages gdb)
a778f270 45 #:use-module (gnu packages glib)
f20c64ed 46 #:use-module (gnu packages gtk)
b718bef0 47 #:use-module (gnu packages golang)
268efd97 48 #:use-module (gnu packages image)
11f1001c 49 #:use-module (gnu packages libusb)
268efd97 50 #:use-module (gnu packages linux)
426fde9a 51 #:use-module (gnu packages llvm)
268efd97 52 #:use-module (gnu packages ncurses)
8a49e63b 53 #:use-module (gnu packages ninja)
426fde9a 54 #:use-module (gnu packages perl)
8a49e63b 55 #:use-module (gnu packages pkg-config)
9b459fc7 56 #:use-module (gnu packages pretty-print)
f20c64ed 57 #:use-module (gnu packages python)
8a49e63b 58 #:use-module (gnu packages python-xyz)
a778f270 59 #:use-module (gnu packages readline)
8a49e63b 60 #:use-module (gnu packages serialization)
59132b80 61 #:use-module (gnu packages virtualization)
268efd97 62 #:use-module (gnu packages xdisorg)
9b459fc7
EB
63 #:use-module (ice-9 match)
64 #:use-module (srfi srfi-1))
8d809faf
EB
65
66(define-public delta
67 (package
68 (name "delta")
69 (version "2006.08.03")
70 (source
71 (origin
72 (method url-fetch)
73 (uri (list
efd63d02 74 (string-append "mirror://debian/pool/main/d/delta/"
8d809faf
EB
75 "delta_" version ".orig.tar.gz")
76 ;; This uri seems to send guix download into an infinite loop
77 (string-append "http://delta.tigris.org/files/documents/3103/"
78 "33566/delta-" version ".tar.gz")))
79 (sha256
80 (base32
81 "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q"))))
82 (build-system gnu-build-system)
83 (inputs ;Installed programs are perl scripts
84 `(("perl" ,perl)))
85 (arguments
86 `(#:phases
dc1d3cde
KK
87 (modify-phases %standard-phases
88 (replace 'install
89 (lambda* (#:key outputs #:allow-other-keys)
90 ;; Makefile contains no install target
91 (let* ((out (assoc-ref outputs "out"))
92 (bin (string-append out "/bin"))
93 (doc (string-append out "/share/doc/delta-" ,version)))
94 (begin
dc1d3cde
KK
95 (for-each (lambda (h)
96 (install-file h doc))
97 `("License.txt" ,@(find-files "www" ".*\\.html")))
98 (for-each (lambda (b)
99 (install-file b bin))
100 `("delta" "multidelta" "topformflat"))))
101 #t))
139ecdee 102 (delete 'configure)))) ; no configure script
8d809faf
EB
103 (home-page "http://delta.tigris.org/")
104 (synopsis "Heuristical file minimizer")
105 (description
106 "Delta assists you in minimizing \"interesting\" files subject to a test
107of their interestingness. A common such situation is when attempting to
108isolate a small failure-inducing substring of a large input that causes your
109program to exhibit a bug.")
110 ;; See License.txt, which is a bsd-3 license, despite the project's
111 ;; home-page pointing to a bsd-2 license.
c9164d30 112 (license license:bsd-3)))
426fde9a
EB
113
114(define-public c-reduce
115 (package
116 (name "c-reduce")
1d552f63 117 (version "2.10.0")
426fde9a
EB
118 (source
119 (origin
120 (method url-fetch)
121 (uri (list
c23c628e 122 (string-append "http://embed.cs.utah.edu/creduce/"
426fde9a
EB
123 "creduce-" version ".tar.gz")))
124 (sha256
1d552f63 125 (base32 "0qx0zq8jxzx2as2zf0740g7kvgq163ayn3041di4vwk77490y76v"))))
426fde9a 126 (build-system gnu-build-system)
a5a2d79b 127 (native-inputs `(("flex" ,flex)))
426fde9a
EB
128 (inputs
129 `(("astyle" ,astyle)
1d552f63
TGR
130 ("llvm" ,llvm)
131 ("clang" ,clang)
426fde9a
EB
132 ("indent" ,indent)
133 ("perl" ,perl)
426fde9a
EB
134 ("exporter-lite" ,perl-exporter-lite)
135 ("file-which" ,perl-file-which)
136 ("getopt-tabular" ,perl-getopt-tabular)
137 ("regex-common" ,perl-regexp-common)
28f45dd7 138 ("term-readkey" ,perl-term-readkey)))
426fde9a 139 (arguments
dc1d3cde
KK
140 `(#:phases
141 (modify-phases %standard-phases
a6de569e
EB
142 (replace 'check
143 (lambda _
144 (with-directory-excursion "tests"
145 ;; Running all tests can take a looong time, and tests 4 and 5
146 ;; require frama-c or kcc. So run just one for sanity.
147 (invoke "./run_tests" "1"))))
dc1d3cde
KK
148 (add-after 'install 'set-load-paths
149 (lambda* (#:key inputs outputs #:allow-other-keys)
150 ;; Tell creduce where to find the perl modules it needs.
151 (let* ((out (assoc-ref outputs "out"))
152 (prog (string-append out "/bin/creduce")))
153 (wrap-program
154 prog
155 `("PERL5LIB" ":" prefix
156 ,(map (lambda (p)
157 (string-append (assoc-ref inputs p)
158 "/lib/perl5/site_perl/"
159 ,(package-version perl)))
160 '("term-readkey" "exporter-lite"
161 "file-which" "getopt-tabular"
a6de569e 162 "regex-common")))))
dc1d3cde 163 #t)))))
7649e426 164 (home-page "https://embed.cs.utah.edu/creduce")
426fde9a
EB
165 (synopsis "Reducer for interesting code")
166 (description
167 "C-Reduce is a tool that takes a large C or C++ program that has a
168property of interest (such as triggering a compiler bug) and automatically
169produces a much smaller C/C++ program that has the same property. It is
170intended for use by people who discover and report bugs in compilers and other
171tools that process C/C++ code.")
c9164d30 172 (license license:ncsa)))
9b459fc7
EB
173
174(define-public american-fuzzy-lop
175 (let ((machine (match (or (%current-target-system)
176 (%current-system))
177 ("x86_64-linux" "x86_64")
178 ("i686-linux" "i386")
aacefef2
EF
179 ("aarch64-linux" "aarch64")
180 ("armhf-linux" "arm")
181 ("mips64el-linux" "mips64el")
9b459fc7
EB
182 ;; Prevent errors when querying this package on unsupported
183 ;; platforms, e.g. when running "guix package --search="
184 (_ "UNSUPPORTED"))))
185 (package
186 (name "american-fuzzy-lop")
3ba980b1 187 (version "2.56b") ;It seems all releases have the 'b' suffix
9b459fc7
EB
188 (source
189 (origin
3ba980b1
TGR
190 (method git-fetch)
191 (uri (git-reference
192 (url "https://github.com/google/AFL")
193 (commit (string-append "v" version))))
9b459fc7 194 (sha256
3ba980b1
TGR
195 (base32 "1q1g59gkm48aa4cg9h70jx4i2gapmypgp5rzs156b2avd95vwkn1"))
196 (file-name (git-file-name name version))))
9b459fc7
EB
197 (build-system gnu-build-system)
198 (inputs
268efd97 199 `(("qemu" ,qemu-for-american-fuzzy-lop)))
9b459fc7
EB
200 (arguments
201 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
317b13f3
TGR
202 (string-append "DOC_PATH=$(PREFIX)/share/doc/"
203 ,name "-" ,version)
9b459fc7
EB
204 "CC=gcc")
205 #:phases (modify-phases %standard-phases
3ba980b1
TGR
206 (add-after 'unpack 'make-git-checkout-writable
207 (lambda _
208 (for-each make-file-writable (find-files "."))
209 #t))
9b459fc7 210 (delete 'configure)
aacefef2
EF
211 ,@(if (string=? (%current-system) (or "x86_64-linux"
212 "i686-linux"))
213 '()
214 '((add-before 'build 'set-afl-flag
215 (lambda _ (setenv "AFL_NO_X86" "1") #t))
216 (add-after 'install 'remove-x86-programs
217 (lambda* (#:key outputs #:allow-other-keys)
218 (let* ((out (assoc-ref outputs "out"))
219 (bin (string-append out "/bin/")))
220 (delete-file (string-append bin "afl-gcc"))
221 (delete-file (string-append bin "afl-g++"))
222 (delete-file (string-append bin "afl-clang"))
223 (delete-file (string-append bin "afl-clang++")))
224 #t))))
9b459fc7
EB
225 (add-after
226 ;; TODO: Build and install the afl-llvm tool.
227 'install 'install-qemu
228 (lambda* (#:key inputs outputs #:allow-other-keys)
268efd97 229 (let ((qemu (assoc-ref inputs "qemu"))
9b459fc7 230 (out (assoc-ref outputs "out")))
b6d937d9
EB
231 (symlink (string-append qemu "/bin/qemu-" ,machine)
232 (string-append out "/bin/afl-qemu-trace"))
9b459fc7 233 #t)))
3ba980b1 234 (delete 'check)))) ; tests are run during 'install phase
38e1b9ef 235 (home-page "https://lcamtuf.coredump.cx/afl/")
9b459fc7
EB
236 (synopsis "Security-oriented fuzzer")
237 (description
238 "American fuzzy lop is a security-oriented fuzzer that employs a novel
239type of compile-time instrumentation and genetic algorithms to automatically
240discover clean, interesting test cases that trigger new internal states in the
241targeted binary. This substantially improves the functional coverage for the
242fuzzed code. The compact synthesized corpora produced by the tool are also
243useful for seeding other, more labor- or resource-intensive testing regimes
244down the road.")
c9164d30 245 (license license:asl2.0))))
b718bef0 246
268efd97
LF
247(define-public qemu-for-american-fuzzy-lop
248 ;; afl only supports using a single afl-qemu-trace executable, so
249 ;; we only build qemu for the native target.
250 (let ((machine (match (or (%current-target-system)
251 (%current-system))
252 ("x86_64-linux" "x86_64")
253 ("i686-linux" "i386")
254 ("aarch64-linux" "aarch64")
255 ("armhf-linux" "arm")
256 ("mips64el-linux" "mips64el")
257 ;; Prevent errors when querying this package on unsupported
258 ;; platforms, e.g. when running "guix package --search="
259 (_ "UNSUPPORTED"))))
260 (hidden-package
261 (package
262 (name "qemu")
263 (version "2.10.2")
264 (source (origin
265 (method url-fetch)
266 (uri (string-append "https://download.qemu.org/qemu-"
267 version ".tar.xz"))
268 (sha256
269 (base32
270 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
271 (patches
b82cc0b9
EF
272 (search-patches "qemu-glibc-2.27.patch"
273 "qemu-glibc-2.30.patch"))))
268efd97
LF
274 (build-system gnu-build-system)
275 (arguments
276 `(;; Running tests in parallel can occasionally lead to failures, like:
277 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
278 #:parallel-tests? #f
279 #:configure-flags
280 (list (string-append "--target-list=" ,machine "-linux-user"))
281 #:make-flags '("V=1")
282 #:phases
283 (modify-phases %standard-phases
284 (replace 'configure
285 (lambda* (#:key inputs outputs (configure-flags '())
286 #:allow-other-keys)
287 ;; The `configure' script doesn't understand some of the
288 ;; GNU options. Thus, add a new phase that's compatible.
289 (let ((out (assoc-ref outputs "out")))
290 (setenv "SHELL" (which "bash"))
291
292 ;; While we're at it, patch for tests.
293 (substitute* "tests/libqtest.c"
294 (("/bin/sh") (which "sh")))
295
296 ;; The binaries need to be linked against -lrt.
297 (setenv "LDFLAGS" "-lrt")
298 (apply invoke
299 `("./configure"
300 ,(string-append "--cc=" (which "gcc"))
301 ;; Some architectures insist on using HOST_CC
302 ,(string-append "--host-cc=" (which "gcc"))
303 "--disable-debug-info" ; save build space
304 "--enable-virtfs" ; just to be sure
305 ,(string-append "--prefix=" out)
306 ,(string-append "--sysconfdir=/etc")
307 ,@configure-flags)))))
308 (add-after
309 'unpack 'apply-afl-patches
310 (lambda* (#:key inputs #:allow-other-keys)
311 (let* ((afl-src (assoc-ref inputs "afl-source"))
312 (patch-dir "qemu_mode/patches"))
313 (copy-recursively (string-append afl-src "/"
314 patch-dir)
315 patch-dir)
316 (install-file
317 (string-append patch-dir
318 "/afl-qemu-cpu-inl.h")
319 ".")
320 (copy-file (string-append afl-src "/config.h")
321 "./afl-config.h")
322 (install-file (string-append afl-src "/types.h")
323 ".")
324 (substitute* "afl-qemu-cpu-inl.h"
325 (("\\.\\./\\.\\./config.h") "afl-config.h"))
326 (substitute* (string-append patch-dir
327 "/cpu-exec.diff")
328 (("\\.\\./patches/") ""))
329
330 ;; These were already applied to qemu-minimal-2.10.
331 (for-each (lambda (obsolete-patch)
332 (delete-file (string-append
333 patch-dir "/"
334 obsolete-patch)))
335 (list "configure.diff"
336 "memfd.diff"))
337
338 (for-each (lambda (patch-file)
339 (invoke "patch" "--force" "-p1"
340 "--input" patch-file))
341 (find-files patch-dir
342 "\\.diff$"))
343 #t)))
344 (add-before 'check 'disable-unusable-tests
345 (lambda* (#:key inputs outputs #:allow-other-keys)
346 (substitute* "tests/Makefile.include"
347 ;; Comment out the test-qga test, which needs /sys and
348 ;; fails within the build environment.
349 (("check-unit-.* tests/test-qga" all)
350 (string-append "# " all)))
351 (substitute* "tests/Makefile.include"
352 ;; Comment out the test-char test, which needs networking and
353 ;; fails within the build environment.
354 (("check-unit-.* tests/test-char" all)
355 (string-append "# " all)))
356 #t)))))
357 (native-inputs
358 `(("python-2" ,python-2) ; QEMU 2 needs Python 2
359 ("glib:bin" ,glib "bin")
360 ("perl" ,perl)
361 ("flex" ,flex)
362 ("bison" ,bison)
363 ("pkg-config" ,pkg-config)))
364 (inputs
365 `(("afl-source" ,(package-source american-fuzzy-lop))
366 ("alsa-lib" ,alsa-lib)
367 ("attr" ,attr)
368 ("glib" ,glib)
369 ("libaio" ,libaio)
370 ("libattr" ,attr)
371 ("libcap" ,libcap)
372 ("libjpeg" ,libjpeg-turbo)
373 ("libpng" ,libpng)
374 ("ncurses" ,ncurses)
375 ("pixman" ,pixman)
376 ("util-linux" ,util-linux)
377 ("zlib" ,zlib)))
378 (home-page "https://www.qemu.org")
379 (synopsis "Machine emulator and virtualizer (without GUI) for american fuzzy lop")
380 (description
381 "QEMU is a generic machine emulator and virtualizer. This package
382of QEMU is used only by the american fuzzy lop package.
383
384When used as a machine emulator, QEMU can run OSes and programs made for one
385machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
386using dynamic translation, it achieves very good performance.
387
388When used as a virtualizer, QEMU achieves near native performances by
389executing the guest code directly on the host CPU. QEMU supports
390virtualization when executing under the Xen hypervisor or using
391the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
392server and embedded PowerPC, and S390 guests.")
393 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
394 (license license:gpl2)
395 ;; Several tests fail on MIPS.
396 (supported-systems (delete "mips64el-linux" %supported-systems))))))
397
b718bef0 398(define-public stress-make
4dfbebdb
EB
399 (let ((commit "97815bed8060de33952475b3498767c91f59ffd9")
400 (revision "2")) ;No official source distribution
b718bef0
EB
401 (package
402 (name "stress-make")
136e3b39 403 (version (git-version "1.0" revision commit))
b718bef0
EB
404 (source
405 (origin
406 (method git-fetch)
407 (uri (git-reference
b0e7b699 408 (url "https://github.com/lanl/stress-make")
b718bef0 409 (commit commit)))
136e3b39 410 (file-name (git-file-name name version))
b718bef0
EB
411 (sha256
412 (base32
4dfbebdb 413 "0k55cy7x0hlc6rgpascl6ibhcfxaash3p9r9r8kwvbm3zag1rmac"))))
b718bef0
EB
414 (build-system gnu-build-system)
415 (native-inputs
416 `(("autoconf" ,autoconf)
417 ("automake" ,automake)
418 ("go" ,go)))
419 (inputs
420 `(("make-source" ,(package-source gnu-make))))
421 (arguments
422 ;; stress-make's configure script insists on having a tarball and does
423 ;; not accept a directory name instead. To let the gnu-build-system's
424 ;; patch-* phases work properly, we unpack the source first, then
425 ;; repack before the configure phase.
05cca6ce 426 (let ((make-dir (string-append "make-" (package-version gnu-make))))
fd466fb8
EB
427 `(#:configure-flags '("--with-make-tar=./make.tar.xz"
428 "make_cv_sys_gnu_glob=yes")
05cca6ce
EB
429 #:phases
430 (modify-phases %standard-phases
431 (add-after 'unpack 'unpack-make
432 (lambda* (#:key inputs #:allow-other-keys)
4aa266a0 433 (invoke "tar" "xf" (assoc-ref inputs "make-source"))))
05cca6ce
EB
434 (add-after 'unpack-make 'set-default-shell
435 (lambda _
436 ;; Taken mostly directly from (@ (gnu packages base) gnu-make)
4dfbebdb 437 (substitute* (string-append ,make-dir "/src/job.c")
05cca6ce
EB
438 (("default_shell = .*$")
439 (format #f "default_shell = \"~a\";\n"
440 (which "sh"))))))
441 (add-before 'configure 'repack-make
442 (lambda _
136e3b39
EB
443 (invoke "tar" "cJf" "./make.tar.xz" ,make-dir)))
444 (add-before 'build 'setup-go
445 ;; The Go cache is required starting in Go 1.12, and it needs
446 ;; to be writable.
447 (lambda _ (setenv "GOCACHE" "/tmp/go-cache") #t))))))
448 (home-page "https://github.com/lanl/stress-make")
b718bef0
EB
449 (synopsis "Expose race conditions in Makefiles")
450 (description
f457397a 451 "Stress Make is a customized GNU Make that explicitly manages the order
a988cbb7
TGR
452in which concurrent jobs are run to provoke erroneous behavior into becoming
453manifest. It can run jobs in the order in which they're launched, in backwards
454order, or in random order. The thought is that if code builds correctly with
455Stress Make, then it is likely that the @code{Makefile} contains no race
456conditions.")
b718bef0
EB
457 ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated,
458 ;; and patched GNU Make is under its own license.
c9164d30
LF
459 (license (list (license:non-copyleft "LICENSE.md")
460 license:gpl3+)))))
660516e8
JD
461
462(define-public zzuf
463 (package
464 (name "zzuf")
465 (version "0.15")
466 (source
467 (origin
468 (method url-fetch)
469 (uri (string-append
470 "https://github.com/samhocevar/zzuf/releases/download/v"
471 version "/" name "-" version ".tar.gz"))
472 (file-name (string-append name "-" version ".tar.gz"))
473 (sha256
474 (base32
475 "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3"))))
476 (build-system gnu-build-system)
477 (home-page "https://github.com/samhocevar/zzuf")
478 (synopsis "Transparent application input fuzzer")
479 (description "Zzuf is a transparent application input fuzzer. It works by
480intercepting file operations and changing random bits in the program's
481input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.")
c9164d30 482 (license license:wtfpl2)))
a778f270
P
483
484(define-public scanmem
485 (package
486 (name "scanmem")
487 (version "0.17")
488 (source
489 (origin
490 (method git-fetch)
491 (uri (git-reference
492 (url "https://github.com/scanmem/scanmem")
493 (commit (string-append "v" version))))
494 (file-name (git-file-name name version))
495 (sha256
496 (base32
497 "17p8sh0rj8yqz36ria5bp48c8523zzw3y9g8sbm2jwq7sc27i7s9"))))
498 (build-system gnu-build-system)
f20c64ed
RH
499 (arguments
500 `(#:configure-flags '("--enable-gui")
501 #:phases
502 (modify-phases %standard-phases
503 (add-before 'configure 'hardcode-python
504 (lambda* (#:key inputs outputs #:allow-other-keys)
505 (substitute* "gui/GameConqueror.py"
506 (("/usr/bin/env python")
507 (string-append (assoc-ref %build-inputs
508 "python-wrapper") "/bin/python")))
509 #t))
510 (add-after 'install 'wrap-gameconqueror
511 (lambda* (#:key inputs outputs #:allow-other-keys)
512 (let ((out (assoc-ref outputs "out"))
513 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
514 (python-path (getenv "PYTHONPATH")))
515 (wrap-program (string-append out "/share/gameconqueror/GameConqueror.py")
516 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
517 `("PYTHONPATH" ":" prefix (,python-path))))
518 #t)))))
a778f270
P
519 (native-inputs
520 `(("libtool" ,libtool)
f20c64ed
RH
521 ("python-wrapper" ,python-wrapper)
522 ("gobject-introspection" ,gobject-introspection)
523 ("gtk+" ,gtk+)
a778f270
P
524 ("intltool" ,intltool)
525 ("automake" ,automake)
526 ("autoconf" ,autoconf)))
527 (inputs
528 `(("readline" ,readline)))
f20c64ed
RH
529 (propagated-inputs
530 `(("python-pygobject" ,python-pygobject)))
a778f270
P
531 (home-page "https://github.com/scanmem/scanmem")
532 (synopsis "Memory scanner")
533 (description "Scanmem is a debugging utility designed to isolate the
534address of an arbitrary variable in an executing process. Scanmem simply
535needs to be told the pid of the process and the value of the variable at
536several different times. After several scans of the process, scanmem isolates
537the position of the variable and allows you to modify its value.")
538 ;; The library is covered by LGPLv3 or later; the application is covered
539 ;; by GPLv3 or later.
c9164d30 540 (license (list license:lgpl3+ license:gpl3+))))
8a49e63b 541
86f86cff
EB
542(define-public remake
543 (package (inherit gnu-make)
544 (name "remake")
545 (version "4.3-1.5")
546 (source (origin
547 (method url-fetch)
548 (uri (let ((upstream-version
549 (match (string-split version #\-)
550 ((ver sub) (string-append ver "%2Bdbg-" sub)))))
551 (string-append "mirror://sourceforge/bashdb/"
552 "remake/" upstream-version "/"
553 "remake-" upstream-version ".tar.gz")))
554 (file-name (string-append "remake-" version ".tar.gz"))
555 (sha256
556 (base32
557 "0xlx2485y0israv2pfghmv74lxcv9i5y65agy69mif76yc4vfvif"))
558 (patches (search-patches "remake-impure-dirs.patch"))))
559 (inputs
560 `(("readline" ,readline)
561 ,@(package-inputs gnu-make)))
562 (home-page "http://bashdb.sourceforge.net/remake/")
563 (description "Remake is an enhanced version of GNU Make that adds improved
564error reporting, better tracing, profiling, and a debugger.")
565 (license license:gpl3+)))
566
8a49e63b
LC
567(define-public rr
568 (package
569 (name "rr")
968b1a3e 570 (version "5.4.0")
8a49e63b
LC
571 (source (origin
572 (method git-fetch)
573 (uri (git-reference
574 (url "https://github.com/mozilla/rr")
575 (commit version)))
576 (sha256
577 (base32
968b1a3e 578 "1sfldgkkmsdyaqa28i5agcykc63gwm3zjihd64g86i852w8al2w6"))
8a49e63b
LC
579 (file-name (git-file-name name version))))
580 (build-system cmake-build-system)
581 (arguments
582 `(#:configure-flags
583 ;; The 'rr_exec_stub' is a static binary, which leads CMake to fail
968b1a3e 584 ;; with ‘file RPATH_CHANGE could not write new RPATH: ...’.
8a49e63b
LC
585 ;; Clear CMAKE_INSTALL_RPATH to avoid that problem.
586 (list "-DCMAKE_INSTALL_RPATH="
968b1a3e
TGR
587 ;; Satisfy the ‘validate-runpath’ phase. This isn't a direct
588 ;; consequence of clearing CMAKE_INSTALL_RPATH.
589 (string-append "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath="
590 (assoc-ref %build-inputs "capnproto") "/lib")
8a49e63b
LC
591 ,@(if (and (not (%current-target-system))
592 (member (%current-system)
593 '("x86_64-linux" "aarch64-linux")))
594 ;; The toolchain doesn't support '-m32'.
595 '("-Ddisable32bit=ON")
596 '()))
597
598 ;; XXX: Most tests fail with:
599 ;;
600 ;; rr needs /proc/sys/kernel/perf_event_paranoid <= 1, but it is 2.
601 ;;
602 ;; This setting cannot be changed from the build environment, so skip
603 ;; the tests.
604 #:tests? #f
605
606 #:phases (modify-phases %standard-phases
607 (add-before 'check 'set-home
608 (lambda _
609 ;; Some tests expect 'HOME' to be set.
610 (setenv "HOME" (getcwd))
611 #t)))))
612 (native-inputs
613 `(("pkg-config" ,pkg-config)
614 ("ninja" ,ninja)
615 ("which" ,which)))
616 (inputs
617 `(("gdb" ,gdb)
00781cb5 618 ("capnproto" ,capnproto)
8a49e63b
LC
619 ("python" ,python)
620 ("python-pexpect" ,python-pexpect)))
621 (home-page "https://rr-project.org/")
622 (synopsis "Record and reply debugging framework")
623 (description
624 "rr is a lightweight tool for recording, replaying and debugging
625execution of applications (trees of processes and threads). Debugging extends
626GDB with very efficient reverse-execution, which in combination with standard
627GDB/x86 features like hardware data watchpoints, makes debugging much more
628fun.")
c9164d30 629 (license license:expat)))
11f1001c 630
7e15ded6
MC
631(define-public libbacktrace
632 ;; There are no releases nor tags.
633 (let ((revision "1")
634 (commit "5009c113981431ae1843ebd29d6ad24eb32fc1b2"))
635 (package
636 (name "libbacktrace")
637 (version (git-version "1.0" revision commit))
638 (source (origin
639 (method git-fetch)
640 (uri (git-reference
641 (url "https://github.com/ianlancetaylor/libbacktrace")
642 (commit commit)))
643 (file-name (git-file-name name version))
644 (sha256
645 (base32
646 "0663zjpfpnsyv9h3pbp7cgmg9gz79n68bqpdl97y6i0jsx93v1zg"))))
647 (build-system gnu-build-system)
648 (arguments
649 `(#:make-flags '("CFLAGS=-fPIC")))
650 (home-page "https://github.com/ianlancetaylor/libbacktrace")
651 (synopsis "C library for producing symbolic backtraces")
652 (description "The @code{libbacktrace} library can be linked into a C/C++
653program to produce symbolic backtraces.")
057a8868 654 (license license:bsd-3))))
7e15ded6 655
bc23c3ec
MC
656(define-public libleak
657 (package
658 (name "libleak")
659 (version "0.3.5")
660 (source (origin
661 (method git-fetch)
662 (uri (git-reference
663 (url "https://github.com/WuBingzheng/libleak")
664 (commit (string-append "v" version))))
665 (file-name (git-file-name name version))
666 (sha256
667 (base32
668 "1p8mb0hcfp8hdv1klv6rrpkn2zlhjxgkxbbjsk8kszxv7ijln87d"))))
669 (build-system gnu-build-system)
670 (arguments
671 `(#:tests? #f ;no test suite
672 #:parallel-build? #f ;jobserver unavailable
673 #:phases (modify-phases %standard-phases
674 (add-after 'unpack 'unbundle-libwuya
675 (lambda _
676 (substitute* "Makefile"
677 ((".*make -C libwuya.*") ""))
678 #t))
679 (add-before 'build 'set-CC
680 (lambda _
681 (setenv "CC" "gcc")
682 #t))
683 (delete 'configure) ;no configure script
684 (replace 'install
685 (lambda* (#:key outputs #:allow-other-keys)
686 (let* ((out (assoc-ref outputs "out")))
687 (install-file "libleak.so" (string-append out "/lib"))
688 #t))))))
689 (inputs `(("libbacktrace" ,libbacktrace)
690 ("libwuya" ,libwuya)))
691 (home-page "https://github.com/WuBingzheng/libleak")
692 (synopsis "Memory leaks detection tool")
693 (description "The libleak tool detects memory leaks by hooking memory
694functions such as @code{malloc}. It comes as a shared object to be pre-loaded
695via @code{LD_PRELOAD} when launching the application. It prints the full call
696stack at suspicious memory leak points. Modifying or recompiling the target
697program is not required, and the detection can be enabled or disabled while
698the target application is running. The overhead incurred by libleak is
699smaller than that of other tools such as Valgrind, and it aims to be easier to
700use than similar tools like @command{mtrace}.")
701 (license license:gpl2+)))
702
11f1001c
MS
703(define-public mspdebug
704 (package
705 (name "mspdebug")
706 (version "0.25")
707 (source (origin
708 (method git-fetch)
709 (uri (git-reference
b0e7b699 710 (url "https://github.com/dlbeer/mspdebug")
11f1001c
MS
711 (commit (string-append "v" version))))
712 (file-name (git-file-name name version))
713 (sha256
714 (base32 "0prgwb5vx6fd4bj12ss1bbb6axj2kjyriyjxqrzd58s5jyyy8d3c"))))
715 (build-system gnu-build-system)
716 (arguments
717 `(#:tests? #f ; no test suite
718 #:phases
719 (modify-phases %standard-phases
720 (delete 'configure)) ; no configure script
721 #:make-flags
722 (list (string-append "CC=" ,(cc-for-target))
723 "INSTALL=install"
724 (string-append "PREFIX=" %output))))
725 (inputs
726 `(("libusb-compat" ,libusb-compat)
727 ("readline" ,readline)))
728 (synopsis "Debugging tool for MSP430 MCUs")
729 (description "MspDebug supports FET430UIF, eZ430, RF2500 and Olimex
730MSP430-JTAG-TINY programmers, as well as many other compatible
731devices. It can be used as a proxy for gdb or as an independent
732debugger with support for programming, disassembly and reverse
733engineering.")
734 (home-page "https://github.com/dlbeer/mspdebug")
735 (license license:gpl2+)))