MCPcopy Create free account
hub / github.com/KDE/labplot / LLVMSymbolizer

Class LLVMSymbolizer

admin/asan_symbolize.py:67–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65
66
67class LLVMSymbolizer(Symbolizer):
68 def __init__(self, symbolizer_path, default_arch, system, dsym_hints=[]):
69 super(LLVMSymbolizer, self).__init__()
70 self.symbolizer_path = symbolizer_path
71 self.default_arch = default_arch
72 self.system = system
73 self.dsym_hints = dsym_hints
74 self.pipe = self.open_llvm_symbolizer()
75
76 def open_llvm_symbolizer(self):
77 cmd = [self.symbolizer_path,
78 '--use-symbol-table=true',
79 '--demangle=%s' % demangle,
80 '--functions=short',
81 '--inlining=true',
82 '--default-arch=%s' % self.default_arch]
83 if self.system == 'Darwin':
84 for hint in self.dsym_hints:
85 cmd.append('--dsym-hint=%s' % hint)
86 if DEBUG:
87 print ' '.join(cmd)
88 try:
89 result = subprocess.Popen(cmd, stdin=subprocess.PIPE,
90 stdout=subprocess.PIPE)
91 except OSError:
92 result = None
93 return result
94
95 def symbolize(self, addr, binary, offset):
96 """Overrides Symbolizer.symbolize."""
97 if not self.pipe:
98 return None
99 result = []
100 try:
101 symbolizer_input = '"%s" %s' % (binary, offset)
102 if DEBUG:
103 print symbolizer_input
104 print >> self.pipe.stdin, symbolizer_input
105 while True:
106 function_name = self.pipe.stdout.readline().rstrip()
107 if not function_name:
108 break
109 file_name = self.pipe.stdout.readline().rstrip()
110 file_name = fix_filename(file_name)
111 if (not function_name.startswith('??') or
112 not file_name.startswith('??')):
113 # Append only non-trivial frames.
114 result.append('%s in %s %s' % (addr, function_name,
115 file_name))
116 except Exception:
117 result = []
118 if not result:
119 result = None
120 return result
121
122
123def LLVMSymbolizerFactory(system, default_arch, dsym_hints=[]):

Callers 1

LLVMSymbolizerFactoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected