diff --git a/CHANGELOG.md b/CHANGELOG.md index 05e7aaff96c0ed0c85ed9fe6223aff2e37226699..82025834cbdb67400445db6804edd85090bb82c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### New Features +* Arguments have been added to `iocsh.bash` to enable user to pass any debugger options to GDB and Valgrind. * Autocompletion for `iocsh.bash` has been added * Removed `iocsh_gdb.bash` and `iocsh_nice.bash`, both of whose functionality can be called via `iocsh.bash -dg` and `iocsh.bash -n`, respectively. * Patch file location has been change from `patch/Site/$VERSION-description.p0.patch` to `patch/Site/$VERSION/description.p0.patch` diff --git a/require-ess/tools/iocsh_functions.bash b/require-ess/tools/iocsh_functions.bash index b4f8e1ab000ea8ad7e31d1b6a90eeee6ac10bdd9..82e08942ec3547a831815ae741a98cabb9587e2c 100644 --- a/require-ess/tools/iocsh_functions.bash +++ b/require-ess/tools/iocsh_functions.bash @@ -330,12 +330,28 @@ function loadFiles() { EPICS_DRIVER_PATH="$add_path:$EPICS_DRIVER_PATH" ;; -dg) - shift - __LOADER__="gdb --eval-command run --args " + if [[ -n "${2%--dgarg=*}" ]]; then + __LOADER__="gdb --eval-command run --args " + else + shift + if [[ -z "${1#*=}" ]]; then + __LOADER__="gdb " + else + __LOADER__="gdb ${1#*=} " + fi + fi ;; -dv) - shift - __LOADER__="valgrind --leak-check=full " + if [[ -n "${2%--dvarg=*}" ]]; then + __LOADER__="valgrind --leak-check=full " + else + shift + if [[ -z "${1#*=}" ]]; then + __LOADER__="valgrind " + else + __LOADER__="valgrind ${1#*=} " + fi + fi ;; -n) __LOADER__="nice --10 " @@ -344,7 +360,6 @@ function loadFiles() { -*) printf "Unknown option %s\n\n" "$1" >&2 help - exit 1 ;; *.so) echo "dlload \"$file\"" @@ -432,8 +447,8 @@ function help() { printf " (Also -noinit, --noinit)\n" printf " -r module[,ver] Module (optionally with version) loaded via 'require'.\n" printf " -l 'cell path' Run Ioc with a cell path.\n" - printf " -dg Run with debugger gdb.\n" - printf " -dv Run with valgrind.\n" + printf " -dg [--dgarg='gdb-options'] Run with debugger gdb with user selected options or default option.\n" + printf " -dv [--dvarg='valgrind-options'] Run with valgrind with user selected options or default option.\n" printf " -n Run with 'nice --10' (requires sudo).\n" printf " @file More arguments are read from file.\n\n" printf "Supported filetypes:\n\n" @@ -449,8 +464,9 @@ function help() { printf " iocsh.bash my_database.template P=XY M=3\n" printf " iocsh.bash -r my_module,version -c 'initModule()'\n" printf " iocsh.bash -c 'var requireDebug 1' st.cmd\n" - printf " iocsh.bash -i st.cmd\n\n" - + printf " iocsh.bash -i st.cmd\n" + printf " iocsh.bash -dv --dvarg='--vgdb=full'\n" + printf " iocsh.bash -dv st.cmd\n\n" } >&2 exit }