diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2012-11-19 18:51:45 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2012-11-19 18:51:45 +0100 |
commit | 9be683d76423cb4ee0c0d0a32f6aaa2a4d67bcfa (patch) | |
tree | 6ca92c7b34cdf0d0917f3a90bc00034a0c04517b | |
parent | 3c29f50292a7f185508f0069f3b4b836b672ffff (diff) | |
download | gdb-bt-reformat-9be683d76423cb4ee0c0d0a32f6aaa2a4d67bcfa.tar.gz gdb-bt-reformat-9be683d76423cb4ee0c0d0a32f6aaa2a4d67bcfa.tar.xz gdb-bt-reformat-9be683d76423cb4ee0c0d0a32f6aaa2a4d67bcfa.zip |
work better with lines like "#9 0x00007ff08691590d in ?? ()"
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rwxr-xr-x | gdb-bt-reformat | 11 |
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 |