Files
linux-kernel-module-cheat/rungdb-user
Ciro Santilli f482f24f87 readme: explain how to run benchmarks with readfile straight out
gem5 cache automate benchmarks, and remove results that were scattered all over.

Move console fun under linux kernel section, since not important enough
for getting started.

Set arch x86_64 by default through common on all scripts.
2018-04-03 22:28:53 +01:00

48 lines
987 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
. common
set -- ${cli_rungdb_user:-} "$@"
usage="$0 <exec-relative-path> [<brk-symbol>]"
gem5=false
gem5_opt=
while getopts a:gh OPT; do
case "$OPT" in
a)
arch="$OPTARG"
;;
g)
gem5=true
gem5_opt=-g
;;
h)
echo "$usage"
exit 0
;;
?)
exit 2
;;
esac
done
shift "$(($OPTIND - 1))"
executable_rel="$1"
shift
if [ "$#" -gt 0 ]; then
brk="'$1'"
shift
else
brk=
fi
set_common_vars "$arch" "$gem5"
executable="${build_dir}/${executable_rel}"
readelf="${host_dir}/usr/bin/${arch}-linux-readelf"
addr="$("$readelf" -h "$executable" | awk '/Entry/{ print $NF }' )"
ex="-ex \"add-symbol-file $executable $addr\""
# -L or else lx-symbols throws for arm:
# gdb.MemoryError: Cannot access memory at address 0xbf0040cc
# TODO understand better.
#
# Also, lx-symbols overrides the add-symbol-file commands.
cmd="./rungdb -a '${arch}' -b '${ex}' ${gem5_opt} -L ${brk}"
echo "$cmd"
eval "$cmd"