Skip to content

Instantly share code, notes, and snippets.

@hotsphink
Created June 28, 2019 19:02
Show Gist options
  • Save hotsphink/1f642a1ef0cd3cbe4aefcda781206f00 to your computer and use it in GitHub Desktop.
Save hotsphink/1f642a1ef0cd3cbe4aefcda781206f00 to your computer and use it in GitHub Desktop.
mkgist-created gist
diff --git a/tools/rb/fix_stack_using_bpsyms.py b/tools/rb/fix_stack_using_bpsyms.py
--- a/tools/rb/fix_stack_using_bpsyms.py
+++ b/tools/rb/fix_stack_using_bpsyms.py
@@ -180,21 +180,24 @@ def addressToSymbol(file, address, symbo
p = getSymbolFile(file, symbolsDir)
if p:
return p.addrToSymbol(address)
else:
return ""
# Matches lines produced by NS_FormatCodeAddress().
-line_re = re.compile("^(.*#\d+: )(.+)\[(.+) \+(0x[0-9A-Fa-f]+)\](.*)$")
+line_re1 = re.compile("^(.*#\d+: )(.+)\[(.+) \+(0x[0-9A-Fa-f]+)\](.*)$")
+line_re2 = re.compile(r'^(.*#\d+: )(.*\\)?([^\\]+) \+ (0x[0-9A-Fa-f]+)(.*)$')
def fixSymbols(line, symbolsDir, jsonEscape=False):
- result = line_re.match(line)
+ result = line_re1.match(line)
+ if not result:
+ result = line_re2.match(line)
if result is not None:
(before, fn, file, address, after) = result.groups()
address = int(address, 16)
symbol = addressToSymbol(file, address, symbolsDir)
if not symbol:
symbol = "%s + 0x%x" % (os.path.basename(file), address)
if jsonEscape:
symbol = json.dumps(symbol)[1:-1] # [1:-1] strips the quotes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment