summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression
Commit message (Collapse)AuthorAgeFilesLines
...
* [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere2019-07-249-362/+320
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 llvm-svn: 366936
* [NFC] Remove instances of unused ClangASTContext headerAlex Langford2019-07-192-2/+1
| | | | llvm-svn: 366519
* [Expression] Move IRDynamicChecks to ClangExpressionParserAlex Langford2019-07-122-594/+0
| | | | | | | | | | | | | | | | | | Summary: IRDynamicChecks in its current form is specific to Clang since it deals with the C language family. It is possible that we may want to instrument code generated for other languages, but we can factor in a more general mechanism to do so at a later time. This decouples ObCLanguageRuntime from Expression! Reviewers: compnerd, clayborg, jingham, JDevlieghere Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D64591 llvm-svn: 365853
* [Expression] IR Instrumenters should have a UtilityFunctionAlex Langford2019-07-101-14/+15
| | | | | | | | | Right now, IR Instrumenters take a DynamicCheckerFunctions object which has all the UtilityFunctions used to instrument IR for expressions. However, each Instrumenter (in practice) uses exactly one UtilityFunction, so let's change the abstraction. llvm-svn: 365696
* [lldb] Quick Fix: IRExecutionUnit check pointer before access itAlex Langford2019-07-091-3/+3
| | | | | | | | | | | | Summary: Move checking pointer code block before accessing the pointer This caused lldb to crash when testing on Android Patch by Wanyi Ye! Differential Revision: https://reviews.llvm.org/D64434 llvm-svn: 365567
* Fix for r364686 - actually set symbol_is_missing_weak...Jim Ingham2019-07-021-2/+3
| | | | | | | | | | This was set in a std::function, but I was shadowing a variable that I thought I was capturing. Even with this bug we were correctly not raising an error and returning an address of 0x0. We were not marking the symbol as weak, but apparently the JIT didn't need that, so the test still passed. llvm-svn: 364980
* Get the expression parser to handle missing weak symbols.Jim Ingham2019-06-282-26/+70
| | | | | | | | | | MachO only for this patch. Differential Revision: https://reviews.llvm.org/D63914 <rdar://problem/51463642> llvm-svn: 364686
* Have DWARFUnit store a *reference* to SymbolFileDWARFPavel Labath2019-06-141-2/+2
| | | | | | | | | | | | Previously it was storing a *pointer*, which left open the possibility of this pointer being null. We never made use of that possibility (it does not make sense), and most of the code was already assuming that. However, there were a couple of null-checks scattered around the code. This patch replaces the reference with a pointer, making the non-null-ness explicit, and removes the remaining null-checks. llvm-svn: 363381
* [Target] Remove Process::GetObjCLanguageRuntimeAlex Langford2019-06-101-1/+1
| | | | | | | | | | | Summary: In an effort to make Process more language agnostic, I removed GetCPPLanguageRuntime from Process. I'm following up now with an equivalent change for ObjC. Differential Revision: https://reviews.llvm.org/D63052 llvm-svn: 362981
* [Target] Move ObjCLanguageRuntime::LookupRuntimeSymbol into LanguageRuntimeAlex Langford2019-06-031-5/+3
| | | | | | | | | | | | | | | | | | Summary: LookupRuntimeSymbol seems like a general LanguageRuntime method. Although no other language runtime currently implements this, there's no reason another language runtime couldn't use this. Additionally, this breaks IRExecutionUnit's dependency on ObjCLanguageRuntime. Reviewers: compnerd, labath, JDevlieghere, davide Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D62795 llvm-svn: 362458
* [DWARFExpression] Remove ctor that takes just a compile unit.Jonas Devlieghere2019-05-281-48/+13
| | | | | | | | | | | | | | | | Like many of our DWARF classes, the DWARFExpression can be initialized in several ways. One such way was through a constructor that takes just the compile unit. This constructor is used to initialize both empty DWARFExpressions, and DWARFExpression that will be populated later. To make the distinction more clear, I changed the constructor to a default constructor and updated its call sites. Where the DWARFExpression was being populated later, I replaced that with a call to the copy assignment constructor. Differential revision: https://reviews.llvm.org/D62425 llvm-svn: 361849
* [DWARFExpression] Remove commented-out code (NFC)Jonas Devlieghere2019-05-241-119/+0
| | | | llvm-svn: 361672
* [lldb] NFC modernize codebase with modernize-use-nullptrKonrad Kleine2019-05-238-29/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: NFC = [[ https://llvm.org/docs/Lexicon.html#nfc | Non functional change ]] This commit is the result of modernizing the LLDB codebase by using `nullptr` instread of `0` or `NULL`. See https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html for more information. This is the command I ran and I to fix and format the code base: ``` run-clang-tidy.py \ -header-filter='.*' \ -checks='-*,modernize-use-nullptr' \ -fix ~/dev/llvm-project/lldb/.* \ -format \ -style LLVM \ -p ~/llvm-builds/debug-ninja-gcc ``` NOTE: There were also changes to `llvm/utils/unittest` but I did not include them because I felt that maybe this library shall be updated in isolation somehow. NOTE: I know this is a rather large commit but it is a nobrainer in most parts. Reviewers: martong, espindola, shafik, #lldb, JDevlieghere Reviewed By: JDevlieghere Subscribers: arsenm, jvesely, nhaehnle, hiraditya, JDevlieghere, teemperor, rnkovacs, emaste, kubamracek, nemanjai, ki.stfu, javed.absar, arichardson, kbarton, jrtc27, MaskRay, atanasyan, dexonsmith, arphaman, jfb, jsji, jdoerfert, lldb-commits, llvm-commits Tags: #lldb, #llvm Differential Revision: https://reviews.llvm.org/D61847 llvm-svn: 361484
* Expression: correct relocation model for WindowsSaleem Abdulrasool2019-05-221-10/+4
| | | | | | | | | | | The Windows Code Generation model cannot generation code with the PIC relocation model - all code is implicitly position independent due to the DLL load slide that occurs if it is not loaded at the preferred base address. Invert the condition and inline the single use of the variable. This should also aid the WASM target. This significantly improves the state of the (swift) repl on Windows (and should aid in expression evaluation on Windows). llvm-svn: 361443
* DWARF: Port debug_addr over to DWARFContextPavel Labath2019-05-211-24/+7
| | | | llvm-svn: 361232
* [CMake] Correct some dependenciesAlex Langford2019-05-211-0/+1
| | | | | | Symbol doesn't depend on CPlusPlusLanguage, but Expressiond does. llvm-svn: 361216
* [IRExecutionUnit] Remove static_assertJonas Devlieghere2019-05-161-2/+0
| | | | | | This doesn't make sense on platforms other than 64 bit. llvm-svn: 360916
* Delete unnecessary copy ctors/copy assignment operatorsFangrui Song2019-05-151-5/+0
| | | | | | It's the simplest and gives the cleanest semantics. llvm-svn: 360762
* Replace assert with static_assert here applicable.Jonas Devlieghere2019-05-151-1/+1
| | | | | | | Replaces assert() with static_assert() if the condition is can be evaluated at compile time. llvm-svn: 360753
* [Expression] Remove unused dependencyAlex Langford2019-05-072-2/+1
| | | | | | | | | lldbExpression was linking against lldbPluginExpressionParserClang, and lldbPluginExpressionParserClang was linking against lldbExpression. There's no reason lldbExpression should need anything from lldbPluginExpressionParserClang, so let's remove that dependency. llvm-svn: 360208
* DWARFExpression: Fix implementation of DW_OP_pickPavel Labath2019-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | Summary: The DWARF spec states that the DWARF stack arguments are numbered from the top. Our implementation of DW_OP_pick was counting them from the bottom. This bug probably wasn't noticed because nobody (except my upcoming postfix-to-DWARF converter) uses DW_OP_pick, but I've cross-checked with gdb to confirm that counting from the top is the expected behavior. This patch fixes the implementation to match the spec and gdb behavior and adds a test. Reviewers: jasonmolenda, clayborg Subscribers: mgorny, aprantl, lldb-commits Differential Revision: https://reviews.llvm.org/D61182 llvm-svn: 359436
* [IRMemoryMap] Fix -Wimplicit-fallthrough in -DLLVM_ENABLE_ASSERTIONS=off buildFangrui Song2019-04-121-1/+1
| | | | llvm-svn: 358249
* [NFC] Remove ASCII lines from commentsJonas Devlieghere2019-04-104-135/+0
| | | | | | | | | | | | | | | | | | | | | | | A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
* Rename Target::GetSharedModule to Target::GetOrCreateModule.Jason Molenda2019-04-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a flag to control whether the ModulesDidLoad notification is called when a module is added. If the notifications are disabled, the caller must call ModulesDidLoad after adding all the new modules, but postponing this notification until they're all batched up can allow for better efficiency than notifying one-by-one. Change the name of the ModuleList notifier functions that a subclass can implement to start with 'Notify' to make it clear what they are. Add a NotifyModulesRemoved. Add header documentation for the changed/updated methods. Added defaulted-value 'notify' argument to ModuleList Append, AppendIfNeeded, and Remove because callers working with a local ModuleList don't have an obvious idea of what notify means in this context. When the ModuleList is a part of the Target class, the notify behavior matters. DynamicLoaderDarwin has been updated so that libraries being added/removed are correctly batched up before notifications are sent. Added the TestModuleLoadedNotifys.py test to run on Darwin to test this. <rdar://problem/48293064> Differential Revision: https://reviews.llvm.org/D60172 llvm-svn: 357955
* Fix an invalid static cast in ClangExpressionParser.cppAdrian Prantl2019-03-135-11/+19
| | | | | | | | | | This was found by the green dragon sanitizer bot. rdar://problem/48536644 Differential Revision: https://reviews.llvm.org/D59314 llvm-svn: 356090
* Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl2019-03-112-20/+20
| | | | | | This changes '@' prefix to '\'. llvm-svn: 355841
* Quiet command regex instructions during batch executionDave Lee2019-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Within .lldbinit, regex commands can be structured as a list of substitutions over multiple lines. It's possible that this is uninentional, but it works and has benefits. For example: command regex <command-name> s/pat1/repl1/ s/pat2/repl2/ ... I use this form of `command regex` in my `~/.lldbinit`, because it makes it clearer to write and read compared to a single line definition, because multiline substitutions don't need to be quoted, and are broken up one per line. However, multiline definitions result in usage instructions being printed for each use. The result is that every time I run `lldb`, I get a dozen or more lines of noise. With this change, the instructions are only printed when `command regex` is invoked interactively, or from a terminal, neither of which are true when lldb is sourcing `~/.lldbinit`. Reviewers: clayborg, jingham Reviewed By: clayborg Subscribers: jdoerfert, kastiglione, xiaobai, keith, lldb-commits Differential Revision: https://reviews.llvm.org/D48752 llvm-svn: 355793
* Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/CommandsJonas Devlieghere2019-03-091-15/+1
| | | | | | | | | | Inspired by Zachary's mail on lldb-dev, this seemed like low hanging fruit. This patch breaks the circular dependency between commands and expression. Differential revision: https://reviews.llvm.org/D59158 llvm-svn: 355762
* [lldb] Fix DW_OP_addrx uses.Ali Tamur2019-03-071-2/+9
| | | | | | | | | | | | | | | | Summary: DW_OP_GNU_addr_index has been renamed as DW_OP_addrx in the standard. clang produces DW_OP_addrx tags and with this change lldb starts to process them. Reviewers: aprantl, jingham, davide, clayborg, serge-sans-paille Reviewed By: aprantl Subscribers: jdoerfert, dblaikie, labath, shafik, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D59004 llvm-svn: 355629
* Fix Cmake files for ExpressionSourceCode.cpp -> ClangExpressionSourceCode.cpp.Jim Ingham2019-03-061-1/+0
| | | | llvm-svn: 355561
* Factor the clang specific parts of ExpressionSourceCode.{h,cpp} into the ↵Jim Ingham2019-03-064-388/+2
| | | | | | | | | | clang plugin. NFC Differential Revision: https://reviews.llvm.org/D59040 llvm-svn: 355560
* Pass ConstString by value (NFC)Adrian Prantl2019-03-062-8/+8
| | | | | | | | | | | | | | | | | My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
* [Expression] Remove unused parameter from EvaluateAlex Langford2019-03-052-2/+1
| | | | llvm-svn: 355375
* [Reproducers] Capture and replay interpreter commands.Jonas Devlieghere2019-03-021-7/+7
| | | | | | | | | | | | | | | | | This patch adds the necessary logic to capture and replay commands entered into the command interpreter. A DataRecorder shadows the input and writes its data to a know file. During replay this file is used as the command interpreter's input. It's possible to the command interpreter more than once, with a different input source. We support this scenario by using multiple buffers. The synchronization for this takes place at the SB layer, where we create a new recorder every time the debugger input is changed. During replay we use the corresponding buffer as input. Differential revision: https://reviews.llvm.org/D58564 llvm-svn: 355249
* Pass arguments correctly to the objc object checker on arm64Jim Ingham2019-02-271-2/+9
| | | | | | | | | | | | | | | | | Traditionally objc had two entry points, objc_msgSend for scalar return methods, and objc_msgSend_stret for struct return convention methods. But on arm64 the second was not needed (since arm64 doesn't use an argument register for the struct return pointer) so it was removed. The code that dispatches to the objc object checker when it sees some flavor of objc_msgSend was not aware of this change so was sending the wrong arguments to the checker. <rdar://problem/48315890> Differential Revision: https://reviews.llvm.org/D58699 llvm-svn: 355026
* Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere2019-02-134-40/+37
| | | | | | | | | | | | | | | | | The `ap` suffix is a remnant of lldb's former use of auto pointers, before they got deprecated. Although all their uses were replaced by unique pointers, some variables still carried the suffix. In r353795 I removed another auto_ptr remnant, namely redundant calls to ::get for unique_pointers. Jim justly noted that this is a good opportunity to clean up the variable names as well. I went over all the changes to ensure my find-and-replace didn't have any undesired side-effects. I hope I didn't miss any, but if you end up at this commit doing a git blame on a weirdly named variable, please know that the change was unintentional. llvm-svn: 353912
* Remove redundant ::get() for smart pointer. (NFC)Jonas Devlieghere2019-02-122-5/+4
| | | | | | | | This commit removes redundant calls to smart pointer’s ::get() method. https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-smartptr-get.html llvm-svn: 353795
* Use std::make_shared in LLDB (NFC)Jonas Devlieghere2019-02-112-7/+11
| | | | | | | | | | | Unlike std::make_unique, which is only available since C++14, std::make_shared is available since C++11. Not only is std::make_shared a lot more readable compared to ::reset(new), it also performs a single heap allocation for the object and control block. Differential revision: https://reviews.llvm.org/D57990 llvm-svn: 353764
* [opaque pointer types] Update calls to CreateCall to pass the functionJames Y Knight2019-02-081-6/+6
| | | | | | type in lldb and polly. llvm-svn: 353549
* [Expressions] Add support of expressions evaluation in some object's contextAleksandr Urakov2019-02-052-10/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds support of expression evaluation in a context of some object. Consider the following example: ``` struct S { int a = 11; int b = 12; }; int main() { S s; int a = 1; int b = 2; // We have stopped here return 0; } ``` This patch allows to do something like that: ``` lldb.frame.FindVariable("s").EvaluateExpression("a + b") ``` and the result will be `33` (not `3`) because fields `a` and `b` of `s` will be used (not locals `a` and `b`). This is achieved by replacing of `this` type and object for the expression. This has some limitations: an expression can be evaluated only for values located in the debuggee process memory (they must have an address of `eAddressTypeLoad` type). Reviewers: teemperor, clayborg, jingham, zturner, labath, davide, spyffe, serge-sans-paille Reviewed By: jingham Subscribers: abidh, lldb-commits, leonid.mashinskiy Tags: #lldb Differential Revision: https://reviews.llvm.org/D55318 llvm-svn: 353149
* [PDB] Fix location retrieval for function local variables and arguments that areAleksandr Urakov2019-02-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | stored relative to VFRAME Summary: This patch makes LLDB able to retrieve proper values for function arguments and local variables stored in PDB relative to VFRAME register. Patch contains retrieval of corresponding FPO table entries from PDB and a generic translator from FPO programs to DWARF expressions to get correct VFRAME value. Patch also improves variables-locations.test and makes this test passable on x86. Patch By: leonid.mashinsky Reviewers: zturner, asmith, stella.stamenova, aleksandr.urakov Reviewed By: zturner Subscribers: arphaman, labath, mgorny, aprantl, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D55122 llvm-svn: 352845
* Make Type::GetByteSize optional (NFC)Adrian Prantl2019-01-291-1/+2
| | | | | | | | | | | This is a continuation of my quest to make the size 0 a supported value. This reapplies r352394 with additional PDB parser fixes prepared by Pavel Labath! Differential Revision: https://reviews.llvm.org/D57273 llvm-svn: 352521
* Revert "Make Type::GetByteSize optional (NFC)"Adrian Prantl2019-01-281-2/+1
| | | | | | This reverts commit r352394 because it broke three windows-specific tests. llvm-svn: 352434
* Make Type::GetByteSize optional (NFC)Adrian Prantl2019-01-281-1/+2
| | | | | | | | This is a continuation of my quest to make the size 0 a supported value. Differential Revision: https://reviews.llvm.org/D57273 llvm-svn: 352394
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1915-60/+45
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Replace auto -> llvm::Optional<uint64_t>Adrian Prantl2019-01-151-2/+2
| | | | | | This addresses post-commit feedback for https://reviews.llvm.org/D56688 llvm-svn: 351237
* Make CompilerType::getBitSize() / getByteSize() return an optional result. NFCAdrian Prantl2019-01-151-4/+9
| | | | | | | | | | | | | | | | | | | | | | | The code in LLDB assumes that CompilerType and friends use the size 0 as a sentinel value to signal an error. This works for C++, where no zero-sized type exists, but in many other programming languages (including I believe C) types of size zero are possible and even common. This is a particular pain point in swift-lldb, where extra code exists to double-check that a type is *really* of size zero and not an error at various locations. To remedy this situation, this patch starts by converting CompilerType::getBitSize() and getByteSize() to return an optional result. To avoid wasting space, I hand-rolled my own optional data type assuming that no type is larger than what fits into 63 bits. Follow-up patches would make similar changes to the ValueObject hierarchy. rdar://problem/47178964 Differential Revision: https://reviews.llvm.org/D56688 llvm-svn: 351214
* [opaque pointer types] Remove some calls to generic Type subtype accessors.James Y Knight2019-01-101-3/+0
| | | | | | | | | | | | That is, remove many of the calls to Type::getNumContainedTypes(), Type::subtypes(), and Type::getContainedType(N). I'm not intending to remove these accessors -- they are useful/necessary in some cases. However, removing the pointee type from pointers would potentially break some uses, and reducing the number of calls makes it easier to audit. llvm-svn: 350835
* Simplify ObjectFile::GetArchitecturePavel Labath2019-01-031-7/+4
| | | | | | | | | | | | | | | | Summary: instead of returning the architecture through by-ref argument and a boolean value indicating success, we can just return the ArchSpec directly. Since the ArchSpec already has an invalid state, it can be used to denote the failure without the additional bool. Reviewers: clayborg, zturner, espindola Subscribers: emaste, arichardson, JDevlieghere, lldb-commits Differential Revision: https://reviews.llvm.org/D56129 llvm-svn: 350291
* Simplify Boolean expressionsJonas Devlieghere2018-12-153-13/+8
| | | | | | | | | | | This patch simplifies boolean expressions acorss LLDB. It was generated using clang-tidy with the following command: run-clang-tidy.py -checks='-*,readability-simplify-boolean-expr' -format -fix $PWD Differential revision: https://reviews.llvm.org/D55584 llvm-svn: 349215
OpenPOWER on IntegriCloud