magic/scripts/run_magic_gdb.sh.in

32 lines
1.3 KiB
Bash

#!/usr/bin/env bash
#
# run_magic_gdb.sh -- run magic (GUI) under gdb, straight from the build tree.
# Generated by configure from scripts/run_magic_gdb.sh.in.
#
# PURPOSE
# Debug the just-built magic without `make install`. Stages ${builddir}/CAD_DIR
# (symlinks) on first run, exports CAD_ROOT, then starts gdb on the self-contained
# "magicexec". Symbols come straight from the build tree.
#
# USAGE
# ./run_magic_gdb.sh [magic-args...] # then `run` at the (gdb) prompt
# For batch/no-GUI debugging (no X display needed, reproducible), debug the null
# binary instead:
# gdb --args "$MAGIC_TCL/magicdnull" -dnull -nowrapper
#
# ENVIRONMENT OVERRIDES (all optional; each wins over the baked default)
# CAD_ROOT reuse an alternate runtime tree instead of staging $builddir/CAD_DIR
# MAGIC_WISH wish for the Tk console (default: the configure-matched wish)
# WISH TCLSH wish/tclsh matching this build's Tcl/Tk (--with-tk / --with-tcl)
# MAGIC_BUILDDIR MAGIC_SRCDIR build/source tops (default: baked-in absolutes)
# Inherited values are sanity-checked; problems print as stderr warnings.
# See magic_run_common.sh for the authoritative list and defaults.
set -eu
here="$(cd "$(dirname "$0")" && pwd)"
. "$here/magic_run_common.sh"
magic_require_built
magic_stage
exec gdb --args "$MAGIC_TCL/magicexec" -- "$@"