diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-23 12:49:33 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-23 12:49:33 +0200 |
commit | d6bf11f104a6f4326b7efab308228949cbcf601e (patch) | |
tree | 4478eedc399a962ba149ff512a9a26839d0f1e58 | |
parent | 56bbfce22cc0f0b567f650167f82ce3f7d90e625 (diff) |
checkpoint
-rwxr-xr-x | bin/extra/gccg | 2 | ||||
-rwxr-xr-x | bin/extra/gdbcore | 45 | ||||
-rw-r--r-- | config/essentials/shell/aliases.sh | 1 | ||||
-rw-r--r-- | config/essentials/shell/functions.sh | 1 |
4 files changed, 30 insertions, 19 deletions
diff --git a/bin/extra/gccg b/bin/extra/gccg new file mode 100755 index 0000000..89cc822 --- /dev/null +++ b/bin/extra/gccg @@ -0,0 +1,2 @@ +#!/bin/sh +gcc -ggdb -Wall -pedantic -std=c99 -o ${1%.c} $@ diff --git a/bin/extra/gdbcore b/bin/extra/gdbcore index 24c058a..3364ce8 100755 --- a/bin/extra/gdbcore +++ b/bin/extra/gdbcore @@ -9,7 +9,7 @@ # 4 - wrong usage if [ "$#" -lt 1 ]; then - >&2 printf 'usage: fcore <program>\n' + >&2 printf 'usage: gdbcore <program>\n' fi prog="$1" @@ -23,24 +23,33 @@ coredir=/var/lib/systemd/coredump # Temporary file listing core files location, later used as location for the corefile tmp="$(mktemp)" -find "$coredir" -name "core.${prog##*/}*" -printf '%f %TF %TT\n' > "$tmp" - -choice="$(sed \ - -e 's/\.[0-9]\+$//' \ - -e 's/^core\.//' \ - -e 's/\.[0-9]\+\.[0-9a-f]\+\.[0-9]\+\.[0-9]\+\.zst / /' \ - "$tmp" | - awk '{print NR ".", "[" $3,$2"]", $1}' | - sort -k 2 -k 3 -r | - fzf -0 --with-nth=2..)" -if [ -z "$choice" ]; then - rm "$tmp" - exit 2 -fi +if [ "$2" = "-r" ]; then + recent="$(find "$coredir" -name 'core.assert*' -printf '%Ts %f\n' | + sort -n | + head -n 1 | + cut -f 2- -d' ')" + corefile="$coredir"/"$recent" +else + + find "$coredir" -name "core.${prog##*/}*" -printf '%f %TF %TT\n' > "$tmp" -nr="${choice%%.*}" -line="$(sed -n "${nr}p" "$tmp")" -corefile="$coredir"/"${line%% *}" + choice="$(sed \ + -e 's/\.[0-9]\+$//' \ + -e 's/^core\.//' \ + -e 's/\.[0-9]\+\.[0-9a-f]\+\.[0-9]\+\.[0-9]\+\.zst / /' \ + "$tmp" | + awk '{print NR ".", "[" $3,$2"]", $1}' | + sort -k 2 -k 3 -r | + fzf -0 --with-nth=2..)" + if [ -z "$choice" ]; then + rm "$tmp" + exit 2 + fi + + nr="${choice%%.*}" + line="$(sed -n "${nr}p" "$tmp")" + corefile="$coredir"/"${line%% *}" +fi if [ ! -f "$corefile" ]; then rm -f "$tmp" diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index f3f031a..fe8a005 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -346,3 +346,4 @@ alias sqlplus='sqlplus -x' alias rsqp='rlwrap sqlplus -x' alias gcamc='gca -m "checkpoint"' alias gdb='gdb -q' +alias gdbr='gdb -ex "target remote :4200"' diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index d564a1f..ac51bd5 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -69,7 +69,6 @@ trcp() { scp "$1" db:/media/basilisk/downloads/transmission/torrents/; } rln() { ln -s "$(readlink -f "$1")" "$2"; } getgit() { git clone git@db:"$1"; } esc() { eval "$EDITOR '$(which $1)'"; } -gccg() { gcc -g -Wall -pedantic -std=c99 -o ${1%.c} $@; } delfile() { curl -s "${2:-https://upfast.cronyakatsuki.xyz/delete/$1}"; } upfile() { curl -s -F "file=@\"$1\"" "${2:-https://0x0.st}"; } |