summaryrefslogtreecommitdiffstats
path: root/lldb
Commit message (Collapse)AuthorAgeFilesLines
...
* Reflow paragraphs in comments.Adrian Prantl2018-04-30604-13438/+11190
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Match also DW_TAG_partial_unit when DW_TAG_compile_unit is matchedJan Kratochvil2018-04-309-19/+42
| | | | | | | | | | Code commonly checks if the parent DIE is DW_TAG_compile_unit. But DW_TAG_partial_unit also acts as DW_TAG_compile_unit for DWZ as DWZ is using DW_TAG_imported_unit only at the top unit level. Differential revision: https://reviews.llvm.org/D40469 llvm-svn: 331194
* llgs tests: Use noack-mode for communication to avoid pr37294Pavel Labath2018-04-302-2/+16
| | | | llvm-svn: 331180
* ObjectFileELF: Add support for arbitrarily named code sectionsPavel Labath2018-04-305-0/+73
| | | | | | | | | | | | | | | | | | | ObjectFileELF assumes that code section has ".text" name. There is an exception for kalimba toolchain that can use arbitrary names, but other toolchains also could use arbitrary names for code sections. For example, corert uses separate section for compiled managed code. As lldb doesn't recognize such section it leads to problem with breakpoints on arm, because debugger cannot determine instruction set (arm/thumb) and uses incorrect breakpoint opcode that breaks program execution. This change allows debugger to correctly handle such code sections. We assume that section is a code section if it has SHF_EXECINSTR flag set and has SHT_PROGBITS type. Patch by Konstantin Baladurin <k.baladurin@partner.samsung.com>. Differential Revision: https://reviews.llvm.org/D44998 llvm-svn: 331173
* Fixup r331049 (FileSpec auto-normalization)Pavel Labath2018-04-302-11/+5
| | | | | | | | | | | | | | | | | | A typo in the patch (using syntax instead of m_syntax) resulted in the normalization not working properly for windows filespecs when the syntax was passed as host-native. This did not affect the unit tests, as all of those pass an explicity syntax, but failed gloriously when running the full test suite. I also fix an expectation in an lldb-mi test, which was now failing because it was expecting a path to be echoed verbatim, but we were now normalizing it. As a drive-by, this also fixes the default-in-fully-covered-switch warning and removes an unused argument from the NeedsNormalization function. llvm-svn: 331172
* Support reading section ".gnu_debugaltlink"Jan Kratochvil2018-04-2914-5/+51
| | | | | | Differential revision: https://reviews.llvm.org/D40468 llvm-svn: 331148
* Fix build bots after r331049 broke them.Greg Clayton2018-04-271-10/+10
| | | | llvm-svn: 331082
* [debugserver] Fix the G packet handling.Frederic Riss2018-04-272-1/+12
| | | | | | Of course r331004 needed a counterpart on the write side. llvm-svn: 331073
* Always normalize FileSpec paths.Greg Clayton2018-04-2712-210/+186
| | | | | | | | Always normalizing lldb_private::FileSpec paths will help us get a consistent results from comparisons when setting breakpoints and when looking for source files. This also removes a lot of complexity from the comparison routines. Modified the DWARF line table parser to use the normalized compile unit directory if needed. Differential Revision: https://reviews.llvm.org/D45977 llvm-svn: 331049
* Mark test as @skipIfOutOfTreeDebugserverFrederic Riss2018-04-271-0/+1
| | | | | | This test will currently fail for people using the system debugserver. llvm-svn: 331043
* Fix a thinko in the iteration over StructuredDataPlugin Create functions.Jim Ingham2018-04-271-3/+8
| | | | | | | | | The code was grabbing the first plugin, and then never getting another one. <rdar://problem/39779438> llvm-svn: 331012
* [debugserver] Fix handling of the 'g' packetFrederic Riss2018-04-272-1/+33
| | | | | | | | | | | | | | LLDB doesn't use this packet so we never hit this, but it looks like some other projects talk to debugserver and are hitting an assert (https://github.com/derekparker/delve/issues/1015). We had an off by 1 in the accounting of the FPU structure sizes. I added a test that basically just check that 'g' doesn't return an error (currently it assert in debug builds). I didn't make it an lldb-server test because it looks like lldb-server doesn't implement the g packet. llvm-svn: 331004
* [debugserver] Return 'ios' instead of 'iphoneos' for the ostype.Frederic Riss2018-04-252-10/+10
| | | | | | | | | | | | | When I merged the 2 codepaths that return an OS type, I hade checked that the places accepting 'iphoneos' would also accept 'ios', but then I got it backwards and return 'iphoneos'. We use this value to build triples, and there 'iphoneos' is invalid. This also makes the test slightly simpler. llvm-svn: 330877
* Fix -Wswitch warning after r330790.Benjamin Kramer2018-04-251-0/+3
| | | | | | | source/Symbol/ClangASTContext.cpp:391:13: error: enumeration value 'HIP' not handled in switch [-Werror,-Wswitch] switch (IK.getLanguage()) { llvm-svn: 330823
* [lit, lldbsuite] Update the lldbsuite to correctly run tests on windows and ↵Aaron Smith2018-04-242-6/+9
| | | | | | | | | | | | | | | | | | | windows server Summary: The new script to run the lldbtests as part of lit invokes each test by calling dotest.py, however, we cannot rely on the system to always correctly interpret the script as python causing the tests to be unresolved on windows (at least). To fix this, we need to make sure that the first parameter in the command line is the python executable itself. In Makefile.rules, there are a number of windows specific definitions that rely on the HOST_OS being set as Windows_NT but the logic detecting the OS currently does not detect server versions of windows correctly. This change updates the logic to detect windows server as well. Reviewers: asmith, labath, JDevlieghere, zturner Reviewed By: JDevlieghere, zturner Subscribers: zturner, llvm-commits Differential Revision: https://reviews.llvm.org/D46020 llvm-svn: 330740
* [dotest] Make the set of tests independent of the test configurationPavel Labath2018-04-243-61/+33
| | | | | | | | | | | | | | | | | | | | | | | Summary: In the magic test duplicator, we were making the decision whether to create a test variant based on the compiler and the target platform. This meant that the set of known tests was different for each test configuration. This patch makes the set of generated test variants static and handles the skipping via runtime checks instead. This is more consistent with how we do other test-skipping decision (e.g. for libc++ tests), and makes it easier to expose the full set of tests to lit, which now does not need to know anything about what things can potentially cause tests to appear or disappear. Reviewers: JDevlieghere, aprantl Subscribers: eraman, lldb-commits Differential Revision: https://reviews.llvm.org/D45949 llvm-svn: 330708
* [CMake] Add the missing `dsymutil` dependency when running tests.Davide Italiano2018-04-231-0/+1
| | | | llvm-svn: 330617
* llgs-tests: Increase packet time outPavel Labath2018-04-231-0/+1
| | | | | | | | | | | | The default packet timeout of 1 second is a bit too small for these tests, particularly as they are working in ack-mode, which means they need to fit twice as many packets into the timeslot. This does not seem to be a problem on the bots, but for some people these tests are timing out regularly. I can't be sure increasing this will solve their problem, but this does seem like a likely culprit. llvm-svn: 330578
* [CMake] Gate 'dsymutil' dependencyJonas Devlieghere2018-04-231-2/+2
| | | | | | | Only add `dsymutil` as a test dependency when this is not a stand-alone build (LLDB_BUILT_STANDALONE). llvm-svn: 330568
* [lit] Generate a single lit cfg file for tests that require dotest.pyJonas Devlieghere2018-04-212-16/+47
| | | | | | | | | | | | | | | | | | The current way that the lit configuration is generated for the LLDB tests that run using dotest causes cmake to fail when using a generator which supports multiple configurations (such as Visual Studio). The failure is because file GENERATE will create a file *per possible configuration* resulting in the same lit configuration file being overwritten multiple times. To fix the issue, we need to create a single lit file that is agnostic of the configurations and can be used for any configuration. Patch by: Stella Stamenova Differential revision: https://reviews.llvm.org/D45918 llvm-svn: 330518
* Temporarily skip Go TestExpressions on FreeBSD as it hangsEd Maste2018-04-211-0/+1
| | | | | | llvm.org/pr37194 llvm-svn: 330504
* FreeBSD: propagate error to user if memory access failsEd Maste2018-04-211-2/+6
| | | | | | | | | | Previously, an attempt to read an unreadable address reported zeros. Now, if DoReadMemory or DoWriteMemory encounters error then return 0 (bytes read or written) so that the error is reported to the user. llvm.org/pr37190 llvm-svn: 330500
* Fix the Xcode gtest target for the move of FileSpecTest.cpp.Jim Ingham2018-04-201-1/+1
| | | | llvm-svn: 330460
* Fix a crash when resolving overloads of C++ virtual methods.Adrian Prantl2018-04-204-1/+29
| | | | | | | | | The isOverload() method needs to account for situations where the two methods being compared don't have the same number of arguments. rdar://problem/39542960 llvm-svn: 330450
* Move FileSpecTest to UtilityPavel Labath2018-04-203-7/+7
| | | | | | | FileSpec class was moved to the Utility module a while ago, but the test file was left behind. This corrects that. llvm-svn: 330405
* [DWARFASTParserClang] Remove dead code. NFCI.Davide Italiano2018-04-201-42/+0
| | | | llvm-svn: 330385
* Fix narrowing warning by appending `f` to literal constant.Adrian McCarthy2018-04-191-1/+1
| | | | llvm-svn: 330354
* Attempt to fix TestMiniDump on windowsPavel Labath2018-04-192-7/+8
| | | | | | | | | | | | | | | | | | | | | | | It was failing because the modules names were coming out as C:\Windows\System32/MSVCP120D.dll (last separator is a forward slash) on windows. There are two issues at play here: - the first problem is that the paths in minidump were being parsed as a host path. This meant that on posix systems the whole path was interpreted as a file name. - on windows the path was split into a directory-filename pair correctly, but then when it was reconsituted, the last separator ended up being a forward slash because SBFileSpec.fullpath was joining them with '/' unconditionally. I fix the first issue by parsing the minidump paths according to the path syntax of the host which produced the dump, which should make the test behavior on posix&windows identical. The last path will still be a forward slash because of the second issue. We should probably fix the "fullpath" property to do something smarter in the future. llvm-svn: 330314
* Improve LLDB's handling of non-local minidumpsLeonard Mosescu2018-04-187-6/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Normally, LLDB is creating a high-fidelity representation of a live process, including a list of modules and sections, with the associated memory address ranges. In order to build the module and section map LLDB tries to locate the local module image (object file) and will parse it. This does not work for postmortem debugging scenarios where the crash dump (minidump in this case) was captured on a different machine. Fortunately the minidump format encodes enough information about each module's memory range to allow us to create placeholder modules. This enables most LLDB functionality involving address-to-module translations. Also, we may want to completly disable the search for matching local object files if we load minidumps unless we can prove that the local image matches the one from the crash origin. (not part of this change, see: llvm.org/pr35193) Example: Identify the module from a stack frame PC: Before: thread #1, stop reason = Exception 0xc0000005 encountered at address 0x164d14 frame #0: 0x00164d14 frame #1: 0x00167c79 frame #2: 0x00167e6d frame #3: 0x7510336a frame #4: 0x77759882 frame #5: 0x77759855 After: thread #1, stop reason = Exception 0xc0000005 encountered at address 0x164d14 frame #0: 0x00164d14 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe frame #1: 0x00167c79 C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe frame #2: 0x00167e6d C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe frame #3: 0x7510336a C:\Windows\SysWOW64\kernel32.dll frame #4: 0x77759882 C:\Windows\SysWOW64\ntdll.dll frame #5: 0x77759855 C:\Windows\SysWOW64\ntdll.dll Example: target modules list Before: error: the target has no associated executable images After: [ 0] C:\Windows\System32\MSVCP120D.dll [ 1] C:\Windows\SysWOW64\kernel32.dll [ 2] C:\Users\amccarth\Documents\Visual Studio 2013\Projects\fizzbuzz\Debug\fizzbuzz.exe [ 3] C:\Windows\System32\MSVCR120D.dll [ 4] C:\Windows\SysWOW64\KERNELBASE.dll [ 5] C:\Windows\SysWOW64\ntdll.dll NOTE: the minidump format also includes the debug info GUID, so we can fill-in the module UUID from it, but this part was excluded from this change to keep the changes simple (the LLDB UUID is hardcoded to be either 16 or 20 bytes, while the CodeView GUIDs are normally 24 bytes) Differential Revision: https://reviews.llvm.org/D45700 llvm-svn: 330302
* [LIT] Have lit run the lldb test suiteJonas Devlieghere2018-04-184-5/+133
| | | | | | | | | | | | | | | | | | | | This is the first in what will hopefully become a series of patches to replace the driver logic in dotest.py with LIT. The motivation for this change is that there's no point in maintaining two driver implementations. Since all of the LLVM projects are using lit, this is the obvious choice. Obviously the goal is maintain full compatibility with the functionality offered by dotest. As such we won't be removing anything until that point has been reached. This patch is the initial attempt (referred to as v1) to run the lldb test suite with lit. To do so we introduced a custom LLDB test format that invokes dotest.py with a single test file. Differential revision: https://reviews.llvm.org/D45333 llvm-svn: 330275
* Report more precise error message when attach failsPavel Labath2018-04-183-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: If the remote stub sends a specific error message instead of just a E?? code, we can use this to display a more informative error message instead of just the generic "unable to attach" message. I write a test for this using the SB API. On the console this will show up like: (lldb) process attach ... error: attach failed: <STUB-MESSAGE> if the stub supports error messages, or: error: attach failed: Error ?? if it doesn't. Reviewers: jingham, JDevlieghere Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D45573 llvm-svn: 330247
* Change PlatformPosix::DoLoadImage to use a UtilityFunction.Jim Ingham2018-04-174-50/+321
| | | | | | | | | | | That way we won't have to compile a new expression every time we want dlopen a library. <rdar://problem/32626584> Differential Revision: https://reviews.llvm.org/D45703 llvm-svn: 330214
* Fix the xcode project for the Args -> Utility move.Jim Ingham2018-04-171-6/+6
| | | | llvm-svn: 330211
* Move Args.cpp from Interpreter to UtilityPavel Labath2018-04-1752-74/+61
| | | | | | | | | | | | | | | | | | | | | Summary: The Args class is used in plenty of places besides the command interpreter (e.g., anything requiring an argc+argv combo, such as when launching a process), so it needs to be in a lower layer. Now that the class has no external dependencies, it can be moved down to the Utility module. This removes the last (direct) dependency from the Host module to Interpreter, so I remove the Interpreter module from Host's dependency list. Reviewers: zturner, jingham, davide Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D45480 llvm-svn: 330200
* [Statistics] Relax the test output a little bit.Davide Italiano2018-04-161-4/+4
| | | | | | | | | | We don't really care about the order as this is a dictionary. It should be more resilient to changes (adding/shuffling stats around). Pointed out by Jason Molenda in a post-commit review (thanks Jason). llvm-svn: 330170
* [Commands] Expose statistics through the SBAPI.Davide Italiano2018-04-167-0/+60
| | | | | | | | | The API is `SBStructuredData GetStatistics()`. This allows the command to be used in scripts. <rdar://problem/36555975> llvm-svn: 330165
* Make sure deleting all breakpoints clears their sites firstEugene Zemtsov2018-04-163-5/+30
| | | | | | | | Bug: https://bugs.llvm.org/show_bug.cgi?id=36430 Differential Revision: https://reviews.llvm.org/D45554 llvm-svn: 330163
* [lldb-private] Mark a function as inline to prevent multiple def errors.Davide Italiano2018-04-161-1/+1
| | | | llvm-svn: 330149
* [Statistics] Move GetStatDescription to an header file.Davide Italiano2018-04-162-18/+18
| | | | | | | | In preparation for using it in the API. <rdar://problem/36555975> llvm-svn: 330147
* Reapply "Cleanup DWARFCompileUnit and DWARFUnit in preparation for adding ↵Jan Kratochvil2018-04-148-828/+569
| | | | | | | | | | | | | | DWARFTypeUnit". This patch by Greg Clayton drops the virtualization for DWARFPartialUnit. The virtualization of DWARFUnit now matches more its LLVM counterpart. DWZ patchset is going to be implementable without DWARFPartialUnit remapping. https://reviews.llvm.org/D40474 This reverts commit 329423. This reapplies commit r329305. llvm-svn: 330084
* Revert "[debugserver] Remove dead function call. NFCI."Davide Italiano2018-04-131-0/+3
| | | | | | | This reverts commit r330066 as it was wrong and the call was not dead. Thanks to Fred for pointing this out. llvm-svn: 330071
* [debugserver] Remove dead function call. NFCI.Davide Italiano2018-04-131-3/+0
| | | | llvm-svn: 330066
* [Command] Simplify the code and make it less error prone. NFCI.Davide Italiano2018-04-132-7/+2
| | | | | | Pointed out by Jim. llvm-svn: 330047
* [Command] Implement `statistics` command.Davide Italiano2018-04-1311-24/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to collect useful metrics about lldb debugging sessions. I thought that an example would be better than a thousand words: Process 19705 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = step in frame #0: 0x0000000100000fb4 blah`main at blah.c:3 1 int main(void) { 2 int a = 6; -> 3 return 0; 4 } (lldb) statistics enable (lldb) frame var a (int) a = 6 (lldb) expr a (int) $1 = 6 (lldb) statistics disable (lldb) statistics dump Number of expr evaluation successes : 1 Number of expr evaluation failures : 0 Number of frame var successes : 1 Number of frame var failures : 0 Future improvements might include: 1. Passing a file, or implementing categories. The way this patch has been implemented is generic enough to allow this to be extended easily without breaking the grammar. 2. Adding an SBAPI and Python API for use in scripts. Thanks to Jim Ingham for discussing the design with me. <rdar://problem/36555975> Differential Revision: https://reviews.llvm.org/D45547 llvm-svn: 330043
* Allow relative file paths when settings source breakpointsGreg Clayton2018-04-134-7/+56
| | | | | | | | | | | | | | | | | Many IDEs set breakpoints using absolute paths and this causes problems when the full path of the source file path doesn't match what is in the debug info. This can be due to different build systems and do or do not resolve symlinks. This patch allows relative breakpoint to be set correctly without needing to do any target.source-map tricks. If IDEs want to, they can send down relative paths like: ./main.c ./src/main.c src/main.c foo/bar/src/main.c I used the breakpoint resolver to match on the file basename and then we weed out anything whose relative paths don't match. This will be a huge improvement for IDEs as they can specify as much of a relative path as desired to uniquely identify a source file in the current project. Differential Revision: https://reviews.llvm.org/D45592 llvm-svn: 330028
* Re-land "Don't assume backing thread shares protocol ID."Jonas Devlieghere2018-04-135-4/+114
| | | | | | | | | | | | | | | | | | When we're dealing with virtual (memory) threads created by the OS plugins, there's no guarantee that the real thread and the backing thread share a protocol ID. Instead, we should iterate over the memory threads to find the virtual thread that is backed by the current real thread. Differential revision: https://reviews.llvm.org/D45497 rdar://36485830 The original revision (r329891) was reverted because the associated tests ran into a deadlock on the Linux bots. That problem was resolved by r330002. llvm-svn: 330005
* Prevent deadlock in OS PluginsJonas Devlieghere2018-04-131-32/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When performing a synchronous resume, the API mutex is held until the process is stopped. This is fine, except for when the OS plugins are processing an event before the main thread is aware of it, in which case we end up with a deadlock because in the internal thread we acquire a resource lock first, and then wait for the API lock, while in the main thread we do the opposite, we already hold the API mutex but are now waiting for the event mutex to handle the event. This patch fixes this by relaxing the need for the API lock in the OS plugins. We can get away with this because we now this code is executed in the main thread. As stated in the comment above, we just want to ensure nobody else messes with the API while we're making a change. In theory it's possible that the main thread would release the lock while we're executing the function, but prevent this would require a more structural solution (which we want, but do not have today). The same workaround was already present, but this patch generalizes it to the whole file. This will allow me to re-land r329891. Reviewers: clayborg, jingham, labath Subscribers: llvm-commits, lldb-commits Differential Revision: https://reviews.llvm.org/D45586 llvm-svn: 330002
* [docs] Add LLDB_TEST_USE_CUSTOM_C_COMPILER and ↵Aaron Smith2018-04-122-2/+5
| | | | | | LLDB_TEST_USE_CUSTOM_CXX_COMPILER to the build and test hmtl pages llvm-svn: 329971
* Revert "Don't assume backing thread shares protocol ID."Jonas Devlieghere2018-04-125-114/+4
| | | | | | | This reverts r329891 because the test case is timing out on linux: http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/21834 llvm-svn: 329897
* Don't assume backing thread shares protocol ID.Jonas Devlieghere2018-04-125-4/+114
| | | | | | | | | | | | | | When we're dealing with virtual (memory) threads created by the OS plugins, there's no guarantee that the real thread and the backing thread share a protocol ID. Instead, we should iterate over the memory threads to find the virtual thread that is backed by the current real thread. Differential revision: https://reviews.llvm.org/D45497 rdar://36485830 llvm-svn: 329891
OpenPOWER on IntegriCloud