mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
Most of it was present inside buildroot/output.* and the rest scattered
on top level.
This came about for the n-th time when we were reviewing QEMU trace file
locations.
On one hand, it would be cool to have per arch traces.
This made buildroot/output.${arch}~/ a natural choice.
But on the other, those traces have nothing to do with Buildroot,
and could potentially interfere with Buildroot build files.
It also feels nicer to have buildroot/ pristine source code only,
and keep all output under a single directory out/
45 lines
943 B
Bash
Executable File
45 lines
943 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
. common
|
|
usage="$0 <exec-relative-path> [<brk-symbol>]"
|
|
arch='x86_64'
|
|
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
|
|
;;
|
|
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"
|