Initial commit - initial revisions of scripts
authorLaurent Georget <laurent.georget@inria.fr>
Fri, 3 Apr 2015 09:05:04 +0000 (11:05 +0200)
committerLaurent Georget <laurent.georget@inria.fr>
Fri, 3 Apr 2015 09:05:04 +0000 (11:05 +0200)
count_global_symbols.sh [new file with mode: 0755]
extract_global_symbols.sh [new file with mode: 0755]

diff --git a/count_global_symbols.sh b/count_global_symbols.sh
new file mode 100755 (executable)
index 0000000..f2bb2ea
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/zsh
+
+for i in $(find -name '*.dwo' -a ! -name '*built-in*' -a ! -wholename '*/drivers/*' -a ! -wholename '*/lib/*' ) ; do
+       if [[ ! -e ${i/%.dwo/.mod.c} ]]; then
+               for symbol in $(nm ${i/%.dwo/.o} | awk '$2 == "T" { print $3; }') ; do
+                       echo "$symbol $i" >> symbols.list
+               done
+       fi
+done
diff --git a/extract_global_symbols.sh b/extract_global_symbols.sh
new file mode 100755 (executable)
index 0000000..be25b41
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/zsh
+
+cat <<EOF
+CREATE TABLE global_symbols   (        symbol TEXT PRIMARY KEY,
+dir TEXT,
+file TEXT);
+EOF
+
+for i in $(find -name '*.dwo' -a ! -name '*built-in*' -a ! -wholename '*/drivers/*' -a ! -wholename '*/lib/*' ) ; do
+       if [[ ! -e ${i/%.dwo/.mod.c} ]]; then
+               for symbol in $(nm ${i/%.dwo/.o} | awk '$2 == "T" { print $3; }') ; do
+               echo "INSERT INTO global_symbols (symbol,dir,file) VALUES ('${symbol}', '${$(dirname $i)#\.\/}', '$(basename $i .dwo).c');"
+               done
+       fi
+done