2
0

build-static-symbols.tcl 593 B

12345678910111213141516171819202122
  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. set fd [open redis.c]
  7. set symlist {}
  8. while {[gets $fd line] != -1} {
  9. if {[regexp {^static +[A-z0-9]+[ *]+([A-z0-9]*)\(} $line - sym]} {
  10. lappend symlist $sym
  11. }
  12. }
  13. set symlist [lsort -unique $symlist]
  14. puts "static struct redisFunctionSym symsTable\[\] = {"
  15. foreach sym $symlist {
  16. puts "{\"$sym\",(unsigned long)$sym},"
  17. }
  18. puts "{NULL,0}"
  19. puts "};"
  20. close $fd