LLDB 无法检查全局变量

LLDB fails to examine global variables

在我的框架中定义了一个全局变量 var showersInProgress:[ProgressShower] = []

它是全局的,所以我可以停止程序 并希望像这样检查状态:

(lldb) po showersInProgress

错误:<用户表达式 7>:1:1:使用了未声明的标识符 'showersInProgress' 淋浴进行中

(lldb) p showersInProgress

错误:<用户表达式 8>:1:1:使用了未声明的标识符 'showersInProgress' 淋浴进行中

(lldb) frame variable showersInProgress
(lldb) frame  showersInProgress
invalid command 'frame showersInProgress'.
(lldb) frame -g showersInProgress
invalid command 'frame -g'.
(lldb) frame -g variable showersInProgress
invalid command 'frame -g'.
(lldb) frame variable -g showersInProgress
(lldb) frame variable -g showersInProgress.count
(lldb) 

log enable -f /tmp/lldb-log.txt lldb expr types 如果它对任何人有用:

 == [UserExpression::Evaluate] Parsing expression showersInProgress ==
 ClangUserExpression::ScanContext()
   [CUE::SC] Null function
 [C++ module config] Language doesn't support C++ modules
 List of imported modules in expression: 
 List of include directories gathered for modules: 
 Parsing the following code:


#line 1 "<lldb wrapper prefix>"
#ifndef offsetof
#define offsetof(t, d) __builtin_offsetof(t, d)
#endif
#ifndef NULL
#define NULL (__null)
#endif
#ifndef Nil
#define Nil (__null)
#endif
#ifndef nil
#define nil (__null)
#endif
#ifndef YES
#define YES ((BOOL)1)
#endif
#ifndef NO
#define NO ((BOOL)0)
#endif
typedef __INT8_TYPE__ int8_t;
typedef __UINT8_TYPE__ uint8_t;
typedef __INT16_TYPE__ int16_t;
typedef __UINT16_TYPE__ uint16_t;
typedef __INT32_TYPE__ int32_t;
typedef __UINT32_TYPE__ uint32_t;
typedef __INT64_TYPE__ int64_t;
typedef __UINT64_TYPE__ uint64_t;
typedef __INTPTR_TYPE__ intptr_t;
typedef __UINTPTR_TYPE__ uintptr_t;
typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t;
typedef unsigned short unichar;
extern "C"
{
    int printf(const char * __restrict, ...);
}

typedef bool BOOL;


void                           
$__lldb_expr(void *$__lldb_arg)          
{                              
    ;                        
#line 1 "<user expression 9>"
showersInProgress
;
#line 1 "<lldb wrapper suffix>"
}                              

 Using x86_64-apple-ios-simulator as the target triple
 Using SIMD alignment: 128
 Target datalayout string: 'e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128'
 Target ABI: ''
 Target vector alignment: 128
 ClangExpressionDeclMap::FindExternalVisibleDecls[469] for '$__lldb_arg' in a 'TranslationUnit'
   CEDM::FEVD[469] Searching the root namespace
 ClangASTSource::FindExternalVisibleDecls[469] on (ASTContext*)0x7fb6b48f1800 for '$__lldb_arg' in a 'TranslationUnit'
   CAS::FEVD[469] Searching the root namespace
 ClangExpressionDeclMap::FindExternalVisibleDecls[470] for '$__lldb_expr' in a 'TranslationUnit'
   CEDM::FEVD[470] Searching the root namespace
 ClangASTSource::FindExternalVisibleDecls[470] on (ASTContext*)0x7fb6b48f1800 for '$__lldb_expr' in a 'TranslationUnit'
   CAS::FEVD[470] Searching the root namespace
 ClangExpressionDeclMap::FindExternalVisibleDecls[471] for 'showersInProgress' in a 'TranslationUnit'
   CEDM::FEVD[471] Searching the root namespace
 Skipped a definition because it has no Clang AST
 ClangASTSource::FindExternalVisibleDecls[471] on (ASTContext*)0x7fb6b48f1800 for 'showersInProgress' in a 'TranslationUnit'
   CAS::FEVD[471] Searching the root namespace
 AppleObjCDeclVendor::FindDecls [434] ('showersInProgress', false, 1, )
 AOCTV::FT [434] Couldn't find showersInProgress in the ASTContext
 AOCTV::FT [434] Couldn't find the isa
     [ClangASTImporter] Forgetting destination (ASTContext*)0x7fb6b48f1800
     [ClangASTImporter] Forgetting source->dest (ASTContext*)0x7fb6b48f1800->(ASTContext*)0x7fb69758cc00

帧变量只显示当前帧的CompileUnit中的静态信息。如果您想查看所有需要使用目标变量的全局变量。但是请注意,目标变量仅搜索当前帧的共享库。您可以添加 --shlib 标志以将搜索定向到特定的共享库。