From aaa8a93cec50457abd1acd6c9c899ae0b13e6146 Mon Sep 17 00:00:00 2001 From: Jan Pokorný Date: Wed, 3 Apr 2013 15:21:15 +0200 Subject: Be ready for some missing fields (e.g., with _dl_new_object) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Pokorný --- gdb-bt-reformat | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gdb-bt-reformat b/gdb-bt-reformat index d5ddea0..6b2c6a3 100755 --- a/gdb-bt-reformat +++ b/gdb-bt-reformat @@ -25,8 +25,8 @@ RE_BT = compile( '(?P^\#[0-9]+\s+)' '(?:(?P%(DEF_HEX)s) in )?' '(?P%(DEF_IDENT_FUNC)s|(?P%(DEF_UNKNOWN)s|%(DEF_MSG)s))' - ' (?P[(](?:(?<=[( ])%(DEF_IDENT_ARG)s=(?:%(DEF_IDENT)s|%(DEF_MSG)s|%(DEF_HEX)s|%(DEF_NUM)s|%(DEF_STR)s|%(DEF_STRUCT)s)(?:, )?)*[)])' - '(?(unknown)| at (?P%(DEF_PATH)s):(?P[1-9][0-9]*))' + '(?: (?P[(](?:(?<=[( ])%(DEF_IDENT_ARG)s=(?:%(DEF_IDENT)s|%(DEF_MSG)s|%(DEF_HEX)s|%(DEF_NUM)s|%(DEF_STR)s|%(DEF_STRUCT)s)(?:, )?)*[)])' + '(?(unknown)| at (?P%(DEF_PATH)s):(?P[1-9][0-9]*)))?' % locals()) @@ -47,7 +47,7 @@ class BtLine(object): if self._found: for k, v in self._found.groupdict().iteritems(): #print "\t{0}: {1}".format(k, v) - setattr(self, k, v) + setattr(self, k, v if v is not None else '') else: raise BtLineError(fill(line.strip(), initial_indent=self._space * 2, subsequent_indent=self._space * 3)) @@ -57,8 +57,9 @@ class BtLine(object): args = wrap(self.args, subsequent_indent=self._space) space = '\n' + self._space res = self.init + self.where - res += (args[0] != '()' and space + '\n'.join(args) or '') - if not self.unknown: + if args and args[0] != '()': + res += space + '\n'.join(args) + if self.path: res += space + 'at ' + self.path + ':' + self.line return res -- cgit