summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2014-01-03 20:16:29 +0100
committerJan Pokorný <jpokorny@redhat.com>2014-01-03 20:16:29 +0100
commitdb94b33433b2efb44c1a3f1db63fb0e4f9798d0d (patch)
tree30c9f67dab9ea6d19ea1ed9fbee16954e31b0952
parentdd675f3045c0b8fcce25e08134ce67ea38a62596 (diff)
downloadgdb-bt-reformat-master.tar.gz
gdb-bt-reformat-master.tar.xz
gdb-bt-reformat-master.zip
Teach script about some Python-aware annotations in GDB btHEADmaster
This need arose in connection to https://bugzilla.redhat.com/1048330#redshift-gtk-will-segfault-when-run-manually-from-terminal Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
-rwxr-xr-xgdb-bt-reformat9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb-bt-reformat b/gdb-bt-reformat
index 2935ada..804208c 100755
--- a/gdb-bt-reformat
+++ b/gdb-bt-reformat
@@ -9,12 +9,14 @@ __license__ = "GPLv2"
# - <signal handler called>
# - single argument placeholder:
# - how=how@entry=0
+# + totally skewed by Python-aware annotations :-/
from sys import stdin, stderr
from re import compile
from textwrap import fill, wrap
+DEF_PATH = '[A-Za-z0-9._/-]+'
DEF_IDENT = '[A-Za-z_][A-Za-z0-9_]*'
# incl. C++ stuff
DEF_IDENT_FUNC = '%(DEF_IDENT)s(?:(?: |::)%(DEF_IDENT)s)*' % locals()
@@ -24,16 +26,17 @@ DEF_IDENT_ARG = '(?P<atnotation>[A-Za-z_][A-Za-z0-9_]*)(=(?P=atnotation)@[A-Za-z
DEF_UNKNOWN = '[?]{2}'
DEF_HEX = '0x[0-9A-Fa-f]+'
DEF_NUM = '[+-]?(?:[0-9]+(?:[.][0-9]*)?|[.][0-9]+)(?:[eE][0-9]+)?'
-DEF_MSG = '(?:%(DEF_HEX)s\s+)?[<][ A-Za-z0-9_]+[>]' % locals()
+DEF_MSG = '(?:%(DEF_HEX)s\s+)?[<][ A-Za-z0-9_.]+[>]' % locals()
DEF_STR = '(?:%(DEF_HEX)s\s+)?["][^"]*["]' % locals()
+DEF_STR2 = "(?:%(DEF_HEX)s\s+)?['][^']*[']" % locals()
DEF_STRUCT = '(?:%(DEF_HEX)s\s+=\s+)?[{][^}]*[}]' % locals()
-DEF_PATH = '[A-Za-z0-9._/-]+'
+DEF_PYTHONFRAME = 'Frame %(DEF_HEX)s, for file %(DEF_PATH)s, line \d+, in %(DEF_IDENT)s [(][^)]*[)]' % locals()
RE_BT = compile(
'(?P<init>^\#[0-9]+\s+)'
'(?:(?P<hex>%(DEF_HEX)s) in )?'
'(?P<where>%(DEF_IDENT_FUNC)s|(?P<unknown>%(DEF_UNKNOWN)s|%(DEF_MSG)s))'
- '(?: (?P<args>[(](?:(?<=[( ])%(DEF_IDENT_ARG)s=(?:%(DEF_IDENT)s|%(DEF_MSG)s|%(DEF_HEX)s|%(DEF_NUM)s|%(DEF_STR)s|%(DEF_STRUCT)s)(?:, )?)*[)])'
+ '(?: (?P<args>[(](?:(?<=[( ])%(DEF_IDENT_ARG)s=(?:%(DEF_IDENT)s|%(DEF_MSG)s|%(DEF_PYTHONFRAME)s|%(DEF_HEX)s|%(DEF_NUM)s|%(DEF_STR)s|%(DEF_STR2)s|%(DEF_STRUCT)s)(?:, )?)*[)])'
'(?(unknown)| at (?P<path>%(DEF_PATH)s):(?P<line>[1-9][0-9]*)))?'
% locals())