Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1189)

Side by Side Diff: tools/mac/dump-static-initializers.py

Issue 10821035: wip Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 import optparse
4 import re
5 import subprocess
6 import sys
7
8 # Matches for example:
9 # [ 1] 000001ca 64 (N_SO ) 00 0000 0000000000000000 'test.cc'
10 nm_file_re = re.compile("N_SO.*'([^']*)'")
11
12 # Matches for example:
13 # [ 2] 000001d2 66 (N_OSO ) 00 0001 000000004ed856a0 '/Volumes/ MacintoshHD2/src/chrome-git/src/test.o'
14 nm_o_file_re = re.compile("N_OSO.*'([^']*)'")
15
16 # Matches for example:
17 # [ 8] 00000233 24 (N_FUN ) 01 0000 0000000000001b40 '__GLOBAL_ _I_s'
18 # [185989] 00dc69ef 26 (N_STSYM ) 02 0000 00000000022e2290 '__GLOBAL_ _I_a'
19 nm_re = re.compile(r"(?:N_FUN|N_STSYM).*\s([0-9a-f]*)\s'__GLOBAL__I_")
20
21 def ParseNm(binary):
22 """foo"""
23
24 nm = subprocess.Popen(['dsymutil', '-s', binary], stdout=subprocess.PIPE)
25 for line in nm.stdout:
26 file_match = nm_file_re.search(line)
27 if file_match:
28 current_filename = file_match.group(1)
29 else:
30 o_file_match = nm_o_file_re.search(line)
31 if o_file_match:
32 current_o_filename = o_file_match.group(1)
33 else:
34 match = nm_re.search(line)
35 if match:
36 address = match.group(1)
37 print current_filename
38 print current_o_filename
39 print
40
41
42 def main():
43 parser = optparse.OptionParser(usage='%prog filename')
44 opts, args = parser.parse_args()
45 if len(args) != 1:
46 parser.error('missing filename argument')
47 return 1
48 binary = args[0]
49
50 ParseNm(binary)
51 return 0
52
53
54 if '__main__' == __name__:
55 sys.exit(main())
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698