summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/StackFrameList.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [StackFrameList][DFS] Turn a few raw pointers into references, NFCVedant Kumar2019-09-301-8/+8
| | | | llvm-svn: 373267
* [Function] Factor out GetCallEdgeForReturnAddress, NFCVedant Kumar2019-09-101-11/+4
| | | | | | | Finding the call edge in a function which corresponds to a particular return address is a generic/useful operation. llvm-svn: 371543
* Fix PC adjustment in StackFrame::GetSymbolContextJoseph Tremoulet2019-08-021-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere2019-07-241-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 ASCII lines from commentsJonas Devlieghere2019-04-101-2/+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
* Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere2019-02-131-12/+12
| | | | | | | | | | | | | | | | | 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
* Use std::make_shared in LLDB (NFC)Jonas Devlieghere2019-02-111-9/+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
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-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
* Remove header grouping comments.Jonas Devlieghere2018-11-111-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
* Add support for artificial tail call framesVedant Kumar2018-10-051-10/+185
| | | | | | | | | | | | | | | | 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
* [StackFrame] Add more clarifying comments to StackFrameList (NFC)Vedant Kumar2018-08-071-3/+3
| | | | llvm-svn: 339205
* [StackFrame] Add doxygen comments to the StackFrameList API (NFC)Vedant Kumar2018-08-011-19/+1
| | | | | | | | | Clarify how StackFrameList works by documenting its methods. Also, delete some dead code and insert some TODOs. Differential Revision: https://reviews.llvm.org/D50087 llvm-svn: 338590
* [StackFrame] Use early returns in ResetCurrentInlinedDepth (NFC)Vedant Kumar2018-08-011-116/+108
| | | | | | | Using early returns in this function substantially reduces the nesting level, making the logic easier to understand. llvm-svn: 338589
* [StackFrame] Factor GetOnlyConcreteFramesUpTo out of GetFramesUpTo (NFC)Vedant Kumar2018-08-011-163/+166
| | | | | | | | Splitting GetOnlyConcreteFramesUpTo will make it easier to implement support for synthetic tail call frames in backtraces. This is just a prep change, no functionality is affected. llvm-svn: 338588
* Change AddressClass type from 'enum' to 'enum class'.Tatyana Krasnukha2018-06-261-2/+2
| | | | | | If we have a function with signature f(addr_t, AddressClass), it is easy to muddle up the order of arguments without any warnings from compiler. 'enum class' prevents passing integer in place of AddressClass and vice versa. llvm-svn: 335599
* Reflow paragraphs in comments.Adrian Prantl2018-04-301-74/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
* Introduce new command: thread backtrace uniquePavel Labath2017-06-121-1/+2
| | | | | | | | | | | | | | | | | This patch introduces a new thread backtrace command "unique". The command is based off of "thread backtrace all" but will instead find all threads which share matching call stacks and de-duplicate their output, listing call stack and all the threads which share it. This is especially useful for apps which use thread/task pools sitting around waiting for work and cause excessive duplicate output. I needed this behavior recently when debugging a core with 700+ threads. Differential Revision: https://reviews.llvm.org/D33426 Reviewers: clayborg, jingham Patch by Brian Gianforcaro <b.gianfo@gmail.com> llvm-svn: 305197
* Move Log from Core -> Utility.Zachary Turner2017-03-031-1/+1
| | | | | | | | | All references to Host and Core have been removed, so this class can now safely be lowered into Utility. Differential Revision: https://reviews.llvm.org/D30559 llvm-svn: 296909
* Make lldb -Werror clean for -Wstring-conversionDavid Blaikie2017-01-061-2/+1
| | | | | | | | | Also found/fixed one bug identified by this warning in RenderScriptx86ABIFixups.cpp where a string literal was being used in an effort to provide a name for an instruction/register, but was instead being passed as the bool 'isVolatile' parameter. llvm-svn: 291198
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-806/+716
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* second pass over removal of Mutex and ConditionSaleem Abdulrasool2016-05-191-28/+27
| | | | llvm-svn: 270024
* Keep original source path and mapped path in LineEntryTed Woodward2016-05-111-14/+15
| | | | | | | | | | | | | | | | | Summary: The "file" variable in a LineEntry was mapped using target.source-map, except when stepping through inlined code. This patch adds a new variable to LineEntry, "original_file", that contains the original file from the debug info. "file" will continue to (possibly) be mapped. Some code has been changed to use "original_file". This is code dealing with symbols. Code dealing with source files will still use "file". Reviewers, please confirm that these particular changes are correct. Tests run on Ubuntu 12.04 show no regression. Reviewers: clayborg, jingham Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D20135 llvm-svn: 269250
* Fix all of the unannotated switch cases to annotate the fall through or do ↵Greg Clayton2016-02-261-0/+1
| | | | | | the right thing and break. llvm-svn: 261950
* Fix Clang-tidy modernize-use-nullptr warnings in some files in ↵Eugene Zelenko2016-02-181-42/+34
| | | | | | source/Target; other minor fixes. llvm-svn: 261242
* Add a missing Mutex Locker in ResetCurrentInlinedDepthKeno Fischer2015-10-161-0/+2
| | | | | | | | | | | | | | Summary: This function reads m_frames, so it needs to lock the mutex like all other function that access m_frames. Found using AddressSanitizer. Reviewers: jingham, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13638 llvm-svn: 250493
* Minor indentation fix in StackFrameList.cpp.Stephane Sezer2015-10-151-3/+3
| | | | llvm-svn: 250465
* Add an OperatingSystem plugin to support goroutinesRyan Brown2015-09-161-0/+2
| | | | | | | | | | The Go runtime schedules user level threads (goroutines) across real threads. This adds an OS plugin to create memory threads for goroutines. It supports the 1.4 and 1.5 go runtime. Differential Revision: http://reviews.llvm.org/D5871 llvm-svn: 247852
* Use eAddressClassCode for address lookup for opcodes for stack framesTamas Berghammer2015-09-071-2/+2
| | | | | | | | | | | | | | | It is required because of the following edge case on arm: bx <addr> Non-tail call in a no return function [data-pool] Marked with $d mapping symbol The return address of the function call will point to the data pool but we have to treat it as code so the StackFrame can calculate the symbols correctly. Differential revision: http://reviews.llvm.org/D12556 llvm-svn: 246958
* Fix address adjusment in stack frame inline block lookupTamas Berghammer2015-06-011-1/+15
| | | | | | | | | | When the current address is pointing 1 (unit) over the end of a section the we have to do a section lookup after making the adjusment of the current address. Differential revision: http://reviews.llvm.org/D10124 llvm-svn: 238737
* Add null RegisterContext assertionsEd Maste2015-02-231-0/+1
| | | | | | | | This makes these failures slightly more obvious, avoiding the need to run LLDB under a debugger or rely on a LLDB core. I encountered these while bringing up a new OS/arch combination. llvm-svn: 230236
* Fixed more fallout from running the test suite remotely on iOS devices.Greg Clayton2014-11-171-6/+9
| | | | | | | | | | | | | | | | Fixed include: - Change Platform::ResolveExecutable(...) to take a ModuleSpec instead of a FileSpec + ArchSpec to help resolve executables correctly when we have just a path + UUID (no arch). - Add the ability to set the listener in SBLaunchInfo and SBAttachInfo in case you don't want to use the debugger as the default listener. - Modified all places that use the SBLaunchInfo/SBAttachInfo and the internal ProcessLaunchInfo/ProcessAttachInfo to not take a listener as a parameter since it is in the launch/attach info now - Load a module's sections by default when removing a module from a target. Since we create JIT modules for expressions and helper functions, we could end up with stale data in the section load list if a module was removed from the target as the section load list would still have entries for the unloaded module. Target now has the following functions to help unload all sections a single or multiple modules: size_t Target::UnloadModuleSections (const ModuleList &module_list); size_t Target::UnloadModuleSections (const lldb::ModuleSP &module_sp); llvm-svn: 222167
* Fix typos.Bruce Mitchener2014-07-081-1/+1
| | | | llvm-svn: 212553
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-1/+1
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* Patch from Todd Fiala: lldb will seg fault if for some reason there is no ↵Greg Clayton2013-11-221-8/+11
| | | | | | | | unwinder when StackFrameList::GetFramesUpTo() is called. Mainly patched to stop LLDB from crashing. This can easily happen if you debug to a remote gdbserver that doesn't have any dynamic register info and you don't have a target definition file specified. llvm-svn: 195499
* Add new ivars to StackFrame so it can represent a stack collectedJason Molenda2013-11-041-2/+8
| | | | | | | | | | | | | | | | | | at some point in the past. We may have nothing more than a pc value for this type of stack frame -- hopefully we'll have a pc and a stop_id so we can track module loads and unloads over time and symbolicate the pc at the correct point in time. Also add a flag to indicate if the CFA for the frame is available (a bit different from a CFA of LLDB_INVALID_ADDRESS) and also an overall setting to indicate whether this is a history stack frame or not. A history stack frame may not have a CFA, it may not have a register context, it may not have variables, it may not have a frame pointer or a stack pointer. <rdar://problem/15314068> llvm-svn: 193987
* Roll back the changes I made in r193907 which created a new FrameJason Molenda2013-11-041-27/+26
| | | | | | | | | | pure virtual base class and made StackFrame a subclass of that. As I started to build on top of that arrangement today, I found that it wasn't working out like I intended. Instead I'll try sticking with the single StackFrame class -- there's too much code duplication to make a more complicated class hierarchy sensible I think. llvm-svn: 193983
* Add a new base class, Frame. It is a pure virtual function whichJason Molenda2013-11-021-26/+27
| | | | | | | | | | | | | | | | | | | | | defines a protocol that all subclasses will implement. StackFrame is currently the only subclass and the methods that Frame vends are nearly identical to StackFrame's old methods. Update all callers to use Frame*/Frame& instead of pointers to StackFrames. This is almost entirely a mechanical change that touches a lot of the code base so I'm committing it alone. No new functionality is added with this patch, no new subclasses of Frame exist yet. I'll probably need to tweak some of the separation, possibly moving some of StackFrame's methods up in to Frame, but this is a good starting point. <rdar://problem/15314068> llvm-svn: 193907
* Mark the selected frame of the selected thread in backtraces.Jim Ingham2013-10-181-2/+22
| | | | | | <rdar://problem/15252474> llvm-svn: 192989
* <rdar://problem/13643315> Greg Clayton2013-05-241-7/+30
| | | | | | Fixed performance issues that arose after changing SBTarget, SBProcess, SBThread and SBFrame over to using a std::shared_ptr to a ExecutionContextRef. The ExecutionContextRef doesn't store a std::weak_ptr to a stack frame because stack frames often get replaced with new version, so it held onto a StackID object that would allow us to ask the thread each time for the frame for the StackID. The linear function was too slow for large recursive stacks. We also fixed an issue where anytime the std::shared_ptr<ExecutionContextRef> in any SBTarget, SBProcess, SBThread objects was turned into an ExecutionContext object, it would try to resolve all items in the ExecutionContext which are shared pointers. Even if the StackID in the ExecutionContextRef was invalid, it was looking through all frames in every thread. This causes a lot of unnecessary frame accesses. llvm-svn: 182627
* After discussing with Chris Lattner, we require C++11, so lets get rid of ↵Greg Clayton2013-04-181-1/+1
| | | | | | the macros and just use C++11. llvm-svn: 179805
* Since we use C++11, we should switch over to using std::unique_ptr when ↵Greg Clayton2013-04-181-1/+1
| | | | | | | | C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++. Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro. llvm-svn: 179779
* <rdar://problem/13491977>Greg Clayton2013-04-121-19/+22
| | | | | | | | Made some fixes to the OperatingSystemPython class: - If any thread dictionary contains any "core=N" key/value pairs then the threads obtained from the lldb_private::Process itself will be placed inside the ThreadMemory threads and will be used to get the information for a thread. - Cleaned up all the places where a thread inside a thread was causing problems llvm-svn: 179405
* Be sure to take the mutex when the destructor is called in case other ↵Greg Clayton2013-03-281-0/+3
| | | | | | threads are using these lists and those other threads have the mutex locked. llvm-svn: 178262
* Protect against the case where the current inlined depth is wrong, and leads ↵Jim Ingham2013-03-281-30/+51
| | | | | | | | | | us to think we can't even get the frame at index 0. We should ALWAYS be able to get that. <rdar://problem/13497571> llvm-svn: 178205
* <rdar://problem/13521159>Greg Clayton2013-03-271-3/+3
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
* <rdar://problem/13194155>Enrico Granata2013-03-151-0/+4
| | | | | | Fixing an issue where threads and frames could get out of sync and cause ValueObjects to fail to retrieve their values correctly llvm-svn: 177166
* <rdar://problem/12649160>Greg Clayton2012-12-051-0/+1
| | | | | | Added the ability to debug through your process exec'ing itself to the same architecture. llvm-svn: 169340
* Resolve printf formatting warnings on Linux:Daniel Malea2012-11-291-2/+2
| | | | | | | | - use macros from inttypes.h for format strings instead of OS-specific types Patch from Matt Kopec! llvm-svn: 168945
* Bunch of cleanups for warnings found by the llvm static analyzer.Jim Ingham2012-10-121-2/+0
| | | | llvm-svn: 165808
* Fiddle with the heuristic about where to set the stop point in a nested ↵Jim Ingham2012-09-081-0/+27
| | | | | | | | inline stack when we get there by breakpoint. If we hit a user breakpoint, I set the stop point to the bottom-most frame 'cause that's what we did before. <rdar://problem/12258999> Setting breakpoint in always inline function is stopping in function above it llvm-svn: 163439
OpenPOWER on IntegriCloud