one more bug in evaluation


I've tried to evaluate something like
(lldb) p *(std::pair<int, int> *)0x000000010083ea00

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000000000000001c
[Switching to process 2364 thread 0x260b]
0x0000000100371a14 in clang::ASTContext::getASTRecordLayout ()
(gdb) bt
#0 0x0000000100371a14 in clang::ASTContext::getASTRecordLayout ()
#1 0x00000001002ca57e in clang::ASTContext::getTypeInfo ()
#2 0x00000001002ca4ec in clang::ASTContext::getTypeInfo ()
#3 0x00000001002ca4ec in clang::ASTContext::getTypeInfo ()
#4 0x00000001012bc42d in clang::ASTContext::getTypeInfo ()
#5 0x00000001012bcbd5 in clang::ASTContext::getTypeSize ()
#6 0x00000001012ba04c in lldb_private::ClangASTType::GetClangTypeBitWidth ()
#7 0x00000001012b9ff0 in lldb_private::ClangASTType::GetClangTypeBitWidth ()
#8 0x000000010113a573 in IRForTarget::CreateResultVariable ()
#9 0x000000010114553e in IRForTarget::runOnModule ()
#10 0x0000000101112b20 in lldb_private::ClangExpressionParser::PrepareForExecution ()
#11 0x000000010111cf5a in lldb_private::ClangUserExpression::Parse ()
#12 0x000000010111ebe8 in lldb_private::ClangUserExpression::EvaluateWithError ()
#13 0x000000010111e87a in lldb_private::ClangUserExpression::Evaluate ()
#14 0x000000010135168e in lldb_private::Target::EvaluateExpression ()
#15 0x0000000100fc54af in lldb_private::CommandObjectExpression::EvaluateExpression ()
#16 0x0000000100fc6107 in lldb_private::CommandObjectExpression::ExecuteRawCommandString ()
#17 0x00000001011830e0 in lldb_private::CommandInterpreter::HandleCommand ()
#18 0x00000001001ec154 in lldb::SBCommandInterpreter::HandleCommand (this=0x104c86d40, command_line=0x1049473f8 "p *(std::pair<int, int> *)0x000000010083ea00", result=@0x104c86d38, add_to_history=true) at /Users/zajac/Projects/lldb-92/source/API/SBCommandInterpreter.cpp:97
#19 0x00000001000870ba in jetcidr::DebugSession::HandleConsoleCommand (this=0x102c237e0, command=@0x10498b9a0, err=0x104c86de0, out=0x104c86dd8) at /Users/zajac/Projects/ULTIMATE/CIDR/LLDBProtobufFrontend/LLDBProtobufFrontend/src/DebugSession.cpp:611

Andrey Zaytsev
JetBrains, Inc
Develop with pleasure!



are you able to reproduce this regularly? I get the following error:

(lldb) p *(std::pair<int, int> *)0x000000010083ea00
error: no member named 'pair' in namespace 'std'
error: expected '(' for function-style cast or type construction
error: expected '(' for function-style cast or type construction
error: expected expression
error: 4 errors parsing expression

I saw this error in LLDB-76. Try it with LLDB-92 and let me know if you will not get the crash.

If I typedef it to pair_t, I get

(lldb) p *(pair_t*)0x000000010083ea00
(pair_t) $0 = {
(int) first = 0
(int) second = 0

This works.
But I'm implementing displaying of stl containers and I need the ability to read object from specified address.
Reading that pair was needed for std::map.
Please fix it if you can :wink:

Thank you.