File: stl-symbol-strip.py

package info (click to toggle)
springlobby 0.255%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,228 kB
  • ctags: 14,450
  • sloc: cpp: 76,178; ansic: 61,718; python: 863; sh: 654; perl: 238; xml: 52; makefile: 41; sed: 16
file content (30 lines) | stat: -rwxr-xr-x 682 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Strips all STL symbols from the object file %1

import os
import sys

if sys.argv.__len__()!=2:
    print "stl_debug_symbol_remove: Expected precisely the object file"
    sys.exit()

info = os.popen("nm "+sys.argv[1]+" -a -l -s")

cmdLine = "strip"

try:
    for line in info:
      stuff = line.strip().replace('\t',' ').split(" ")        
      if stuff.__len__()==4:
	  if stuff[3].count("/usr/include/c++/")>0:
	    cmdLine = cmdLine + " -N "+stuff[2]

    # Strip symbols
    cmdLine = cmdLine + " " + sys.argv[1]
    print "stl_debug_symbol_remove.py: Calling: " + cmdLine
    os.system(cmdLine)

finally:
    info.close()