debug.scm 34 KB

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