From 2dacf7decbc26266d695943b4bc4a57c37429e58 Mon Sep 17 00:00:00 2001 From: pcc Date: Wed, 25 Nov 2015 17:08:37 -0800 Subject: cygprofile: Allow $ character in symbol names. Clang's symbol names sometimes contain the $ character, which we previously disallowed. We continue to forbid the $ character at the start of the symbol name, as these are ARM mapping symbols [1] which should not appear in our orderfile. At the same time, fix an issue where an exception can cause a deadlock when waiting for the objdump process by closing stdout before waiting on it. [1] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0474f/CHDGFCDI.html BUG=539408 R=pasko@chromium.org Review URL: https://codereview.chromium.org/1458853004 Cr-Commit-Position: refs/heads/master@{#361779} --- tools/cygprofile/symbol_extractor.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tools/cygprofile/symbol_extractor.py') diff --git a/tools/cygprofile/symbol_extractor.py b/tools/cygprofile/symbol_extractor.py index d709117..452548e 100755 --- a/tools/cygprofile/symbol_extractor.py +++ b/tools/cygprofile/symbol_extractor.py @@ -54,7 +54,13 @@ def _FromObjdumpLine(line): section = parts[3] size = int(parts[4], 16) name = parts[-1].rstrip('\n') - assert re.match('^[a-zA-Z0-9_.]+$', name) + # Forbid ARM mapping symbols and other unexpected symbol names, but allow $ + # characters in a non-initial position, which can appear as a component of a + # mangled name, e.g. Clang can mangle a lambda function to: + # 02cd61e0 l F .text 000000c0 _ZZL11get_globalsvENK3$_1clEv + # The equivalent objdump line from GCC is: + # 0325c58c l F .text 000000d0 _ZZL11get_globalsvENKUlvE_clEv + assert re.match('^[a-zA-Z0-9_.][a-zA-Z0-9_.$]*$', name) return SymbolInfo(name=name, offset=offset, section=section, size=size) @@ -90,6 +96,7 @@ def SymbolInfosFromBinary(binary_filename): result = _SymbolInfosFromStream(p.stdout) return result finally: + p.stdout.close() p.wait() -- cgit v1.1