aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/StackFrame.cpp
AgeCommit message (Collapse)AuthorFilesLines
2022-11-16Make CompilerType safeAdrian Prantl1-2/+4
When a process gets restarted TypeSystem objects associated with it may get deleted, and any CompilerType objects holding on to a reference to that type system are a use-after-free in waiting. Because of the SBAPI, we don't have tight control over where CompilerTypes go and when they are used. This is particularly a problem in the Swift plugin, where the scratch TypeSystem can be restarted while the process is still running. The Swift plugin has a lock to prevent abuse, but where there's a lock there can be bugs. This patch changes CompilerType to store a std::weak_ptr<TypeSystem>. Most of the std::weak_ptr<TypeSystem>* uglyness is hidden by introducing a wrapper class CompilerType::WrappedTypeSystem that has a dyn_cast_or_null() method. The only sites that need to know about the weak pointer implementation detail are the ones that deal with creating TypeSystems. rdar://101505232 Differential Revision: https://reviews.llvm.org/D136650
2022-09-12Add the ability to show when variables fails to be available when debug info ↵Greg Clayton1-8/+21
is valid. Summary: Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience. Examples of this include: - enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables - unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file. This patch adds an new API to SBValueList: lldb::SBError lldb::SBValueList::GetError(); object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available. This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList. It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above: (lldb) frame variable error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match Reviewers: labath JDevlieghere aadsm yinghuitan jdoerfert sscalpone Subscribers: Differential Revision: https://reviews.llvm.org/D133164
2022-09-12Revert "Add the ability to show when variables fails to be available when ↵Stella Stamenova1-21/+8
debug info is valid." This reverts commit 9af089f5179d52c6561ec27532880edcfb6253af. This broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23528
2022-09-09Add the ability to show when variables fails to be available when debug info ↵Greg Clayton1-8/+21
is valid. Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience. Examples of this include: - enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables - unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file. This patch adds an new API to SBValueList: lldb::SBError lldb::SBValueList::GetError(); object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available. This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList. It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above: (lldb) frame variable error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match Differential Revision: https://reviews.llvm.org/D133164
2022-08-08[lldb] LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song1-3/+3
2022-07-26StackFrame::GetValueObjectForFrameVariable holds the StackFrame lock too long.Jim Ingham1-17/+25
This can cause a deadlock if other threads use the common pattern of "lock the StackFrameList, get a frame, lock the StackFrame." Differential Revision: https://reviews.llvm.org/D130524
2022-07-12Reland "[LLDB][NFC] Decouple dwarf location table from DWARFExpression."Zequan Wu1-5/+5
This reland 227dffd0b6d78154516ace45f6ed28259c7baa48 and 562c3467a6738aa89203f72fc1d1343e5baadf3c with failed api tests fixed by keeping function base file addres in DWARFExpressionList.
2022-07-07Revert "[LLDB][NFC] Decouple dwarf location table from DWARFExpression."Jonas Devlieghere1-6/+12
This reverts commit 227dffd0b6d78154516ace45f6ed28259c7baa48 and its follow up 562c3467a6738aa89203f72fc1d1343e5baadf3c because it breaks a bunch of tests on GreenDragon: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/45155/
2022-07-07[LLDB][NFC] Decouple dwarf location table from DWARFExpression.Zequan Wu1-12/+6
Differential Revision: https://reviews.llvm.org/D125509
2022-06-19[lldb] Use value_or instead of getValueOr (NFC)Kazu Hirata1-3/+3
2022-06-15[lldb] Support non-pointer implicit this/self in ↵Dave Lee1-2/+8
GetValueForVariableExpressionPath The `frame variable` command supports an implicit `this`/`self`, allowing a user to run `v some_field` instead of `v this->some_field`. However, some languages have non-pointer `this`/`self` types (for example, Swift). This change adds support for non-pointer implicit `this`/`self`. This is done by consulting the type of the instance variable. If the type is known to be non-pointer, the dot operator is used instead of the arrow operator. The C language of families each have a pointer instance type, which makes testing of this difficult. Tests for this feature will be done in the Swift downstream fork, as Swift's `self` is a non-pointer (reference) type. rdar://82095148 Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D127605
2022-02-03[lldb] Rename Logging.h to LLDBLog.h and clean up includesPavel Labath1-0/+1
Most of our code was including Log.h even though that is not where the "lldb" log channel is defined (Log.h defines the generic logging infrastructure). This worked because Log.h included Logging.h, even though it should. After the recent refactor, it became impossible the two files include each other in this direction (the opposite inclusion is needed), so this patch removes the workaround that was put in place and cleans up all files to include the right thing. It also renames the file to LLDBLog to better reflect its purpose.
2022-02-02[lldb] Convert "LLDB" log channel to the new APIPavel Labath1-3/+2
2022-01-26[lldb] Correct \params to \param in StackFrame Doxygen commentsDavid Spickett1-3/+3
2021-12-09[lldb/Target] Refine source display warning for artificial locations (NFC)Med Ismail Bennani1-7/+6
This is a post-review update for D115313, to rephrase source display warning messages for artificial locations, making them more understandable for the end-user. Differential Revision: https://reviews.llvm.org/D115461 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-12-08[lldb/Target] Slide source display for artificial locations at function startMed Ismail Bennani1-3/+22
It can happen that a line entry reports that some source code is located at line 0. In DWARF, line 0 is a special location which indicates that code has no 1-1 mapping with source. When stopping in one of those artificial locations, lldb doesn't know which line to display and shows the beginning of the file instead. This patch mitigates this behaviour by checking if the current symbol context of the line entry has a matching function, in which case, it slides the source listing to the start of that function. This patch also shows the user a warning explaining why lldb couldn't show sources at that location. rdar://83118425 Differential Revision: https://reviews.llvm.org/D115313 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-04-16Target::ReadMemory read from read-only binary file Section, not memoryJason Molenda1-4/+4
Commiting this patch for Augusto Noronha who is getting set up still. This patch changes Target::ReadMemory so the default behavior when a read is in a Section that is read-only is to fetch the data from the local binary image, instead of reading it from memory. Update all callers to use their old preferences (the old prefer_file_cache bool) using the new API; we should revisit these calls and see if they really intend to read live memory, or if reading from a read-only Section would be equivalent and important for performance-sensitive cases. rdar://30634422 Differential revision: https://reviews.llvm.org/D100338
2021-03-12[lldb] Remove unused StackFrame::TrackGlobalVariableDave Lee1-25/+0
Last used by the Go plugin which was removed in https://reviews.llvm.org/D54057.
2021-03-03LanguageRuntime for 0th frame unwind, simplify getting pc-for-symbolicationJason Molenda1-24/+30
Add calls into LanguageRuntime when finding the unwind method to use out of the 0th (currently executing) stack frame. Allow for the LanguageRuntimes to indicate if this stack frames should be treated like a zeroth-frame -- symbolication should be done based on the saved pc address, not decremented like normal ABI function calls. Add methods to RegisterContext and StackFrame to get a pc value suitable for symbolication, to reduce the number of places in lldb where we decrement the saved pc values before symbolication. <rdar://problem/70398009> Differential Revision: https://reviews.llvm.org/D97644
2020-10-22[lldb] Fix a regression introduced by D75730Jonas Devlieghere1-13/+8
In a new Range class was introduced to simplify and the Disassembler API and reduce duplication. It unintentionally broke the SBFrame::Disassemble functionality because it unconditionally converts the number of instructions to a Range{Limit::Instructions, num_instructions}. This is subtly different from the previous behavior, where now we're passing a Range and assume it's valid in the callee, the original code would propagate num_instructions and the callee would compare the value and decided between disassembling instructions or bytes. Unfortunately the existing tests was not particularly strict: disassembly = frame.Disassemble() self.assertNotEqual(len(disassembly), 0, "Disassembly was empty.") This would pass because without this patch we'd disassemble zero instructions, resulting in an error: (lldb) script print(lldb.frame.Disassemble()) error: error reading data from section __text Differential revision: https://reviews.llvm.org/D89925
2020-07-27Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)Adrian Prantl1-3/+3
This cleanup patch unifies all methods called GetByteSize() in the ValueObject hierarchy to return an optional, like the methods in CompilerType do. This means fewer magic 0 values, which could fix bugs down the road in languages where types can have a size of zero, such as Swift and C (but not C++). Differential Revision: https://reviews.llvm.org/D84285 This re-lands the patch with bogus :m_byte_size(0) initalizations removed.
2020-07-25Temporarily Revert "Unify the return value of GetByteSize to an ↵Eric Christopher1-3/+3
llvm::Optional<uint64_t> (NFC-ish)" as it's causing numerous (176) test failures on linux. This reverts commit 1d9b860fb6a85df33fd52fcacc6a5efb421621bd.
2020-07-25Unify the return value of GetByteSize to an llvm::Optional<uint64_t> (NFC-ish)Adrian Prantl1-3/+3
This cleanup patch unifies all methods called GetByteSize() in the ValueObject hierarchy to return an optional, like the methods in CompilerType do. This means fewer magic 0 values, which could fix bugs down the road in languages where types can have a size of zero, such as Swift and C (but not C++). Differential Revision: https://reviews.llvm.org/D84285
2020-07-17[lldb] Store StackFrameRecognizers in the target instead of a global listRaphael Isemann1-2/+5
Summary: Currently the frame recognizers are stored in a global list (the list in the StackFrameRecognizersManagerImpl singleton to be precise). All commands and plugins that modify the list are just modifying that global list of recognizers which is shared by all Target and Debugger instances. This is clearly against the idea of LLDB being usable as a library and it also leads to some very obscure errors as now multiple tests are sharing the used frame recognizers. For example D83400 is currently failing as it reorders some test_ functions which permanently changes the frame recognizers of all debuggers/targets. As all frame recognizers are also initialized in a 'once' guard, it's also impossible to every restore back the original frame recognizers once they are deleted in a process. This patch just moves the frame recognizers into the current target. This seems the way everyone assumes the system works as for example the assert frame recognizers is using the current target to find the function/so-name to look for (which only works if the recognizers are stored in the target). Reviewers: jingham, mib Reviewed By: jingham, mib Subscribers: MrHate, JDevlieghere Differential Revision: https://reviews.llvm.org/D83757
2020-05-06Fix error handling after [<index>] in 'frame variable'Jaroslav Sevcik1-6/+1
Summary: This fixes a bug where frame var a[0]+5 returns the value a[0] without any warning because the current logic simply ignores everything after ']' as long as there is no '.', '-' or '[' in the rest of the string. The fix simplifies the termination condition of the expression path parsing loop to check if have a non-empty remaining string to parse. Previously, the condition checked if a separator was found. That condition coincided with the remaining string-to-parse condition except for the buggy indexed case where non-empty string was left ("+5" in the example above), but the separator index was 'npos'. Reviewed By: teemperor, labath Differential Revision: https://reviews.llvm.org/D79404
2020-04-07[lldb] NFC: Fix trivial typo in comments, documents, and messagesKazuaki Ishizaki1-1/+1
Differential Revision: https://reviews.llvm.org/D77460
2020-03-16[lldb] Copy m_behaves_like_zeroth_frame on stack frame updateTatyana Krasnukha1-0/+1
Fix to code from https://reviews.llvm.org/D64993. Field StackFrame::m_behaves_like_zeroth_frame was introduced in commit [1], however that commit hasn't added a copying of the field to UpdatePreviousFrameFromCurrentFrame, therefore the value wouldn't change when updating frames to reflect the current situation. The particular scenario, where this matters is following. Assume we have function main that invokes function func1. We set breakpoint at func1 entry and in main after the func1 call, and do not stop at the main entry. Therefore, when debugger stops for the first time, func1 is frame#0, while main is frame#1, thus m_behaves_like_zeroth_frame is set to 0 for main frame. Execution is resumed, and stops now in main, where it is now frame#0. However while updating the frame object, m_behaves_like_zeroth_frame remains false. This field plays an important role when calculating line information for backtrace: for frame#0, PC is the current line, therefore line information is retrieved for PC, however for all other frames this is not the case - calculated PC is a return-PC, i.e. instruction after the function call line, therefore for those frames LLDB needs to step back by one instruction. Initial implementation did this strictly for frames that have index != 0 (and index is updated properly in UpdatePreviousFrameFromCurrentFrame), but m_behaves_like_zeroth_frame added a capability for middle-of-stack frames to behave in a similar manner. But because current code now doesn't check frame idx, m_behaves_like_zeroth_frame must be set to true for frames with 0 index, not only for frame that behave like one. In the described test case, after stopping in main, LLDB would still consider frame#0 as non-zeroth, and would subtract instruction from the PC, and would report previous like as current line. The error doesn't manifest itself in LLDB interpreter though - it can be reproduced through LLDB-MI and when using SB API, but not when we interpreter command "continue" is executed. Honestly, I didn't fully understand why it works in interpreter, I did found that bug "fixes" itself if I enable DEBUG_STACK_FRAMES in StackFrameList.cpp, because that calls StackFrame::Dump and that calls GetSymbolContext(eSymbolContextEverything), which fills the context of frame on the first breakpoint, therefore it doesn't have to be recalculated (improperly) on a second frame. However, on first breakpoint symbol context is calculated for the "call" line, not the next one, therefore it should be recalculated anyway on a second breakpoint, and it is done correctly, even though m_behaves_like_zeroth_frame is still incorrect, as long as GetSymbolContext(eSymbolContextEverything) has been called. [1] 31e6dbe1c6a6 Fix PC adjustment in StackFrame::GetSymbolContext Differential Revision: https://reviews.llvm.org/D75975 Patch by Anton Kolesov <Anton.Kolesov@synopsys.com>
2020-03-09[lldb] Reduce duplication in the Disassembler classPavel Labath1-5/+3
Summary: The class has two pairs of functions whose functionalities differ in only how one specifies how much he wants to disasseble. One limits the process by the size of the input memory region. The other based on the total amount of instructions disassembled. They also differ in various features (like error reporting) that were only added to one of the versions. There are various ways in which this could be addressed. This patch does it by introducing a helper struct called "Limit", which is effectively a pair specifying the value that you want to limit, and the actual limit itself. Reviewers: JDevlieghere Subscribers: sdardis, jrtc27, atanasyan, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D75730
2020-03-05[lldb] s/ExecutionContext/Target in DisassemblerPavel Labath1-8/+6
Some functions in this file only use the "target" component of an execution context. Adjust the argument lists to reflect that. This avoids some defensive null checks and simplifies most of the callers.
2020-02-03[lldb] Remove unused parameter from ValueObject::GetExpressionPathAlex Langford1-17/+17
I previously removed the code in ValueObject::GetExpressionPath that took advantage of the parameter `qualify_cxx_base_classes`. As a result, this is now unused and can be removed.
2020-01-24[lldb][NFC] Fix all formatting errors in .cpp file headersRaphael Isemann1-1/+1
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp -------------------------------------------------===// ``` However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator `-*- C++ -*-` is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files). This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing `===//` (mostly caused by clang-format breaking the line). Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere Reviewed By: JDevlieghere Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73258
2019-11-25[lldb][NFC] Allow range-based for-loops on VariableListRaphael Isemann1-6/+3
Summary: Adds support for doing range-based for-loops on LLDB's VariableList and modernises all the index-based for-loops in LLDB where possible. Reviewers: labath, jdoerfert Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D70668
2019-08-02Fix PC adjustment in StackFrame::GetSymbolContextJoseph Tremoulet1-12/+18
Summary: Update StackFrame::GetSymbolContext to mirror the logic in RegisterContextLLDB::InitializeNonZerothFrame that knows not to do the pc decrement when the given frame is a signal trap handler frame or the parent of one, because the pc may not follow a call in these frames. Accomplish this by adding a behaves_like_zeroth_frame field to lldb_private::StackFrame, set to true for the zeroth frame, for signal handler frames, and for parents of signal handler frames. Also add logic to propagate the signal handler flag from UnwindPlan to the FrameType on the RegisterContextLLDB it generates, and factor out a helper to resolve symbol and address range for an Address now that we need to invoke it in four places. Reviewers: jasonmolenda, clayborg, jfb Reviewed By: jasonmolenda Subscribers: labath, dexonsmith, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64993 llvm-svn: 367691
2019-07-30[Symbol] Use llvm::Expected when getting TypeSystemsAlex Langford1-4/+8
Summary: This commit achieves the following: - Functions used to return a `TypeSystem *` return an `llvm::Expected<TypeSystem *>` now. This means that the result of a call is always checked, forcing clients to move more carefully. - `TypeSystemMap::GetTypeSystemForLanguage` will either return an Error or a non-null pointer to a TypeSystem. Reviewers: JDevlieghere, davide, compnerd Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D65122 llvm-svn: 367360
2019-04-10[NFC] Remove ASCII lines from commentsJonas Devlieghere1-4/+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
2019-03-11Fix a crasher in StackFrame::GetValueForVariableExpressionPath()Greg Clayton1-1/+6
There was a crash that would happen if an IDE would ask for a child of a shared pointer via any SB API call that ends up calling StackFrame::GetValueForVariableExpressionPath(). The previous code expects an error to be set describing why the synthetic child of a type was not able to be found, but we have some synthetic child providers that weren't setting the error and returning an empty value object shared pointer. This fixes that to ensure we don't lose our debug session by crashing, fully tests GetValueForVariableExpressionPath functionality, and ensures we don't crash on GetValueForVariableExpressionPath() in the future. Differential Revision: https://reviews.llvm.org/D59200 llvm-svn: 355850
2019-03-11Bring Doxygen comment syntax in sync with LLVM coding style.Adrian Prantl1-7/+7
This changes '@' prefix to '\'. llvm-svn: 355841
2019-02-11Use std::make_shared in LLDB (NFC)Jonas Devlieghere1-2/+4
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
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
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
2018-12-15Simplify Boolean expressionsJonas Devlieghere1-2/+2
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
2018-11-11Remove header grouping comments.Jonas Devlieghere1-4/+0
This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
2018-10-31[lldb] Introduce StackFrameRecognizer [take 3]Kuba Mracek1-3/+15
This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345693
2018-10-31Revert r345686 due to build failuresKuba Mracek1-15/+3
llvm-svn: 345688
2018-10-31[lldb] Introduce StackFrameRecognizer [take 2]Kuba Mracek1-3/+15
This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345686
2018-10-31Revert r345678 (build failure on Linux machines).Kuba Mracek1-15/+3
llvm-svn: 345680
2018-10-31[lldb] Introduce StackFrameRecognizerKuba Mracek1-3/+15
This patch introduces a concept of "frame recognizer" and "recognized frame". This should be an extensible mechanism that retrieves information about special frames based on ABI, arguments or other special properties of that frame, even without source code. A few examples where that could be useful could be 1) objc_exception_throw, where we'd like to get the current exception, 2) terminate_with_reason and extracting the current terminate string, 3) recognizing Objective-C frames and automatically extracting the receiver+selector, or perhaps all arguments (based on selector). Differential Revision: https://reviews.llvm.org/D44603 llvm-svn: 345678
2018-10-25Don't type-erase the SymbolContextItem enumeration.Zachary Turner1-2/+5
When we get the `resolve_scope` parameter from the SB API, it's a `uint32_t`. We then pass it through all of LLDB this way, as a uint32. This is unfortunate, because it means the user of an API never actually knows what they're dealing with. We can call it something like `resolve_scope` and have comments saying "this is a value from the `SymbolContextItem` enumeration, but it makes more sense to just have it actually *be* the correct type in the actual C++ type system to begin with. This way the person reading the code just knows what it is. The reason to use integers instead of enumerations for flags is because when you do bitwise operations on enumerations they get promoted to integers, so it makes it tedious to constantly be casting them back to the enumeration types, so I've introduced a macro to make this happen magically. By writing LLDB_MARK_AS_BITMASK_ENUM after defining an enumeration, it will define overloaded operators so that the returned type will be the original enum. This should address all the mechanical issues surrounding using rich enum types directly. This way, we get a better debugger experience, and new users to the codebase can get more easily acquainted with the codebase because their IDE features can help them understand what the types mean. Differential Revision: https://reviews.llvm.org/D53597 llvm-svn: 345313
2018-10-05Add support for artificial tail call framesVedant Kumar1-18/+22
This patch teaches lldb to detect when there are missing frames in a backtrace due to a sequence of tail calls, and to fill in the backtrace with artificial tail call frames when this happens. This is only done when the execution history can be determined from the call graph and from the return PC addresses of calls on the stack. Ambiguous sequences of tail calls (e.g anything involving tail calls and recursion) are detected and ignored. Depends on D49887. Differential Revision: https://reviews.llvm.org/D50478 llvm-svn: 343900
2018-09-20Refactor FindVariable() core functionality into StackFrame out of SBFrameShafik Yaghmour1-0/+35
rdar://problem/14365983 Patch by Shafik Yaghmour Differential Revision: https://reviews.llvm.org/D52247 llvm-svn: 342663
2018-08-07Move RegisterValue,Scalar,State from Core to UtilityPavel Labath1-1/+1
These three classes have no external dependencies, but they are used from various low-level APIs. Moving them down to Utility improves overall code layering (although it still does not break any particular dependency completely). The XCode project will need to be updated after this change. Differential Revision: https://reviews.llvm.org/D49740 llvm-svn: 339127