Created
March 19, 2014 14:06
-
-
Save azat/9642331 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x | |
target=$1 | |
for i in /usr/src/linux/fs/ext4/ext4.ko /usr/src/linux/vmlinux; do | |
scp -P2204 root@localhost:$i ./ | |
done | |
parametersInstalled=0 | |
function printVmCommands() | |
{ | |
echo "=== Run next commands on the vm: ===" | |
if [ $parametersInstalled -eq 0 ]; then | |
echo "echo kdb,ttyS0,115200 >| /sys/module/kgdboc/parameters/kgdboc" | |
parametersInstalled=1 | |
fi | |
echo "echo g >| /proc/sysrq-trigger # sometimes multiple times" | |
} | |
echo "Obtaining ext4 module address ..." | |
printVmCommands | |
ext4_load_addr=$(gdb -q vmlinux \ | |
-ex "target remote $target" \ | |
-ex "monitor lsmod" \ | |
-ex "quit" 2>&1 | \ | |
fgrep ext4 | awk '{print $6}') | |
echo "ext4 address is: ${ext4_load_addr}" | |
printVmCommands | |
gdb vmlinux \ | |
-ex "target remote $target" \ | |
-ex "add-symbol-file ext4.ko ${ext4_load_addr}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment