dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit ef80328685842cac0f5c695737a682fde246ae43
parent 5ce7458ead634d19db4925df7c1567cb7e71044a
Author: hhvn <dev@hhvn.uk>
Date:   Sat,  6 Nov 2021 20:01:53 +0000

.s/b/debugscrape: add

Diffstat:
A.scripts/bin/debugscrape | 31+++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+), 0 deletions(-)

diff --git a/.scripts/bin/debugscrape b/.scripts/bin/debugscrape @@ -0,0 +1,31 @@ +#!/bin/sh +# This script is quite good at scraping +# source out of debug binaries, but not +# data (it gets mangled pretty bad). + +[ -z "$1" ] || [ -n "$2" ] && printf "usage: %s <debug binary>\n" "$(basename "$0")" && exit 2 + +objdump -St "$1" 2>&1 | awk ' + /SYMBOL TABLE/ {st = 1} + /^[[:space:]]*$/ { + st = 0 + if (!sp) { + print + sp = 1 + } + } + $1 !~ ":$" && $2 !~ "<[^>]*>:$" && !st && !/Disassembly.*:/ && /[^[:space:]]/ { + # avoid double printing for loops + if ($1 ~ "^for") { + if (forseen[$0] == 1) { + forseen[$0] = 0 + } else { + print + forseen[$0] = 1 + } + } else { + print + sp = 0 + } + } +'