From d0a1c0701a8a3f022f8201818fb2f3f6d89d938a Mon Sep 17 00:00:00 2001 From: Regia König Date: Mon, 5 Sep 2022 20:28:22 +0200 Subject: Rename dir and experiment with cmdline options --- bash_experiments/README | 15 ++++++++++++++ bash_experiments/cmd_options.sh | 44 +++++++++++++++++++++++++++++++++++++++++ bash_experiments/gdb_python.py | 4 ++++ bash_experiments/just_gdb | 4 ++++ multiprocessbash/README | 15 -------------- multiprocessbash/gdb_python.py | 4 ---- multiprocessbash/just_gdb | 4 ---- 7 files changed, 67 insertions(+), 23 deletions(-) create mode 100644 bash_experiments/README create mode 100755 bash_experiments/cmd_options.sh create mode 100755 bash_experiments/gdb_python.py create mode 100644 bash_experiments/just_gdb delete mode 100644 multiprocessbash/README delete mode 100755 multiprocessbash/gdb_python.py delete mode 100644 multiprocessbash/just_gdb diff --git a/bash_experiments/README b/bash_experiments/README new file mode 100644 index 0000000..995bf9f --- /dev/null +++ b/bash_experiments/README @@ -0,0 +1,15 @@ +Load gdb script from commandline: + +gdb --command script.py + + +Automatially load gdb_python-script: +.gdbinit + +source /path/to/hello.py +source /path/to/foobar.py +etc, etc + +THE solution: +gnome-terminal -- "gdb -x gdb_python.py" && gnome-terminal -- "qemu-system-x86_64" + diff --git a/bash_experiments/cmd_options.sh b/bash_experiments/cmd_options.sh new file mode 100755 index 0000000..e1b5656 --- /dev/null +++ b/bash_experiments/cmd_options.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +echo $0 +echo $1 + +Help() { + echo "Add description of the script functions here." + echo + echo "Syntax: scriptTemplate [-g|h|v|V]" + echo "options:" + echo "g Print the GPL license notification." + echo "h Print this Help." + echo "v Verbose mode." + echo "V Print software version and exit." + echo +} + +Name=World + +# +# The while-done structure defines a loop that executes once for each option +# in the getopts - option structure. The ":h" string - which requires the quotes +# - lists the possible input options that will be evaluated by the case - esac +# structure. Each option listed must have a corresponding stanza in the case statement. +# exit;; exits from the program without executing any more code even if some +# exists. The option processing loop is also terminated, so no additional +# options would be checked +while getopts ":hn:" option; do + + case $option in + h) # display Help + Help + exit;; + n) # Enter a name + Name=$OPTARG;; + \?) # invalid option + echo "Error: Invalid option" + echo $option + exit;; + esac + +done + +echo "Hello $Name" diff --git a/bash_experiments/gdb_python.py b/bash_experiments/gdb_python.py new file mode 100755 index 0000000..e5f5f7e --- /dev/null +++ b/bash_experiments/gdb_python.py @@ -0,0 +1,4 @@ +#!/usr/bin/python + +print("khlkjh") +#gdb.execute("quit") diff --git a/bash_experiments/just_gdb b/bash_experiments/just_gdb new file mode 100644 index 0000000..ad2f8e5 --- /dev/null +++ b/bash_experiments/just_gdb @@ -0,0 +1,4 @@ +add-symbol-file ~/Memtest/git/memtest86plus_debug/build64/memtest.debug 0x201000 +b main +info b +quit diff --git a/multiprocessbash/README b/multiprocessbash/README deleted file mode 100644 index 8428969..0000000 --- a/multiprocessbash/README +++ /dev/null @@ -1,15 +0,0 @@ -Load gdb script from commandline: - -gdb --command script.py - - -Automatially load gdb_python-script: -.gdbinit - -source /path/to/hello.py -source /path/to/foobar.py -etc, etc - -THE solution: -gnome-terminal -- "gdb -x gdb_python.py" & gnome-terminal -- "qemu-system-x86_64" - diff --git a/multiprocessbash/gdb_python.py b/multiprocessbash/gdb_python.py deleted file mode 100755 index a3df392..0000000 --- a/multiprocessbash/gdb_python.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/python - -print("khlkjh") -gdb.execute("quit") diff --git a/multiprocessbash/just_gdb b/multiprocessbash/just_gdb deleted file mode 100644 index ad2f8e5..0000000 --- a/multiprocessbash/just_gdb +++ /dev/null @@ -1,4 +0,0 @@ -add-symbol-file ~/Memtest/git/memtest86plus_debug/build64/memtest.debug 0x201000 -b main -info b -quit -- cgit v1.2.3-55-g7522