summaryrefslogtreecommitdiffstats
path: root/lldb/source
Commit message (Collapse)AuthorAgeFilesLines
...
* Explicitly set entry point arch when it's thumbAntonio Afonso2019-10-041-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: I found a case where the main android binary (app_process32) had thumb code at its entry point but no entry in the symbol table indicating this. This made lldb set a 4 byte breakpoint at that address (we default to arm code) instead of a 2 byte one (like we should for thumb). The big deal with this is that the expression evaluator uses the entry point as a way to know when a JITed expression has finished executing by putting a breakpoint there. Because of this, evaluating expressions on certain android devices (Google Pixel something) made the process crash. This was fixed by checking this specific situation when we parse the symbol table and add an artificial symbol for this 2 byte range and indicating that it's arm thumb. I created 2 unit tests for this, one to check that now we know that the entry point is arm thumb, and the other to make sure we didn't change the behaviour for arm code. I also run the following on the command line with the `app_process32` where I found the issue: **Before:** ``` (lldb) dis -s 0x1640 -e 0x1644 app_process32[0x1640]: .long 0xf0004668 ; unknown opcode ``` **After:** ``` (lldb) dis -s 0x1640 -e 0x1644 app_process32`: app_process32[0x1640] <+0>: mov r0, sp app_process32[0x1642]: andeq r0, r0, r0 ``` Reviewers: clayborg, labath, wallace, espindola Subscribers: srhines, emaste, arichardson, kristof.beyls, MaskRay, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68069 llvm-svn: 373680
* Python3 doesn't seem to allow you to tell whether an object is a classJim Ingham2019-10-032-4/+1
| | | | | | | | | PyClass_Check and everything it relied on seems gone from Python3.7. So I won't check whether it is a class first... Also cleaned up a couple of warnings. llvm-svn: 373679
* Forgot to change the header guards on OptionGroupPythonClassWithDict.Jim Ingham2019-10-031-1/+1
| | | | | | I think that's what is confusing the modules build on the bots. llvm-svn: 373677
* Pass an SBStructuredData to scripted ThreadPlans on use.Jim Ingham2019-10-039-128/+244
| | | | | | | | | | This will allow us to write reusable scripted ThreadPlans, since you can use key/value pairs with known keys in the plan to parametrize its behavior. Differential Revision: https://reviews.llvm.org/D68366 llvm-svn: 373675
* Break out the Python class & key/value options into a separate OptionGroup.Jim Ingham2019-10-035-41/+139
| | | | | | | | | | Use this in the scripted breakpoint command. Added some tests for parsing the key/value options. This uncovered a bug in handling parsing errors mid-line. I also fixed that bug. Differential Revision: https://reviews.llvm.org/D68363 llvm-svn: 373673
* [process list] make the TRIPLE column widerWalter Erquinigo2019-10-031-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Now that `process list` works better on the android platform, the arch aarch64-unknown-linux-android appears quite often. The existing printed width of the TRIPLE column is not long enough, which doesn't look okay. E.g. ``` 1561 1016 aarch64-unknown-linux-android ip6tables-restore 1999 1 aarch64-unknown-linux-android tlc_server 2332 982 com.android.systemui 2378 983 webview_zygote ``` Now, after adding 6 spaces, it looks better ``` PID PARENT USER TRIPLE NAME ====== ====== ========== ============================== ============================ ... 1561 1016 aarch64-unknown-linux-android ip6tables-restore 1999 1 aarch64-unknown-linux-android tlc_server 2332 982 com.android.systemui 2378 983 webview_zygote 2448 982 com.sec.location.nsflp2 ``` Reviewers: clayborg, labath, xiaobai, aadsm Reviewed By: labath Subscribers: srhines, kristof.beyls, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68291 llvm-svn: 373670
* [JSON] Don't wrap json::Array in a value (NFC)Jonas Devlieghere2019-10-031-3/+3
| | | | | | | | There's no need to wrap the just-constructed json::Array in a json::Value, we can just return that and pass ownership to the raw_ostream. llvm-svn: 373656
* [Host] Return the user's shell from GetDefaultShellJonas Devlieghere2019-10-031-9/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | LLDB handles shell expansion by running lldb-argdumper under a shell. Currently, this is always /bin/sh on POSIX. This potentially leads to different behavior between lldb and the user's current shell. Here's an example of different expansions between shells: $ /bin/bash -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}' -config={Options:[key:foo_key]} -config={Options:[value:foo_value]} $ /bin/zsh -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}' zsh:1: no matches found: -config={Options:[key:foo_key]} $ /bin/sh -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}' -config={Options:[key:foo_key]} -config={Options:[value:foo_value]} $ /bin/fish -c 'echo -config={Options:[{key:foo_key,value:foo_value}]}' -config=Options:[key:foo_key] -config=Options:[value:foo_value] To reduce surprises, this patch returns the user's current shell. It first looks at the SHELL environment variable. If that isn't set, it'll ask for the user's default shell. Only if that fails, we'll fallback to /bin/sh, which should always be available. Differential revision: https://reviews.llvm.org/D68316 llvm-svn: 373644
* Fix a use-after-free in GDBRemoteCommunicationServerLLGSPavel Labath2019-10-031-1/+2
| | | | | | | | | | | | Although it's called "GetString", StreamString::GetString actually returns a StringRef. Creating a json object with a StringRef does not make a copy, which means the StringRef will be dangling as soon as the underlying stream is destroyed. Add a .str() to force the json object to hold a copy of the string. This fixes nearly every test on linux. llvm-svn: 373572
* factor out an abstract base class for FileLawrence D'Anna2019-10-0314-138/+201
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch factors out File as an abstract base class and moves most of its actual functionality into a subclass called NativeFile. In the next patch, I'm going to be adding subclasses of File that don't necessarily have any connection to actual OS files, so they will not inherit from NativeFile. This patch was split out as a prerequisite for https://reviews.llvm.org/D68188 Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68317 llvm-svn: 373564
* SBDebugger::SetInputFile, SetOutputFile, etc.Lawrence D'Anna2019-10-034-30/+114
| | | | | | | | | | | | | | | | | | | | | Summary: Add new methods to SBDebugger to set IO files as SBFiles instead of as FILE* streams. In future commits, the FILE* methods will be deprecated and these will become the primary way to set the debugger I/O streams. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68181 llvm-svn: 373563
* new api class: SBFileLawrence D'Anna2019-10-036-23/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: SBFile is a scripting API wrapper for lldb_private::File This is the first step in a project to enable arbitrary python io.IOBase file objects -- including those that override the read() and write() methods -- to be used as the main debugger IOStreams. Currently this is impossible because python file objects must first be converted into FILE* streams by SWIG in order to be passed into the debugger. full prototype: https://github.com/smoofra/llvm-project/tree/files Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath Reviewed By: labath Subscribers: labath, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67793 llvm-svn: 373562
* [ARM64] XPC services are unsupported on device.Davide Italiano2019-10-021-2/+2
| | | | | | | | While around, clean up support for a 8 years old OS. <rdar://problem/55916729> llvm-svn: 373510
* [RegisterContextDarwin_arm64] Include the headers for getsysctlbyname.Davide Italiano2019-10-021-0/+5
| | | | | | | | This code is only used under __arm64__, use the correct guard. <rdar://problem/55916729> llvm-svn: 373509
* [ObjectFileMachO] FileSpec::SetFile() now takes the style as arg.Davide Italiano2019-10-021-1/+1
| | | | | | | | | Another block that's only compiled on __arm64__ and wasn't updated. <rdar://problem/55916729> llvm-svn: 373508
* [ObjectFileMachO] Catch up with FileDesc changes.Davide Italiano2019-10-021-3/+3
| | | | | | | | This didn't show up because nobody built __arm64__ in a while. <rdar://problem/55916729> llvm-svn: 373507
* [JSON] Remove Utility/JSON.{h|cpp}Jonas Devlieghere2019-10-022-551/+0
| | | | | | | | | | | | | This patch is the final step in my quest to get rid of the JSON parser in LLDB. Vedant's coverage report [1] shows that it was mostly untested. Furthermore, the LLVM implementation has a much nicer API and using it means one less thing to maintain for LLDB. [1] http://lab.llvm.org:8080/coverage/coverage-reports/index.html Differential revision: https://reviews.llvm.org/D68305 llvm-svn: 373501
* [JSON] Use LLVM's library for encoding JSON in ↵Jonas Devlieghere2019-10-021-20/+17
| | | | | | | | | | | GDBRemoteCommunicationServerCommon This patch replaces the LLDB's JSON implementation with the one from LLVM in GDBRemoteCommunicationServerCommon. Differential revision: https://reviews.llvm.org/D68304 llvm-svn: 373500
* [JSON] Use LLVM's library for encoding JSON in ↵Jonas Devlieghere2019-10-021-11/+10
| | | | | | | | | | | GDBRemoteCommunicationServerPlatform This patch replaces the LLDB's JSON implementation with the one from LLVM in GDBRemoteCommunicationServerPlatform. Differential revision: https://reviews.llvm.org/D68302 llvm-svn: 373499
* [JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationClientJonas Devlieghere2019-10-021-10/+10
| | | | | | | | | This patch replaces the LLDB's JSON implementation with the one from LLVM in GDBRemoteCommunicationClient. Differential revision: https://reviews.llvm.org/D68301 llvm-svn: 373498
* [JSON] Use LLVM's library for encoding JSON in GDBRemoteCommunicationServerLLGSJonas Devlieghere2019-10-021-48/+51
| | | | | | | | | This patch replaces the LLDB's JSON implementation with the one from LLVM in GDBRemoteCommunicationServerLLGS. Differential revision: https://reviews.llvm.org/D68299 llvm-svn: 373497
* [lldb] Fix evaluation of nested classes with parent from other CURaphael Isemann2019-10-021-0/+2
| | | | | | | | | | | | | | This makes sure that we associate DIEs that are imported from other CUs with the appropriate decl context. Without this fix, nested classes can be dumped directly into their CU context if their parent was imported from another CU. Reviewed By: teemperor, labath Differential Revision: https://reviews.llvm.org/D68278 Patch by Jaroslav Sevcik! llvm-svn: 373470
* [lldb][NFC] Remove ClangASTContext::ClearRaphael Isemann2019-10-021-13/+0
| | | | | | | | | | We now only use this function directly after initialization. As Clear() resets the ASTContext back to its initial state, this is just a no-op. There are no other users for this and we no longer can set the ASTContext after construction, so Clear has no useful purpose anymore. It's also mostly copy-pasted from Finalize(). llvm-svn: 373460
* [lldb][NFC] Create the ASTContext in ClangASTContext exactly once.Raphael Isemann2019-10-021-56/+58
| | | | | | | | | | | | | | | Reason for this patch is the Ssame reason as for the previous patches: Having a ClangASTContext and being able to switch the associated ASTContext isn't a use case we have (or should have), so let's simplify all this code. This way it becomes clearer in what order we initialize data structures. The DWARFASTParserClangTests changes are necessary as the test is using a ClangASTContext but relied on the fact that no called function ever calls getASTContext() on our ClangASTContext (as that would create the ASTContext). As we now always create the ASTContext the fact that we had an uninitialized FileSystem made the test crash. llvm-svn: 373457
* [lldb] Fix unused variable warningJordan Rupprecht2019-10-011-1/+0
| | | | llvm-svn: 373399
* [JSON] Use LLVM's library for decoding JSON in StructuredDataJonas Devlieghere2019-10-011-100/+48
| | | | | | | | | This patch replaces the hand-rolled JSON decoding in StructuredData with LLVM's JSON library. Differential revision: https://reviews.llvm.org/D68282 llvm-svn: 373360
* [JSON] Use LLVM's library for encoding JSON in StructuredDataJonas Devlieghere2019-10-014-79/+29
| | | | | | | | | This patch replaces the hand-rolled JSON emission in StructuredData with LLVM's JSON library. Differential revision: https://reviews.llvm.org/D68248 llvm-svn: 373359
* Fix a condition-flip regression introduced in r373344.Adrian Prantl2019-10-011-1/+1
| | | | llvm-svn: 373354
* Typo (NFC)Adrian Prantl2019-10-011-3/+3
| | | | llvm-svn: 373353
* Simplify condition (NFC)Adrian Prantl2019-10-011-1/+1
| | | | llvm-svn: 373352
* Remove size_t return parameter from FindTypesAdrian Prantl2019-10-0119-304/+231
| | | | | | | | | | | | | | | In r368345 I accidentally introduced a regression that would over-report the number of matches found by FindTypes if the DeclContext Filter was hit. This patch simply removes the size_t return parameter altogether — it's not that useful. rdar://problem/55500457 Differential Revision: https://reviews.llvm.org/D68169 llvm-svn: 373344
* Update SymbolFilePDB for FindTypes API change.Adrian Prantl2019-10-012-22/+17
| | | | | | This is untested, I don't have access to a Windows machine. llvm-svn: 373342
* [lldb][NFC] Remove unused ClangASTContext::GetHasExternalStorageRaphael Isemann2019-10-011-68/+0
| | | | | | This code isn't used nor tested. llvm-svn: 373337
* [lldb][NFC] Remove unused ClangASTContext functions for checking/removing ↵Raphael Isemann2019-10-011-17/+0
| | | | | | the ExternalASTSource llvm-svn: 373334
* [lldb][NFC] Disallow changing the ASTContext of an ClangASTContext after ↵Raphael Isemann2019-10-013-15/+10
| | | | | | | | | | | construction. We have no use case in LLDB where we actually do want to change the ASTContext after it the ClangASTContext has been constructed. All callers of setASTContext are just setting the ASTContext directly after construction, so we might as well make this a Constructor instead of supporting this tricky use case. llvm-svn: 373330
* [lldb][NFC] Modernize ClangASTContext constructorRaphael Isemann2019-10-011-11/+6
| | | | | | | | | Now using default initializers and StringRef. Also formats the member list that we excluded from clang-format at some point and still hangs around with the old LLDB code style. llvm-svn: 373329
* [clang][lldb][NFC] Encapsulate ExternalASTMerger::ImporterSourceRaphael Isemann2019-10-014-11/+11
| | | | | | NFC preparation work for upcoming ExternalASTMerger patches. llvm-svn: 373312
* [Windows] Added support of watchpoints to `NativeProcessWindows`Aleksandr Urakov2019-10-018-64/+835
| | | | | | | | | | | | | | | | Summary: This patch adds support of watchpoints to the new `NativeProcessWindows` plugin. The same tests as in D67168 pass with these changes when the old plugin is turned off, so they will cover this functionality when the old plugin is gone. Reviewers: asmith, amccarth, stella.stamenova, labath Reviewed By: labath Subscribers: labath, jfb, JDevlieghere, lldb-commits, leonid.mashinskiy Tags: #lldb Differential Revision: https://reviews.llvm.org/D67222 llvm-svn: 373300
* File::Clear() -> File::TakeStreamAndClear()Lawrence D'Anna2019-10-011-2/+5
| | | | | | | | | | | | | | | | | | | | | | | Summary: File::Clear() is an ugly function. It's only used in one place, which is the swig typemaps for FILE*. This patch refactors and renames that function to make it clear what it's really for and why nobody else should use it. Both File::TakeStreamAndClear() and the FILE* typemaps will be removed in later patches after a suitable replacement is in place. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68160 llvm-svn: 373285
* Allow the internal-state-thread free access to the TargetAPI mutex.Jim Ingham2019-10-012-0/+13
| | | | | | | | | | | It is always doing work on behalf of another thread that presumably has the mutex, so if it is calling SB API's it should have free access to the mutex. This is the same decision as we made earlier with the process RunLock. Differential Revision: https://reviews.llvm.org/D68174 llvm-svn: 373280
* [StackFrameList][DFS] Turn a few raw pointers into references, NFCVedant Kumar2019-09-302-8/+9
| | | | llvm-svn: 373267
* Remove unused "append" parameter from FindTypes APIAdrian Prantl2019-09-3013-123/+80
| | | | | | | | | | | | | I noticed that SymbolFileDWARFDebugMap::FindTypes was implementing it incorrectly (passing append=false in a for-loop to recursive calls to FindTypes would yield only the very last set of results), but instead of fixing it, removing it seemed like an even better option. rdar://problem/54412692 Differential Revision: https://reviews.llvm.org/D68171 llvm-svn: 373224
* Use llvm for dumping DWARF expressionsPavel Labath2019-09-303-409/+5
| | | | | | | | | | | | | | | Summary: It uses the new ability of ABI plugins to vend llvm::MCRegisterInfo structs (which is what is needed to turn dwarf register numbers into strings). Reviewers: JDevlieghere, aprantl, jasonmolenda Subscribers: tatyana-krasnukha, lldb-commits Differential Revision: https://reviews.llvm.org/D67966 llvm-svn: 373208
* [lldb][NFC][modern-type-lookup] Remove while(false) behind if() {}Raphael Isemann2019-09-301-2/+0
| | | | | | | | This was originally a 'do { ... } while (false);' like in the rest of the function, but the do was refactored into an 'if' without also removing the trailing 'while(false);' llvm-svn: 373206
* [lldb] Reland 370734: Test 'frame select -r' and fix that INT32_MIN breaks ↵Raphael Isemann2019-09-301-13/+16
| | | | | | | | | | | | | the option parser The problem with r370734 was that it removed the code for resetting the options in OptionParsingStarting. This caused that once a 'frame select -r ...' command was executed, we kept the relative index argument for all following 'frame select ...' invocations (even the ones with an absolute index as they are the same command object). See rdar://55791276. This relands the patch but keeps the code that resets the command options before execution. llvm-svn: 373201
* [lldb] Partly revert 370734: Test 'frame select -r' and fix that INT32_MIN ↵Raphael Isemann2019-09-301-16/+16
| | | | | | | | | | | breaks the option parser This somehow caused that 'frame select X' ends up being interpreted as 'frame select -r 1' when 'up' or 'down' were run before 'frame select X'. See rdar://55791276. Partly reverting to unbreak master. The changes that aren't reverted are the generic 'frame select -r' tests that are obviously NFC and test existing behavior. llvm-svn: 373194
* Revert "[LLDB] Use the llvm microsoft demangler instead of the windows ↵Martin Storsjo2019-09-281-3/+41
| | | | | | | | | dbghelp api. NFC." This reverts SVN r373144, as it changed the demangled output a little, see http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/9306. llvm-svn: 373146
* [LLDB] Use the llvm microsoft demangler instead of the windows dbghelp api. NFC.Martin Storsjo2019-09-281-41/+3
| | | | | | | | | If there's any testcases that only do demangling (I didn't find any), they could be made available for all platforms now. Differential Revision: https://reviews.llvm.org/D68134 llvm-svn: 373144
* Give an error when StepUsingScriptedThreadPlan is passed a bad classname.Jim Ingham2019-09-283-7/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D68173 llvm-svn: 373135
* [Core] Remove unused dependency on clangASTAlex Langford2019-09-282-4/+0
| | | | llvm-svn: 373134
OpenPOWER on IntegriCloud