Skip to content

Commit

Permalink
debugging strace
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chu committed Aug 22, 2017
1 parent 0e2a1a5 commit dcae442
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions dotd/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,37 @@ trace-procs() {
shift

rm -f $prefix.*
strace -ff -e 'execve' -o $prefix -- "$@"
ls -l $prefix.*
strace -ff -e 'execve' -o $prefix -s 64 -- "$@" || true
#ls -l $prefix.*
head $prefix.*
}

_trace-one() {
local strsize=$1
shift
rm -f _tmp/sflag.*
strace -ff -e 'execve' -o _tmp/sflag -s $strsize -- /bin/echo "$@" || true
head _tmp/sflag.*
}

# Conclusion: If a string is less than 32, it prints ... at the end the arg
# list, even if there are no more args!
test-s-flag() {
for strsize in 2 4 8 16; do
echo "--- strsize: $strsize ---"
_trace-one $strsize a b c
done

echo
echo

# Numargs is half the str size?
for numargs in 2 4 8 16 32 64; do
echo "--- numargs: $numargs ---"
_trace-one 16 $(seq $numargs)
done
}

# TODO: Does Clang work the same way?
trace-gcc() {
# /usr/lib/gcc/x86_64-linux-gnu/5/cc1
Expand Down

0 comments on commit dcae442

Please sign in to comment.