blob: 1138636c6ed8f0e1b8f17f7b983bacbe7a1daac6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/bin/sh
# usage: winedbg-procmap wpid
# Convert winedbg's share and map information into /proc/<pid>/maps compatible format
# NOTE: since there's no map offsets you may need to use the brute-map.bash tool as well
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
winedbg-share "$1" | sed 's/^ *\\-PE[\t ]*//;s/^PE[\t ]*//;s/^ELF[\t ]*//;s/-/ /' > "$tmpdir/share"
winedbg-map "$1" > "$tmpdir/map"
awk '{print $1; print $2; print $4}' < "$tmpdir/share" |\
while {
read -r start
read -r end
read -r name
}; do
awk '(strtonum(0x'"$start"') <= strtonum("0x"$1) && strtonum(0x'"$end"') >= strtonum("0x"$2)) { printf "%s-%s rwxp 00000000 00:00 0 %s\n", $1, $2, "'"$name"'" }' < "$tmpdir/map"
done
|