summaryrefslogtreecommitdiff
path: root/source/Plugins/UnwindAssembly/x86/UnwindAssembly-x86.cpp
AgeCommit message (Collapse)Author
2019-05-23[lldb] NFC modernize codebase with modernize-use-nullptrKonrad Kleine
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@361484 91177308-0d34-0410-b5e6-96231b3b80d8
2019-04-10[NFC] Remove ASCII lines from commentsJonas Devlieghere
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@358135 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2018-12-15Simplify Boolean expressionsJonas Devlieghere
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@349215 91177308-0d34-0410-b5e6-96231b3b80d8
2018-10-30[x86] Fix issues with a realigned stack in MSVC compiled applicationsAleksandr Urakov
Summary: This patch fixes issues with a stack realignment. MSVC maintains two frame pointers (`ebx` and `ebp`) for a realigned stack - one is used for access to function parameters, while another is used for access to locals. To support this the patch: - adds an alternative frame pointer (`ebx`); - considers stack realignment instructions (e.g. `and esp, -32`); - along with CFA (Canonical Frame Address) which point to the position next to the saved return address (or to the first parameter on the stack) introduces AFA (Aligned Frame Address) which points to the position of the stack pointer right after realignment. AFA is used for access to registers saved after the realignment (see the test); Here is an example of the code with the realignment: ``` struct __declspec(align(256)) OverAligned { char c; }; void foo(int foo_arg) { OverAligned oa_foo = { 1 }; auto aaa_foo = 1234; } void bar(int bar_arg) { OverAligned oa_bar = { 2 }; auto aaa_bar = 5678; foo(1111); } int main() { bar(2222); return 0; } ``` and here is the `bar` disassembly: ``` push ebx mov ebx, esp sub esp, 8 and esp, -100h add esp, 4 push ebp mov ebp, [ebx+4] mov [esp+4], ebp mov ebp, esp sub esp, 200h mov byte ptr [ebp-200h], 2 mov dword ptr [ebp-4], 5678 push 1111 ; foo_arg call j_?foo@@YAXH@Z ; foo(int) add esp, 4 mov esp, ebp pop ebp mov esp, ebx pop ebx retn ``` Reviewers: labath, zturner, jasonmolenda, stella.stamenova Reviewed By: jasonmolenda Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D53435 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@345577 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-30Reflow paragraphs in comments.Adrian Prantl
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 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@331197 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-13Move ArchSpec to the Utility modulePavel Labath
The rationale here is that ArchSpec is used throughout the codebase, including in places which should not depend on the rest of the code in the Core module. This commit touches many files, but most of it is just renaming of #include lines. In a couple of cases, I removed the #include ArchSpec line altogether, as the file was not using it. In one or two places, this necessitated adding other #includes like lldb-private-defines.h. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@318048 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-12Rename Error -> Status.Zachary Turner
This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@302872 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-14Remove dependencies from Utility to Core and Target.Zachary Turner
With this patch, the only dependency left is from Utility to Host. After this is broken, Utility will finally be standalone. Differential Revision: https://reviews.llvm.org/D29909 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@295088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02Move classes from Core -> Utility.Zachary Turner
This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@293941 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-29Re-commit the changes from r282565 that I had to back out because of Jason Molenda
a linux bot test failure. That one is fixed; hopefully there won't be any others turned up this time. The eh_frame augmentation code wasn't working right after the reorg/rewrite of the classes. It works correctly now for the one test that was failing - but we'll see what the test bots come up with. <rdar://problem/28509178> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@282659 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28Reverting r282565.Jason Molenda
A testbot found a regression introduced in the testsuite with the changes in r282565 on Ubuntu (TestStepNoDebug.ReturnValueTestCase). I'll get this set up on an ubuntu box and figure out what is happening there -- likely a problem with the eh_frame augmentation, which isn't used on macosx. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@282566 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-28Refactor the x86 UnwindAssembly class into a separate class calledJason Molenda
x86AssemblyInspectionEngine and the current UnwindAssembly_x86 to allow for the core engine to be exercised by unit tests. The UnwindAssembly_x86 class will have access to Targets, Processes, Threads, RegisterContexts -- it will be working in the full lldb environment. x86AssemblyInspectionEngine is layered away from all of that, it is given some register definitions and a bag of bytes to profile. I wrote an initial unittest for a do-nothing simple x86_64/i386 function to start with. I'll be adding more. The x86 assembly unwinder was added to lldb early in its bringup; I made some modernization changes as I was refactoring the code to make it more consistent with how we write lldb today. I also added RegisterContextMinidump_x86_64.cpp to the xcode project file so I can run the unittests from that. The testsuite passes with this change, but there was quite a bit of code change by the refactoring and it's possible there are some issues. I'll be testing this more in the coming days, but it looks like it is behaving correctly as far as I can tell with automated testing. <rdar://problem/28509178> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@282565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone
*** 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. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@280751 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-08Add support for the LEAVE x86 instruction to AssemblyParse_x86.Jason Molenda
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@257209 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-25Add support for 'leal' instruction to UnwindAssembly-x86Tamas Berghammer
Gcc for android use the leal instruction to substract from the stack pointer in the prologue of a function call. This patch add basic support for evaluating this instruction to support stack unwinding on android-x86. Differential revision: http://reviews.llvm.org/D8583 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@233178 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03Don't #include ClangPersistentVariables.h from Process.hZachary Turner
Nothing from this header file was even being referenced in Process.h anyway, so it was a completely unnecessary include. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@231131 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-03Reduce header footprint of Target.hZachary Turner
This continues the effort to reduce header footprint and improve build speed by removing clang and other unnecessary headers from Target.h. In one case, some headers were included solely for the purpose of declaring a nested class in Target, which was not needed by anybody outside the class. In this case the definition and implementation of the nested class were isolated in the .cpp file so the header could be removed. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@231107 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-23UnwindPlan::Row refactor -- add support for CFA set by a DWARF expressionPavel Labath
Summary: This change refactors UnwindPlan::Row to be able to store the fact that the CFA is value is set by evaluating a dwarf expression (DW_CFA_def_cfa_expression). This is achieved by creating a new class CFAValue and moving all CFA setting/getting code there. Note that code using the new CFAValue::isDWARFExpression is not yet present and will be added in a follow-up patch. Therefore, this patch should not change the functionality in any way. Test Plan: Ran tests on Mac and Linux. No regressions detected. Reviewers: jasonmolenda, clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D7755 git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@230210 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13Fix the last two warnings I see on Linx building 'lldb': mismatchedChandler Carruth
signed and unsigned types in comparisons. For the text offset, use the addr_t type that is used elsewhere to get these kinds of offsets, and which it is being compared against. This seems to make things more consistent. For the other, the numbers are clearly small and uninteresting, so just cast them to the most boring 'int' type. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@229085 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13Save & restore the array of which registers have already beenJason Molenda
saved/restored across a mid-function epilogue. We ignore repeated push/pops of a register so once we saw one 'pop %rbp', we'd ignore it the second time we saw it. <rdar://problem/19417410> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225853 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13Enhance the eh_frame unwind instruction augmenter so thatJason Molenda
it will do the right thing on x86 routines with a mid-function epilogue sequence (where the unwind rules need to be reinstalled after the epilogue has completed). <rdar://problem/19417410> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225773 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13Add an additional check to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite Jason Molenda
which will verify if the eh_frame instructions include details about the prologue or not. Both clang and gcc include prologue instructions but there's no requirement for them to do so -- and I'm sure we'll have to interoperate with a compiler that doesn't generate prologue info at some point. I don't have any compilers that omit the prologue instructions so the testing was of the "makre sure augmented unwind info is still created". With an eh_frame without prologue, this code should reject the augmentation scheme altogether and we should fall back to using assembly instruction profiling. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225771 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13Change the x86 assembly instruction unwind parser toJason Molenda
step through the complete function looking for any epilogue instructions. If we find an epilogue sequence, re-instate the correct unwind instructions if there is more code past that epilogue -- this will correctly handle an x86 function with multiple epilogues in it. NB there is still a bug with the "eh_frame augmented" UnwindPlans and mid-function epilogues. Looking at that next. <rdar://problem/18863406> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225770 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-10Hoist the RegisterNumber class out of RegisterContextLLDB and makeJason Molenda
it more generally available. Add checks to UnwindAssembly_x86::AugmentUnwindPlanFromCallSite() so that it won't try to augment an UnwindPlan that already describes the function epilogue. Add a test case for backtracing out of _sigtramp on Darwin systems. This could probably be adapted to test the same thing on linux/bsd but the function names of sigtramp and kill are probably platform specific and I'm not sure what they should be. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225578 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-08Have AssemblyParse_x86::get_non_call_site_unwind_plan trackJason Molenda
which registers have been spilled (saved to the stack) - and if we see that same register being saved to the stack again, don't record that, it's something specific to this stack frame. I found a code sequence for i386 where clang did a push %esi and then later in the function it did movl %esi, -0x7c(%ebp) and that second save of a scratch value overrode the original push location. <rdar://problem/19171178> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@225431 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-21Various unwinder work. Jason Molenda
Most of the changes are to the FuncUnwinders class -- as we've added more types of unwind information, the way this class was written was making it a mess to maintain. Instead of trying to keep one "non-call site" unwind plan and one "call site" unwind plan, track all the different types of unwind plans we can possibly retrieve for each function and have the call-site/non-call-site accessor methods retrieve those. Add a real "fast unwind plan" for x86_64 / i386 -- when doing an unwind through a function, this only has to read the first 4 bytes to tell if the function has a standard prologue sequence. If so, we can use the architecture default unwind plan to backtrace through this function. If we try to retrieve the save location for other registers later on, a real unwind plan will be used. This one is just for doing fast backtraces. Change the compact unwind plan importer to fill in the valid address range it is valid for. Compact unwind, in theory, may have multiple entries for a single function. The FuncUnwinders rewrite includes the start of supporting this correctly. In practice compact unwind encodings are used for the entire range of the function today -- in fact, sometimes the same encoding is used for multiple functions that have the same unwind rules. But I want to handle a single function that has multiple different compact unwind UnwindPlans eventually. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@224689 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-08The lldb unwinder can now use the unwind information from the compact-unwind Jason Molenda
section for x86_64 and i386 targets on Darwin systems. Currently only the compact unwind encoding for normal frame-using functions is supported but it will be easy handle frameless functions when I have a bit more free time to test it. The LSDA and personality routines for functions are also retrieved correctly for functions from the compact unwind section. This new code is very fresh -- it passes the lldb testsuite and I've done by-hand inspection of many functions and am getting correct behavior for all of them. There may need to be some bug fixing over the next couple weeks as I exercise and test it further. But I think it's fine right now so I'm committing it. <rdar://problem/13220837> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@223625 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-10Fix some compiler warnings, one of which was a legit bug.Zachary Turner
MSVC warns that not all control paths return a value when a switch doesn't have a default case handler. Changed explicit value checks to a default check. Also, it caught a case where bitwise AND was being used instead of logical AND. I'm not sure what this fixes, but presumably it is not covered by any kind of test case. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@221636 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-04Add recognition for another x86 epilogue sequence (ret followed byJason Molenda
a nop). Fixes an instruction stepping problem when trying to step over the final instructions of an epilogue. <rdar://problem/18068877> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@221241 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25Remove trailing whitespace from lines in UnwindAssembly-x86.cpp. No other ↵Jason Molenda
changes. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@216420 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25Clean up the coding conventions in UnwindAssembly-x86.cpp a little bit.Jason Molenda
I wrote this originally as a part of an unwind library that was using a different coding convention and some of that old style remained after its integration into lldb. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@216419 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25Have augment_unwind_plan_from_call_site update the UnwindPlan Jason Molenda
name/from-compiler settings to indicate that it was augmented by assembly profiling. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@216412 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25On x86 & x86_64, try to use eh_frame for frame 0.Todd Fiala
We decided to use assmbly profiler instead of eh_frame for frame 0 because for compiler generated code, eh_frame is usually synchronous(a.k.a. only valid at call site); and we have no way to tell if it's asynchronous or not. But for x86 & x86_64 compiler generated code: 1. clang & GCC describes all prologue instructions in eh_frame; 2. mid-function stack pointer altering instructions can be easily detected. So we can grab eh_frame, and use assembly profiler to augment it into asynchronous unwind table. This change also benefits hand-written assembly; eh_frame for hand-written assembly is often asynchronous,so we have a much better chance to successfully unwind through them. Change by Tong Shen. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@216406 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04Add code to AssemblyParse_x86::get_non_call_site_unwind_planJason Molenda
to recognize an epilogue that ends with a jmp to objc_retainAutoreleaseReturnValue instead of a ret instruction. <rdar://problem/17889928> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@214783 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-25Fix an x86 assembler stack unwind calculation for non-volatile registers.Todd Fiala
This change has the practical effect of fixing some backtrace scenarios that would fail with inferiors running on the Android Art host-side JVM under Linux x86_64 on Ubuntu 14.04. See this lldb-commits thread for more details: http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140721/011988.html Change by Tong Shen. Reviewed by Jason Molenda. Tested: Ubuntu 14.04 x86_64, clang-3.5-built lldb. MacOSX 10.10 Preview 4, Xcode 6 Beta 4-built lldb. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@213914 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-02sanitise sign comparisonsSaleem Abdulrasool
This is a mechanical change addressing the various sign comparison warnings that are identified by both clang and gcc. This helps cleanup some of the warning spew that occurs during builds. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@205390 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-24Fix a bug where the x86 assembly instruction profiler would not correctly adjustJason Molenda
the CFA instructions when it was profiling an -fomit-frame-pointer function and a "volatile" register was saved on the stack (e.g. an argument register). <rdar://problem/15036546> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@191267 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-10<rdar://problem/13854277>Greg Clayton
<rdar://problem/13594769> Main changes in this patch include: - cleanup plug-in interface and use ConstStrings for plug-in names - Modfiied the BSD Archive plug-in to be able to pick out the correct .o file when .a files contain multiple .o files with the same name by using the timestamp - Modified SymbolFileDWARFDebugMap to properly verify the timestamp on .o files it loads to ensure we don't load updated .o files and cause problems when debugging The plug-in interface changes: Modified the lldb_private::PluginInterface class that all plug-ins inherit from: Changed: virtual const char * GetPluginName() = 0; To: virtual ConstString GetPluginName() = 0; Removed: virtual const char * GetShortPluginName() = 0; - Fixed up all plug-in to adhere to the new interface and to return lldb_private::ConstString values for the plug-in names. - Fixed all plug-ins to return simple names with no prefixes. Some plug-ins had prefixes and most ones didn't, so now they all don't have prefixed names, just simple names like "linux", "gdb-remote", etc. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181631 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-26Add a new capability to RegisterContextLLDB: To recognize when theJason Molenda
Full UnwindPlan is trying to do an impossible unwind; in that case invalidate the Full UnwindPlan and replace it with the architecture default unwind plan. This is a scenario that happens occasionally with arm unwinds in particular; the instruction analysis based full unwindplan can mis-parse the functions and the stack walk stops prematurely. Now we can do a simpleminded frame-chain walk to find the caller frame and continue the unwind. It's not ideal but given the complicated nature of analyzing the arm functions, and the lack of eh_frame information on iOS, it is a distinct improvement and fixes some long-standing problems with the unwinder on that platform. This is fixing <rdar://problem/12091421>. I may re-use this invalidate feature in the future if I can identify other cases where the full unwindplan's unwind information is clearly incorrect. This checkin also includes some cleanup for the volatile register definition in the arm ABI plugin for <rdar://problem/10652166> although work remains to be done for that bug. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166757 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-11Change the scratch buffer for x86 assembly instructions in AssemblyParse_x86 ↵Jason Molenda
from malloc'ed heap to an llvm SmallVector. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165703 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10Move the scratch buffer allocation for x86 instructions from being allocated ↵Jason Molenda
each instruction, to once in the AssemblyParse_x86 ctor. an instruction git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165662 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10Free the opcode_data malloc'ed memory instead of leaking it - thanks for ↵Jason Molenda
catching that, Chris. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165597 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-10Change the x86 unwinder from using edis as its disassemblerJason Molenda
API (to get the length of x86 instructions) to using the LLVM-MC disassembler. <rdar://problem/12411000> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165587 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-14Switch nearly all of the use of the UnwindPlan::Row's to go throughJason Molenda
a shared pointer to ease some memory management issues with a patch I'm working on. The main complication with using SPs for these objects is that most methods that build up an UnwindPlan will construct a Row to a given instruction point in a function, then add additional regsaves in the next instruction point to that row and push it again. A little care is needed to not mutate the previous instruction point's Row once these are switched to being held behing shared pointers. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@160214 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25Add support for function with stack frame checks added by the compiler;Jason Molenda
these functions will end in the sequence mov %rbp, %rsp ret call __stack_chk_fail instead of the usual mov, ret. The x86 assembly profiler only looked for functions ending in 'ret' and added the Unwind row describing how to set the CFA based on that -- the addition of the call insn (which is jumped to earlier in the function body) threw off that inspection. Resolves the need to "step" twice to get out of these functions when doing source-level stepping. <rdar://problem/11469705> git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@157454 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-21Thread hardening part 3. Now lldb_private::Thread objects have std::weak_ptrGreg Clayton
objects for the backlink to the lldb_private::Process. The issues we were running into before was someone was holding onto a shared pointer to a lldb_private::Thread for too long, and the lldb_private::Process parent object would get destroyed and the lldb_private::Thread had a "Process &m_process" member which would just treat whatever memory that used to be a Process as a valid Process. This was mostly happening for lldb_private::StackFrame objects that had a member like "Thread &m_thread". So this completes the internal strong/weak changes. Documented the ExecutionContext and ExecutionContextRef classes so that our LLDB developers can understand when and where to use ExecutionContext and ExecutionContextRef objects. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@151009 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29Patch from Daniel Dunbar for future-proof against ↵Johnny Chen
http://llvm.org/viewvc/llvm-project?view=rev&revision=145331. git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@145345 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-26Changed the emulate instruction function to take emulate options whichGreg Clayton
are defined as enumerations. Current bits include: eEmulateInstructionOptionAutoAdvancePC eEmulateInstructionOptionIgnoreConditions Modified the EmulateInstruction class to have a few more pure virtuals that can help clients understand how many instructions the emulator can handle: virtual bool SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0; Where instruction types are defined as: //------------------------------------------------------------------ /// Instruction types //------------------------------------------------------------------ typedef enum InstructionType { eInstructionTypeAny, // Support for any instructions at all (at least one) eInstructionTypePrologueEpilogue, // All prologue and epilogue instructons that push and pop register values and modify sp/fp eInstructionTypePCModifying, // Any instruction that modifies the program counter/instruction pointer eInstructionTypeAll // All instructions of any kind } InstructionType; This allows use to tell what an emulator can do and also allows us to request these abilities when we are finding the plug-in interface. Added the ability for an EmulateInstruction class to get the register names for any registers that are part of the emulation. This helps with being able to dump and log effectively. The UnwindAssembly class now stores the architecture it was created with in case it is needed later in the unwinding process. Added a function that can tell us DWARF register names for ARM that goes along with the source/Utility/ARM_DWARF_Registers.h file: source/Utility/ARM_DWARF_Registers.c Took some of plug-ins out of the lldb_private namespace. git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130189 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-25Renamed UnwindAssemblyProfiler to UnwindAssembly along with its source files.Greg Clayton
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130156 91177308-0d34-0410-b5e6-96231b3b80d8