]> git.saurik.com Git - redis.git/blame - utils/build-static-symbols.tcl
Better system for additional commands replication.
[redis.git] / utils / build-static-symbols.tcl
CommitLineData
bcfc686d 1# Build a symbol table for static symbols of redis.c
2# Useful to get stack traces on segfault without a debugger. See redis.c
3# for more information.
4#
5# Copyright(C) 2009 Salvatore Sanfilippo, under the BSD license.
6
7set fd [open redis.c]
8set symlist {}
9while {[gets $fd line] != -1} {
10 if {[regexp {^static +[A-z0-9]+[ *]+([A-z0-9]*)\(} $line - sym]} {
11 lappend symlist $sym
12 }
13}
14set symlist [lsort -unique $symlist]
15puts "static struct redisFunctionSym symsTable\[\] = {"
16foreach sym $symlist {
17 puts "{\"$sym\",(unsigned long)$sym},"
18}
19puts "{NULL,0}"
20puts "};"
21
22close $fd