echo -e '#include <unistd.h>\nint main(void){\nsync();return 0;}'|./bin/clang -g -x c -;./bin/lldb -o 'file ./a.out' -o 'b main' -o r -o 'p (void)sync()'
Actual:
error: Expression can't be run, because there is no JIT compiled function
Expected:
<nothing, sync() has been executed>
Casting from 32-bit void * to uint64_t requires an intermediate uintptr_t cast otherwise the pointer gets sign-extended:
echo -e '#include <stdio.h>\n#include <stdint.h>\nint main(void){void *p=(void *)0x80000000;unsigned long long ull=(unsigned long long)p;unsigned long long ull2=(unsigned long long)(uintptr_t)p;printf("p=%p ull=0x%llx ull2=0x%llx\\n",p,ull,ull2);return 0;}'|gcc -Wall -m32 -x c -;./a.out <stdin>: In function ‘main’: <stdin>:3:66: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] p=0x80000000 ull=0xffffffff80000000 ull2=0x80000000
With debug output:
Actual:
IRMemoryMap::WriteMemory (0xb6ff8640, 0xffffffffb6f82158, 0x112) went to [0xb6ff8640..0xb6ff86b3) Code can be run in the target. Found function, has local address 0xffffffffb6f84000 and remote address 0xffffffffffffffff Couldn't disassemble function : Couldn't find code range for function _Z12$__lldb_exprPv Sections: [0xb6f84000+0x3c]->0xb6ff9020 (alignment 4, section ID 0, name .text) ... HandleCommand, command did not succeed error: Expression can't be run, because there is no JIT compiled function
Expected:
IRMemoryMap::WriteMemory (0xb6ff8640, 0xb6faa15c, 0x128) went to [0xb6ff8640..0xb6ff86c3) IRExecutionUnit::GetRemoteAddressForLocal() found 0xb6fac000 in [0xb6fac000..0xb6fac040], and returned 0xb6ff9020 from [0xb6ff9020..0xb6ff9060]. Code can be run in the target. Found function, has local address 0xb6fac000 and remote address 0xb6ff9020 Function's code range is [0xb6ff9020+0x40] ... Function data has contents: 0xb6ff9020: 10 4c 2d e9 08 b0 8d e2 08 d0 4d e2 00 40 a0 e1 ... Function disassembly: 0xb6ff9020: 0xe92d4c10 push {r4, r10, r11, lr}
Effect of this patch on ARM32:
-=before patch +=after patch ******************** -Unexpected Passing Tests (1): +Unexpected Passing Tests (3): + lldb-api :: commands/expression/char/TestExprsChar.py + lldb-api :: commands/expression/ir-interpreter/TestIRInterpreter.py lldb-api :: linux/builtin_trap/TestBuiltinTrap.py ******************** -Failing Tests (102): +Failing Tests (43): - lldb-api :: commands/expression/argument_passing_restrictions/TestArgumentPassingRestrictions.py - lldb-api :: commands/expression/call-function/TestCallStdStringFunction.py - lldb-api :: commands/expression/call-function/TestCallStopAndContinue.py - lldb-api :: commands/expression/call-function/TestCallUserDefinedFunction.py - lldb-api :: commands/expression/call-overridden-method/TestCallOverriddenMethod.py - lldb-api :: commands/expression/call-restarts/TestCallThatRestarts.py - lldb-api :: commands/expression/char/TestExprsChar.py - lldb-api :: commands/expression/class_template_specialization_empty_pack/TestClassTemplateSpecializationParametersHandling.py - lldb-api :: commands/expression/context-object/TestContextObject.py - lldb-api :: commands/expression/dont_allow_jit/TestAllowJIT.py - lldb-api :: commands/expression/entry-bp/TestExprEntryBP.py - lldb-api :: commands/expression/expr-in-syscall/TestExpressionInSyscall.py - lldb-api :: commands/expression/formatters/TestFormatters.py - lldb-api :: commands/expression/inline-namespace/TestInlineNamespace.py - lldb-api :: commands/expression/no-deadlock/TestExprDoesntBlock.py - lldb-api :: commands/expression/persistent_types/TestNestedPersistentTypes.py - lldb-api :: commands/expression/persistent_types/TestPersistentTypes.py - lldb-api :: commands/expression/pr35310/TestExprsBug35310.py - lldb-api :: commands/expression/radar_9531204/TestPrintfAfterUp.py - lldb-api :: commands/expression/radar_9673664/TestExprHelpExamples.py lldb-api :: commands/expression/rdar44436068/Test128BitsInteger.py - lldb-api :: commands/expression/static-initializers/TestStaticInitializers.py - lldb-api :: commands/expression/test/TestExprs.py - lldb-api :: commands/expression/timeout/TestCallWithTimeout.py - lldb-api :: commands/expression/unwind_expression/TestUnwindExpression.py - lldb-api :: commands/expression/xvalue/TestXValuePrinting.py lldb-api :: commands/register/register/register_command/TestRegisters.py lldb-api :: commands/watchpoints/hello_watchlocation/TestWatchLocation.py lldb-api :: commands/watchpoints/multi_watchpoint_slots/TestWatchpointMultipleSlots.py lldb-api :: commands/watchpoints/watchpoint_size/TestWatchpointSizes.py lldb-api :: functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py - lldb-api :: functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py - lldb-api :: functionalities/data-formatter/data-formatter-synthval/TestDataFormatterSynthVal.py lldb-api :: functionalities/load_unload/TestLoadUnload.py - lldb-api :: functionalities/load_using_paths/TestLoadUsingPaths.py - lldb-api :: functionalities/memory/find/TestMemoryFind.py - lldb-api :: functionalities/process_group/TestChangeProcessGroup.py lldb-api :: functionalities/return-value/TestReturnValue.py lldb-api :: functionalities/show_location/TestShowLocationDwarf5.py lldb-api :: functionalities/thread/num_threads/TestNumThreads.py - lldb-api :: lang/c/const_variables/TestConstVariables.py - lldb-api :: lang/c/function_types/TestFunctionTypes.py - lldb-api :: lang/c/shared_lib/TestSharedLib.py - lldb-api :: lang/c/strings/TestCStrings.py - lldb-api :: lang/c/struct_types/TestStructTypes.py - lldb-api :: lang/cpp/auto/TestCPPAuto.py - lldb-api :: lang/cpp/call-function/TestCallCPPFunction.py - lldb-api :: lang/cpp/chained-calls/TestCppChainedCalls.py - lldb-api :: lang/cpp/class-template-parameter-pack/TestClassTemplateParameterPack.py - lldb-api :: lang/cpp/extern_c/TestExternCSymbols.py - lldb-api :: lang/cpp/global_operators/TestCppGlobalOperators.py - lldb-api :: lang/cpp/lambdas/TestLambdas.py - lldb-api :: lang/cpp/llvm-style/TestLLVMStyle.py - lldb-api :: lang/cpp/namespace/TestNamespace.py - lldb-api :: lang/cpp/namespace/TestNamespaceLookup.py - lldb-api :: lang/cpp/namespace_conflicts/TestNamespaceConflicts.py - lldb-api :: lang/cpp/namespace_definitions/TestNamespaceDefinitions.py - lldb-api :: lang/cpp/operators/TestCppOperators.py - lldb-api :: lang/cpp/overloaded-functions/TestOverloadedFunctions.py - lldb-api :: lang/cpp/rvalue-references/TestRvalueReferences.py - lldb-api :: lang/cpp/scope/TestCppScope.py - lldb-api :: lang/cpp/static_methods/TestCPPStaticMethods.py - lldb-api :: lang/cpp/symbols/TestSymbols.py - lldb-api :: lang/cpp/template-function/TestTemplateFunctions.py - lldb-api :: lang/cpp/template/TestTemplateArgs.py - lldb-api :: lang/cpp/this/TestCPPThis.py lldb-api :: lang/cpp/trivial_abi/TestTrivialABI.py - lldb-api :: lang/cpp/unicode-literals/TestUnicodeLiterals.py - lldb-api :: lang/cpp/virtual/TestVirtual.py lldb-api :: python_api/thread/TestThreadAPI.py lldb-api :: tools/lldb-server/TestLldbGdbServer.py lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_INTERP.yaml lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-PT_TLS.yaml lldb-shell :: ObjectFile/ELF/PT_LOAD-overlap-section.yaml lldb-shell :: ObjectFile/ELF/PT_LOAD.yaml lldb-shell :: ObjectFile/ELF/PT_TLS-overlap-PT_LOAD.yaml lldb-shell :: Reproducer/Functionalities/TestDataFormatter.test lldb-shell :: Reproducer/Functionalities/TestImageList.test lldb-shell :: Reproducer/Functionalities/TestStepping.test lldb-shell :: Reproducer/TestDump.test lldb-shell :: Reproducer/TestGDBRemoteRepro.test lldb-shell :: Reproducer/TestRelativePath.test lldb-shell :: Reproducer/TestReuseDirectory.test lldb-shell :: Reproducer/TestSynchronous.test lldb-shell :: Reproducer/TestWorkingDir.test lldb-shell :: SymbolFile/DWARF/anon_class_w_and_wo_export_symbols.ll lldb-shell :: SymbolFile/DWARF/clang-ast-from-dwarf-unamed-and-anon-structs.cpp - lldb-shell :: SymbolFile/DWARF/debug-types-expressions.test lldb-shell :: SymbolFile/NativePDB/ast-functions.cpp lldb-shell :: SymbolFile/NativePDB/ast-methods.cpp lldb-shell :: SymbolFile/NativePDB/ast-types.cpp lldb-shell :: SymbolFile/NativePDB/bitfields.cpp lldb-shell :: SymbolFile/NativePDB/break-by-function.cpp lldb-shell :: SymbolFile/NativePDB/break-by-line.cpp lldb-shell :: SymbolFile/NativePDB/function-types-builtins.cpp lldb-shell :: SymbolFile/NativePDB/function-types-classes.cpp lldb-shell :: SymbolFile/NativePDB/global-classes.cpp lldb-shell :: SymbolFile/NativePDB/globals-bss.cpp lldb-shell :: SymbolFile/NativePDB/globals-fundamental.cpp lldb-shell :: SymbolFile/NativePDB/nested-types.cpp lldb-shell :: SymbolFile/NativePDB/source-list.cpp lldb-shell :: SymbolFile/NativePDB/tag-types.cpp -******************** -Unresolved Tests (1): - lldb-api :: functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
For me even LLDB trunk was failing. And I do not see how the functionality could be affected by my D63540.
This can probably just be:
since this is a function call and "fun_ptr" will be correctly converted to a lldb::addr_t