{ "name": "gdb", "version": "18.1", "summary": "GDB: the GNU debugger for C, C++ and other compiled programs, with gdbserver for remote debugging and the TUI", "category": "tool", "license": "GPL-3.0-or-later", "homepage": "https://www.sourceware.org/gdb/", "source": { "url": "https://mirrors.kernel.org/gnu/gdb/gdb-18.1.tar.xz", "sha256": "cd9fc3fe2b47743840e42c1592d3d87f8302eb18639c0b8b4ba0898002e2348f" }, "watch": {"kind": "index", "url": "https://mirrors.kernel.org/gnu/gdb/", "regex": "gdb-([0-9]+(?:\\.[0-9]+)+)\\.tar\\.xz", "pin": "any"}, "deps": [ "gmp", "mpfr", "expat", "readline", "ncurses", "zlib", "zstd", "xz" ], "env_packages": [], "static": true, "nss": true, "check": "t=$(mktemp -d) && bin/gdb --version | has '^GNU gdb (GDB) 18.1' && bin/gdbserver --version | has '^GNU gdbserver (GDB) 18.1' && if [ -n \"$HOST\" ]; then echo \"gdb 18.1: debugging not run in a cross build (qemu-user has no ptrace)\"; else printf '#include \\nint add(int a, int b) { int s = a + b; return s; }\\nint main(void) { int r = add(2, 3); printf(\"%%d\\\\n\", r); return r == 5 ? 0 : 1; }\\n' > \"$t/p.c\" && $CC -g -O0 -o \"$t/p\" \"$t/p.c\" && bin/gdb -nx -batch -ex 'break add' -ex run -ex 'print a + b' -ex 'info args' -ex bt -ex continue \"$t/p\" > \"$t/out\" 2>&1 && has '^\\$1 = 5$' < \"$t/out\" && has '^a = 2$' < \"$t/out\" && has 'in main () at' < \"$t/out\" && has 'exited normally' < \"$t/out\" && P=$(free_port) && { bin/gdbserver --once \"127.0.0.1:$P\" \"$t/p\" > \"$t/srv\" 2>&1 & echo $! > \"$t/pid\"; } && wait_port \"$P\" && bin/gdb -nx -batch -ex \"target remote 127.0.0.1:$P\" -ex 'break add' -ex continue -ex 'print a * b' -ex continue \"$t/p\" > \"$t/rout\" 2>&1 && has '^\\$1 = 6$' < \"$t/rout\" && echo \"gdb 18.1: a breakpoint, a printed expression and a backtrace in a C program; the same through gdbserver on port $P\"; fi; r=$?; [ -f \"$t/pid\" ] && kill \"$(cat \"$t/pid\")\" 2>/dev/null; exit $r" }