1*061da546Spatrick"""
2*061da546SpatrickLLDB AppKit formatters
3*061da546Spatrick
4*061da546SpatrickPart of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*061da546SpatrickSee https://llvm.org/LICENSE.txt for license information.
6*061da546SpatrickSPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*061da546Spatrick"""
8*061da546Spatrickimport lldb
9*061da546Spatrickimport lldb.runtime.objc.objc_runtime
10*061da546Spatrickimport lldb.formatters.Logger
11*061da546Spatrick
12*061da546Spatrick
13*061da546Spatrickdef Class_Summary(valobj, dict):
14*061da546Spatrick    logger = lldb.formatters.Logger.Logger()
15*061da546Spatrick    runtime = lldb.runtime.objc.objc_runtime.ObjCRuntime.runtime_from_isa(
16*061da546Spatrick        valobj)
17*061da546Spatrick    if runtime is None or not runtime.is_valid():
18*061da546Spatrick        return '<error: unknown Class>'
19*061da546Spatrick    class_data = runtime.read_class_data()
20*061da546Spatrick    if class_data is None or not class_data.is_valid():
21*061da546Spatrick        return '<error: unknown Class>'
22*061da546Spatrick    return class_data.class_name()
23