summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-10-18 21:53:24 +0300
committerJari Vetoniemi <mailroxas@gmail.com>2018-10-18 21:53:24 +0300
commitc1885a2af8c483dece4087f31fa4f2853d44f128 (patch)
tree240cc8d0a142f97fd64359345dab6bcb327d4a24
parent36d3fb3a884d02994932b818a28aa04fb5c1706b (diff)
brute-map.bash: drop regions that aren't found
-rwxr-xr-xcontrib/brute-map.bash8
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/brute-map.bash b/contrib/brute-map.bash
index a7a735c..f37581f 100755
--- a/contrib/brute-map.bash
+++ b/contrib/brute-map.bash
@@ -6,10 +6,10 @@ while read -r region; do
offset=$(printf '%d' "0x$(awk '{print $3}' <<<"$region")")
if ((offset == 0)); then
offset=$(binsearch <(proc-region-rw "$1" read <<<"$region" 2>/dev/null | bintrim) $3 < "$2")
- fi
- if ((offset != 0)); then
- hex=$(printf '%.8x' "$offset")
- awk '{printf "%s %s %s %s %s %s\n", $1, $2, "'"$hex"'", $4, $5, $6, $7}' <<<"$region"
+ if [[ -n "$offset" ]]; then
+ hex=$(printf '%.8x' "$offset")
+ awk '{printf "%s %s %s %s %s %s\n", $1, $2, "'"$hex"'", $4, $5, $6, $7}' <<<"$region"
+ fi
else
printf '%s\n' "$region"
fi