From cb4074713facfe9d787d7dd11c3dad87699fc848 Mon Sep 17 00:00:00 2001 From: Marcus Tillmanns Date: Mon, 3 Apr 2023 11:31:54 +0200 Subject: [PATCH] Dumpers: Fix std::string for clang >= 15 libc++ has changed the layout of std::string again. (see https://reviews.llvm.org/D128285) This patch adds checks to differentiate between the two versions. Fixes: QTCREATORBUG-28806 Change-Id: Ic21c488cf1c173120beddf414ca39040dfaba096 Reviewed-by: Qt CI Bot Reviewed-by: hjk --- share/qtcreator/debugger/libcpp_stdtypes.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/share/qtcreator/debugger/libcpp_stdtypes.py b/share/qtcreator/debugger/libcpp_stdtypes.py index cebd4da435f..5a72629da75 100644 --- a/share/qtcreator/debugger/libcpp_stdtypes.py +++ b/share/qtcreator/debugger/libcpp_stdtypes.py @@ -182,6 +182,7 @@ def std_1_string_dumper(d, value): size = 0 size_mode_value = 0 short_mode = False + libcxx_version = 14 layoutModeIsDSC = layoutDecider.name == '__data_' if (layoutModeIsDSC): @@ -200,8 +201,15 @@ def std_1_string_dumper(d, value): if not size_mode: raise Exception("Could not find size_mode") - size_mode_value = size_mode.integer() - short_mode = ((size_mode_value & 1) == 0) + if size_mode.name == '__is_long_': + libcxx_version = 15 + short_mode = (size_mode.integer() == 0) + + size_mode = D[1][0][1] + size_mode_value = size_mode.integer() + else: + size_mode_value = size_mode.integer() + short_mode = ((size_mode_value & 1) == 0) if short_mode: s = D[1] @@ -209,8 +217,13 @@ def std_1_string_dumper(d, value): if not s: raise Exception("Could not find s") - location_sp = s[0] if layoutModeIsDSC else s[1] - size = size_mode_value if layoutModeIsDSC else ((size_mode_value >> 1) % 256) + if libcxx_version == 14: + location_sp = s[0] if layoutModeIsDSC else s[1] + size = size_mode_value if layoutModeIsDSC else ((size_mode_value >> 1) % 256) + elif libcxx_version == 15: + location_sp = s[0] if layoutModeIsDSC else s[2] + size = size_mode_value + else: l = D[0] if not l: