From c2329d1abbaa4a4d6e63b93ae66ea5556523ea49 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 8 Aug 2019 11:57:21 +0000 Subject: [PATCH] Bug 1525664 follow-up - Fix GDB pretty printer for JSString. r=jonco I had to use try-except instead of "in" because if the value is a pointer type (like JSString*) then "in" returned false. I tested this with both 32-bit and 64-bit builds. Differential Revision: https://phabricator.services.mozilla.com/D40978 --HG-- extra : moz-landing-system : lando --- js/src/gdb/mozilla/JSString.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/src/gdb/mozilla/JSString.py b/js/src/gdb/mozilla/JSString.py index f73089302115..3ad35b6f9423 100644 --- a/js/src/gdb/mozilla/JSString.py +++ b/js/src/gdb/mozilla/JSString.py @@ -43,10 +43,10 @@ class JSStringPtr(Common): def chars(self): d = self.value['d'] - flags = d['flags_'] - if 'length_' in d.type: - length = d['length_'] - else: + flags = self.value['flags_'] + try: + length = self.value['length_'] + except gdb.error: # If we couldn't fetch the length directly, it must be stored # within `flags`. length = flags >> 32