fork/rust
git clone https://git.julia.blue/fork/rust
f3e1a954d2e
1.41.1
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# Find out where the pretty printer Python module is 35RUSTC_SYSROOT=`rustc --print=sysroot` 36GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" 37 38# Set the environment variable `RUST_GDB` to overwrite the call to a 39# different/specific command (defaults to `gdb`). 40RUST_GDB="${RUST_GDB:-gdb}" 41 42# Set the environment variable `RUST_GDBGUI` to overwrite the call to a 43# different/specific command (defaults to `gdbgui`). 44RUST_GDBGUI="${RUST_GDBGUI:-gdbgui}" 45 46# These arguments get passed through to GDB and make it load the 47# Rust pretty printers. 48GDB_ARGS="--directory=\"$GDB_PYTHON_MODULE_DIRECTORY\" -iex \"add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY\"" 49 50# Finally we execute gdbgui. 51PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" \ 52 exec ${RUST_GDBGUI} \ 53 --gdb ${RUST_GDB} \ 54 --gdb-args "${GDB_ARGS}" \ 55 "${@}" 56