fork/rust
git clone https://git.julia.blue/fork/rust
49cae55760d
1.44.0
1#!/bin/sh 2 3# Exit if anything fails 4set -e 5 6if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then 7 echo " 8rust-gdbgui 9=========== 10gdbgui - https://gdbgui.com - is a graphical front-end to GDB 11that runs in a browser. This script invokes gdbgui with the Rust 12pretty printers loaded. 13 14Simple usage : rust-gdbgui target/debug/myprog 15With arguments: rust-gdbgui 'target/debug/myprog arg1 arg2...' 16 (note the quotes) 17 18 19Hints 20===== 21gdbgui won't be able to find the rust 'main' method automatically, so 22in its options make sure to disable the 'Add breakpoint to main after 23loading executable' setting to avoid a 'File not found: main' warning 24on startup. 25 26Instead, type 'main' into gdbgui's file browser and you should get 27auto-completion on the filename. Just pick 'main.rs', add a breakpoint 28by clicking in the line number gutter, and type 'r' or hit the Restart 29icon to start your program running. 30" 31 exit 0 32fi 33 34# Prefer rustc in the same directory as this script 35DIR="$(dirname "$0")" 36if [ -x "$DIR/rustc" ]; then 37 RUSTC="$DIR/rustc" 38else 39 RUSTC="rustc" 40fi 41 42# Find out where the pretty printer Python module is 43RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)" 44GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" 45 46# Set the environment variable `RUST_GDB` to overwrite the call to a 47# different/specific command (defaults to `gdb`). 48RUST_GDB="${RUST_GDB:-gdb}" 49 50# Set the environment variable `RUST_GDBGUI` to overwrite the call to a 51# different/specific command (defaults to `gdbgui`). 52RUST_GDBGUI="${RUST_GDBGUI:-gdbgui}" 53 54# These arguments get passed through to GDB and make it load the 55# Rust pretty printers. 56GDB_ARGS="--directory=\"$GDB_PYTHON_MODULE_DIRECTORY\" -iex \"add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY\"" 57 58# Finally we execute gdbgui. 59PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" \ 60 exec ${RUST_GDBGUI} \ 61 --gdb ${RUST_GDB} \ 62 --gdb-args "${GDB_ARGS}" \ 63 "${@}" 64