summaryrefslogtreecommitdiffstats
path: root/gdb-bt-reformat
diff options
context:
space:
mode:
Diffstat (limited to 'gdb-bt-reformat')
-rwxr-xr-xgdb-bt-reformat11
1 files changed, 7 insertions, 4 deletions
diff --git a/gdb-bt-reformat b/gdb-bt-reformat
index 6b3fb84..ab7bbcb 100755
--- a/gdb-bt-reformat
+++ b/gdb-bt-reformat
@@ -8,15 +8,17 @@ import re
import textwrap
DEF_IDENT = '[A-Za-z_][A-Za-z0-9_]*'
+#DEF_UNKNOWN = map(lambda c: '\\' + c, '??') # re needs escaped version
+DEF_UNKNOWN = '[?][?]'
DEF_HEX = '0x[0-9A-Za-z]+'
DEF_MSG = '[<][ A-Za-z0-9_]+[>]'
DEF_PATH = '[A-Za-z0-9._/]+'
RE_BT = re.compile(\
'(?P<init>^\#[0-9]+\s+)'\
'(?:(?P<hex>%(DEF_HEX)s) in )?'\
- '(?P<where>%(DEF_IDENT)s(?:(?: |::)%(DEF_IDENT)s)*)'\
+ '(?P<where>%(DEF_IDENT)s(?:(?: |::)%(DEF_IDENT)s)*|(?P<unknown>%(DEF_UNKNOWN)s))'\
' (?P<args>[(](?:(?<=[( ])%(DEF_IDENT)s=(?:%(DEF_IDENT)s|%(DEF_MSG)s|%(DEF_HEX)s)(?:, )?)*[)])'\
- ' at (?P<path>%(DEF_PATH)s):(?P<line>[1-9][0-9]*)'
+ '(?(unknown)| at (?P<path>%(DEF_PATH)s):(?P<line>[1-9][0-9]*))'
% locals())
@@ -33,8 +35,9 @@ def main():
args = textwrap.wrap(found['args'], subsequent_indent=space[1:])
res = found['init'] + found['where']
res += (args[0] == '()' and '()' or space + '\n'.join(args))
- res += space + 'at ' + found['path'] + ':' + found['line'] + '\n'
- print res
+ if not found['unknown']:
+ res += space + 'at ' + found['path'] + ':' + found['line']
+ print res + '\n'
else:
space = None
print >>stderr, "bad line:", line