From 100714b8ac2e7f5a61f63df457c7d4a443dd4aed Mon Sep 17 00:00:00 2001 From: Sebastian Zaha Date: Fri, 4 Aug 2023 19:35:45 +0200 Subject: [PATCH] Meta: Pretty-print strings in gdb as a single object, not by character This changes the string pretty-printer to show strings as "full" as opposed to {"f", "u", "l", "l", "\0"}. --- Meta/serenity_gdb.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Meta/serenity_gdb.py b/Meta/serenity_gdb.py index 0a74b12741..028f85e334 100644 --- a/Meta/serenity_gdb.py +++ b/Meta/serenity_gdb.py @@ -189,9 +189,7 @@ class AKStringView: if int(self.val["m_length"]) == 0: return '""' else: - characters = self.val["m_characters"] - str_type = characters.type.target().array(self.val["m_length"]).pointer() - return str(characters.cast(str_type).dereference()) + return self.val["m_characters"].string(length=self.val["m_length"]) @classmethod def prettyprint_type(cls, type): @@ -213,8 +211,7 @@ class AKStringImpl: if int(self.val["m_length"]) == 0: return '""' else: - str_type = gdb.lookup_type("char").array(self.val["m_length"]) - return get_field_unalloced(self.val, "m_inline_buffer", str_type) + return self.val["m_inline_buffer"].string(length=self.val["m_length"]) @classmethod def prettyprint_type(cls, type):