Skip adding value lines for accidental matches.
If the value_line regex matches, and the symbol file happens to exist as a directory, we'd call addr2line and crash. Fix this so that calling addr2line on a directory doesn't happen. There isn't an easy way to test this, but I added a single new unit test. The real test was to use a tombstone file that used to crash, but no longer crashes. Test: Wrote new unit test, ran over a tombstone file that used to crash. Change-Id: I4331e3b032cee8d697d1b7f409638750c61971d6
This commit is contained in:
@@ -409,19 +409,21 @@ class TraceConverter:
|
|||||||
else:
|
else:
|
||||||
info = symbol.SymbolInformation(area, value)
|
info = symbol.SymbolInformation(area, value)
|
||||||
(source_symbol, source_location, object_symbol_with_offset) = info.pop()
|
(source_symbol, source_location, object_symbol_with_offset) = info.pop()
|
||||||
if not source_symbol:
|
# If there is no information, skip this.
|
||||||
if symbol_present:
|
if source_symbol or source_location or object_symbol_with_offset:
|
||||||
source_symbol = symbol.CallCppFilt(symbol_name)
|
if not source_symbol:
|
||||||
else:
|
if symbol_present:
|
||||||
source_symbol = "<unknown>"
|
source_symbol = symbol.CallCppFilt(symbol_name)
|
||||||
if not source_location:
|
else:
|
||||||
source_location = area
|
source_symbol = "<unknown>"
|
||||||
if not object_symbol_with_offset:
|
if not source_location:
|
||||||
object_symbol_with_offset = source_symbol
|
source_location = area
|
||||||
self.value_lines.append((addr,
|
if not object_symbol_with_offset:
|
||||||
value,
|
object_symbol_with_offset = source_symbol
|
||||||
object_symbol_with_offset,
|
self.value_lines.append((addr,
|
||||||
source_location))
|
value,
|
||||||
|
object_symbol_with_offset,
|
||||||
|
source_location))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@@ -499,5 +501,13 @@ class LongASANStackTests(unittest.TestCase):
|
|||||||
self.assertGreater(trace_line_count, 10)
|
self.assertGreater(trace_line_count, 10)
|
||||||
tc.PrintOutput(tc.trace_lines, tc.value_lines)
|
tc.PrintOutput(tc.trace_lines, tc.value_lines)
|
||||||
|
|
||||||
|
class ValueLinesTest(unittest.TestCase):
|
||||||
|
def test_value_line_skipped(self):
|
||||||
|
tc = TraceConverter()
|
||||||
|
symbol.SetAbi(["ABI: 'arm'"])
|
||||||
|
tc.UpdateAbiRegexes()
|
||||||
|
tc.ProcessLine(" 12345678 00001000 .")
|
||||||
|
self.assertEqual([], tc.value_lines)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -189,6 +189,10 @@ def CallAddr2LineForSet(lib, unique_addrs):
|
|||||||
if not os.path.exists(symbols):
|
if not os.path.exists(symbols):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# Make sure the symbols path is not a directory.
|
||||||
|
if os.path.isdir(symbols):
|
||||||
|
return None
|
||||||
|
|
||||||
cmd = [ToolPath("addr2line"), "--functions", "--inlines",
|
cmd = [ToolPath("addr2line"), "--functions", "--inlines",
|
||||||
"--demangle", "--exe=" + symbols]
|
"--demangle", "--exe=" + symbols]
|
||||||
child = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
child = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|||||||
Reference in New Issue
Block a user