farre / midas

A GDB/MI Visual Studio Code Debug Adapter
MIT License
29 stars 1 forks source link

Add `manage traces` feature #166

Open theIDinside opened 1 year ago

theIDinside commented 1 year ago

Requested by user on Matrix; along the lines of

Being able to clean up traces, either in some form of command like Purge all or display some list where multiple options can be picked to be removed.

sj-raima commented 8 months ago

Anyone landing here. Here is how I solved this. I use a wrapper script for rr that have learned rm -r

#!/bin/bash

rr=/opt/rr/bin/rr

case $1 in
    help)
        echo "Extra rr commands provided by this wrapper:" >&2
        echo "    rm -r       Remove all recording" >&2
        echo "    ctest <args>  Run ctest as root with output on failure" >&2
        ;;
    rm)
        if [ $# = 2 -a "$2" = '-r' ]; then
           for recording in $($rr ls); do
               if [ $recording != latest-trace ]; then
                   $rr rm $recording
               fi
           done
           exit $?
        fi
        ;;
    ctest)
        sudo -EP --preserve-env=HOME rr record --setuid-sudo ctest --output-on-failure -V -C Debug "$@"
        exit $?
        ;;
esac

$rr "$@"

Edit: Format the code