[lldb] Treat address found via function name as a callable address (#151973) I discovered this building the lldb test suite with `-mthumb` set, so that all test programs are purely Arm Thumb code. When C++ expressions did a function lookup, they took a different path from C programs. That path happened to land on the line that I've changed. Where we try to look something up as a function, but don't then resolve the address as if it's a callable. With Thumb, if you do the non-callable lookup, the bottom bit won't be set. This means when lldb's expression wrapper function branches into the found function, it'll be in Arm mode trying to execute Thumb code. Thumb is the only instance where you'd notice this. Aside from maybe MicroMIPS or MIPS16 perhaps but I expect that there are 0 users of that and lldb. I have added a new test case that will simulate this situation in "normal" Arm builds so that it will get run on Linaro's buildbot. This change also fixes the following existing tests when `-mthumb` is used: ``` lldb-api :: commands/expression/anonymous-struct/TestCallUserAnonTypedef.py lldb-api :: commands/expression/argument_passing_restrictions/TestArgumentPassingRestrictions.py lldb-api :: commands/expression/call-function/TestCallStopAndContinue.py lldb-api :: commands/expression/call-function/TestCallUserDefinedFunction.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/formatters/TestFormatters.py lldb-api :: commands/expression/import_base_class_when_class_has_derived_member/TestImportBaseClassWhenClassHasDerivedMember.py lldb-api :: commands/expression/inline-namespace/TestInlineNamespace.py lldb-api :: commands/expression/namespace-alias/TestInlineNamespaceAlias.py lldb-api :: commands/expression/no-deadlock/TestExprDoesntBlock.py lldb-api :: commands/expression/pr35310/TestExprsBug35310.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/top-level/TestTopLevelExprs.py lldb-api :: commands/expression/unwind_expression/TestUnwindExpression.py lldb-api :: commands/expression/xvalue/TestXValuePrinting.py lldb-api :: functionalities/thread/main_thread_exit/TestMainThreadExit.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/constructors/TestCppConstructors.py lldb-api :: lang/cpp/function-qualifiers/TestCppFunctionQualifiers.py lldb-api :: lang/cpp/function-ref-qualifiers/TestCppFunctionRefQualifiers.py lldb-api :: lang/cpp/global_operators/TestCppGlobalOperators.py lldb-api :: lang/cpp/llvm-style/TestLLVMStyle.py lldb-api :: lang/cpp/multiple-inheritance/TestCppMultipleInheritance.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/operators/TestCppOperators.py lldb-api :: lang/cpp/overloaded-functions/TestOverloadedFunctions.py lldb-api :: lang/cpp/rvalue-references/TestRvalueReferences.py lldb-api :: lang/cpp/static_methods/TestCPPStaticMethods.py lldb-api :: lang/cpp/template/TestTemplateArgs.py lldb-api :: python_api/thread/TestThreadAPI.py ``` There are other failures that are due to different problems, and this change does not make those worse. (I have no plans to run the test suite with `-mthumb` regularly, I just did it to test some other refactoring)
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.