aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
AgeCommit message (Collapse)AuthorFilesLines
2021-02-15[lldb] Remove the legacy FreeBSD pluginMichał Górny1-1080/+0
The new FreeBSDRemote plugin has reached feature parity with the legacy plugin, so we can finally remove the latter. The new plugin will be renamed to FreeBSD in a separate commit to avoid confusion. Differential Revision: https://reviews.llvm.org/D96555
2021-01-25[ThreadPlan] fix exec on LinuxWalter Erquinigo1-2/+2
2020-11-23[lldb] Prevent 'process connect' from using local-only pluginsMichał Górny1-2/+3
Add a 'can_connect' parameter to Process plugin initialization, and use it to filter plugins to these capable of remote connections. This is used to prevent 'process connect' from picking up a plugin that can only be used locally, e.g. the legacy FreeBSD plugin. Differential Revision: https://reviews.llvm.org/D91810
2020-11-05[lldb] Enable FreeBSDRemote plugin by default and update test statusMichał Górny1-7/+5
The new FreeBSDRemote plugin has reached feature parity on i386 and amd64 targets. Use it by default on these architectures, while allowing the use of the legacy plugin via FREEBSD_LEGACY_PLUGIN envvar. Revisit the method of switching plugins. Apparently, the return value of PlatformFreeBSD::CanDebugProcess() is what really decides whether the legacy or the new plugin is used. Update the test status. Reenable the tests that were previously disabled on FreeBSD and do not cause hangs or are irrelevant to FreeBSD. Mark all tests that fail reliably as expectedFailure. For now, tests that are flaky (i.e. produce unstable results) are left enabled and cause unpredictable test failures. Differential Revision: https://reviews.llvm.org/D90757
2020-10-08[lldb] Initial version of FreeBSD remote process pluginMichał Górny1-5/+7
Add a new FreeBSD Process plugin using client/server model. This plugin is based on the one used by NetBSD. It currently supports a subset of functionality for amd64. It is automatically used when spawning lldb-server. It can also be used by lldb client by setting FREEBSD_REMOTE_PLUGIN environment variable (to any value). The code is capable of debugging simple single-threaded programs. It supports general purpose, debug and FPU registers (up to XMM) of amd64, basic signalling, software breakpoints. Adding the support for the plugin involves removing some dead code from FreeBSDPlatform plugin (that was not ever used because CanDebugProcess() returned false), and replacing it with appropriate code from NetBSD platform support. Differential Revision: https://reviews.llvm.org/D88796
2020-10-07[lldb] Check for and use ptsname_r if availablePavel Labath1-2/+1
ptsname is not thread-safe. ptsname_r is available on most (but not all) systems -- use it preferentially. In the patch I also improve the thread-safety of the ptsname fallback path by wrapping it in a mutex. This should guarantee the safety of a typical ptsname implementation using a single static buffer, as long as all callers go through this function. I also remove the error arguments, as the only way this function can fail is if the "primary" fd is not valid. This is a programmer error as this requirement is documented, and all callers ensure that is the case. Differential Revision: https://reviews.llvm.org/D88728
2020-07-29[lldb] Make process plugins check whether a hardware breakpoint is requiredTatyana Krasnukha1-0/+3
Remove @skipIfWindows as process should report the error correctly on Windows now. Differential Revision: https://reviews.llvm.org/D84255
2020-06-15[lldb] Rename Master/Slave to Primary/Secondary (NFC)Jonas Devlieghere1-1/+2
2020-02-14[lldb/Plugin] s/LLDB_PLUGIN/LLDB_PLUGIN_DEFINE/ (NFC)Jonas Devlieghere1-1/+1
Rename LLDB_PLUGIN to LLDB_PLUGIN_DEFINE as Pavel suggested in D73067 to avoid name conflict.
2020-02-10[LLDB] Fix GCC warnings about extra semicolons. NFC.Martin Storsjö1-1/+1
2020-02-07[lldb/Plugins] Use external functions to (de)initialize pluginsJonas Devlieghere1-0/+2
This is a step towards making the initialize and terminate calls be generated by CMake, which in turn is towards making it possible to disable plugins at configuration time. Differential revision: https://reviews.llvm.org/D74245
2020-01-24[lldb][NFC] Fix all formatting errors in .cpp file headersRaphael Isemann1-2/+1
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp -------------------------------------------------===// ``` However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator `-*- C++ -*-` is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files). This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing `===//` (mostly caused by clang-format breaking the line). Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere Reviewed By: JDevlieghere Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73258
2019-09-24[NFC] Fix typo in the "kind" description for the software single-step breakpointTatyana Krasnukha1-1/+1
llvm-svn: 372763
2019-07-24[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere1-32/+26
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
2019-06-11Add support to read aux vector valuesAntonio Afonso1-2/+2
Summary: This is the second patch to improve module loading in a series that started here (where I explain the motivation and solution): https://reviews.llvm.org/D62499 I need to read the aux vector to know where the r_debug map with the loaded libraries are. The AuxVector class was made generic so it could be reused between the POSIX-DYLD plugin and NativeProcess*. The class itself ended up in the ProcessUtility plugin. Reviewers: clayborg, xiaobai, labath, JDevlieghere Reviewed By: clayborg, labath, JDevlieghere Subscribers: emaste, JDevlieghere, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D62500 llvm-svn: 363098
2019-05-16Simplify ArchSpec::IsMIPS()Fangrui Song1-5/+1
llvm-svn: 360865
2019-04-10[NFC] Remove ASCII lines from commentsJonas Devlieghere1-5/+0
A lot of comments in LLDB are surrounded by an ASCII line to delimit the begging and end of the comment. Its use is not really consistent across the code base, sometimes the lines are longer, sometimes they are shorter and sometimes they are omitted. Furthermore, it looks kind of weird with the 80 column limit, where the comment actually extends past the line, but not by much. Furthermore, when /// is used for Doxygen comments, it looks particularly odd. And when // is used, it incorrectly gives the impression that it's actually a Doxygen comment. I assume these lines were added to improve distinguishing between comments and code. However, given that todays editors and IDEs do a great job at highlighting comments, I think it's worth to drop this for the sake of consistency. The alternative is fixing all the inconsistencies, which would create a lot more churn. Differential revision: https://reviews.llvm.org/D60508 llvm-svn: 358135
2019-02-13Replace 'ap' with 'up' suffix in variable names. (NFC)Jonas Devlieghere1-10/+10
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
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-11-11Remove header grouping comments.Jonas Devlieghere1-4/+0
This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
2018-11-08[FileSystem] Add convenience method to check for directories.Jonas Devlieghere1-2/+1
Replace calls to LLVM's is_directory with calls to LLDB's FileSytem class. For this I introduced a new convenience method that, like the other methods, takes either a path or filespec. This still uses the LLVM functions under the hood. Differential revision: https://reviews.llvm.org/D54135 llvm-svn: 346375
2018-11-04[LLDB] Fix FreeBSD/Darwin buildDavid Carlier1-4/+6
Reviewers: JDevlieghere, tatyana-krasnukha Reviwed By: tatyana-krasnukha Differential Revision: https://reviews.llvm.org/D54084 llvm-svn: 346109
2018-11-01[FileSystem] Move path resolution logic out of FileSpecJonas Devlieghere1-2/+1
This patch removes the logic for resolving paths out of FileSpec and updates call sites to rely on the FileSystem class instead. Differential revision: https://reviews.llvm.org/D53915 llvm-svn: 345890
2018-11-01[FileSystem] Fix typo in ProcessFreeBSDJonas Devlieghere1-1/+1
llvm-svn: 345860
2018-11-01[FileSystem] Fix Exists call sitesJonas Devlieghere1-1/+2
There were some calls left to Exists() on non-darwin platforms (Windows, Linux and FreeBSD) that weren't yet updated to use the FileSystem. llvm-svn: 345857
2018-09-25Replace boolean parameter with enum value according r342633Tatyana Krasnukha1-2/+2
llvm-svn: 342998
2018-08-07Move RegisterValue,Scalar,State from Core to UtilityPavel Labath1-3/+3
These three classes have no external dependencies, but they are used from various low-level APIs. Moving them down to Utility improves overall code layering (although it still does not break any particular dependency completely). The XCode project will need to be updated after this change. Differential Revision: https://reviews.llvm.org/D49740 llvm-svn: 339127
2018-06-26Change AddressClass type from 'enum' to 'enum class'.Tatyana Krasnukha1-3/+3
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
2018-04-30Reflow paragraphs in comments.Adrian Prantl1-12/+12
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
2018-01-10Another attempt to fix FreeBsd buildPavel Labath1-1/+1
the previous fix did not work because of different const qualifications on the envp pointer. This should resolve that (and remove a couple of const_casts in the process). llvm-svn: 322187
2018-01-10Fix windows and freebsd builds for r322174 (Environment)Pavel Labath1-3/+2
llvm-svn: 322176
2017-10-24[FreeBSD] Remove more dead code. NFCI.Davide Italiano1-26/+0
llvm-svn: 316530
2017-05-12Rename Error -> Status.Zachary Turner1-49/+51
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. llvm-svn: 302872
2017-04-11Remove Plugins/Process/POSIX from include_directoriesPavel Labath1-1/+1
Summary: The files there can always be referred to using their full path, which is what most of the code has been doing already, so this makes the situation more consistent. Also fix the the code in the FreeBSD plugin to use the new paths. Reviewers: eugene, emaste Subscribers: lldb-commits, kettenis, mgorny, krytarowski Differential Revision: https://reviews.llvm.org/D31877 llvm-svn: 299933
2017-04-06Try to fix FreeBSD build after IWYU changes.Zachary Turner1-0/+1
llvm-svn: 299719
2017-03-22Move FileSpec from Host -> Utility.Zachary Turner1-1/+1
llvm-svn: 298536
2017-03-17Fix FreeBSD build broken by r298066Pavel Labath1-2/+4
llvm-svn: 298069
2017-03-17Move GetAuxvData from Host to relevant process pluginsPavel Labath1-9/+18
Summary: GetAuxvData was causing dependencies from host to target and linux process modules. It also does not fit netbsd use case, as there we can only read the auxiliary vector with ptrace, which is better done in the process plugin, with the other ptrace calls. I resolve these issues by moving the freebsd and linux versions into the relevant process plugins. In case of linux, this required adding an interface in NativeProcessProtocol. The empty definitions on other platforms can simply be removed. To get the code compiling I had to add ProcessGdbRemote -> ProcessLinux dependency, which was not caught before because we depended on it transitively. Reviewers: zturner, emaste Subscribers: srhines, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D31031 llvm-svn: 298066
2017-03-08Resubmit FileSystem changes.Zachary Turner1-3/+4
This was originall reverted due to some test failures in ModuleCache and TestCompDirSymlink. These issues have all been resolved and the code now passes all tests. Differential Revision: https://reviews.llvm.org/D30698 llvm-svn: 297300
2017-03-07Revert "Use LLVM for all stat-related functionality."Pavel Labath1-4/+3
this reverts r297116 because it breaks the unittests and TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat functionality is not a drop-in replacement for lldb's. The former is based on stat(2) (which does symlink resolution), while the latter is based on lstat(2) (which does not). This also reverts subsequent build fixes (r297128, r297120, 297117) and r297119 (Remove FileSpec dependency on FileSystem) which builds on top of this. llvm-svn: 297139
2017-03-07Fix FreeBSD build.Zachary Turner1-2/+3
llvm-svn: 297120
2017-03-07Use LLVM for all stat-related functionality.Zachary Turner1-2/+2
This deletes LLDB's FileType enumeration and replaces all users, and all calls to functions that check whether a file exists etc with corresponding calls to LLVM. Differential Revision: https://reviews.llvm.org/D30624 llvm-svn: 297116
2017-02-23Switch "posix" to the new log channel registration mechanismPavel Labath1-1/+0
Summary: This also removes magic rename code, which caused the channel to be called "linux" when built on a linux machine, and "freebsd" when built on a freebsd one, which seems unnecessary - registering a new channel is sufficiently simple now that if we wish to log something extremely os-specific, we can just create a new channel. None of the current categories seem very specific to one OS or another. Reviewers: emaste, krytarowski Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D30250 llvm-svn: 295954
2017-02-06Remove the verbose category in the posix channelPavel Labath1-13/+5
replace by LLDB_LOGV llvm-svn: 294223
2017-02-06Switch std::call_once to llvm::call_onceKamil Rytarowski1-2/+4
Summary: The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms. This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, mehdi_amini, clayborg Reviewed By: labath, clayborg Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29288 llvm-svn: 294202
2017-01-24FreeBSD ARM support for software single stepEd Maste1-1/+199
Implementation of software single step for FreeBSD on ARM. The code is largely based on the Linux implementation of the same functionality. Patch by Dmitry Mikulin! Differential Revision: https://reviews.llvm.org/D25756 llvm-svn: 292937
2016-11-11Revert unwanted changes in lldb when updating llvm::Error()Mehdi Amini1-1/+1
My script updated lldb::Errors, and I failed to fix it entirely before pushing. This restore everything in lldb as it was before r286561. llvm-svn: 286565
2016-11-11Make the Error class constructor protectedMehdi Amini1-1/+1
This is forcing to use Error::success(), which is in a wide majority of cases a lot more readable. Differential Revision: https://reviews.llvm.org/D26481 llvm-svn: 286561
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-803/+673
*** 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
2016-05-19second pass over removal of Mutex and ConditionSaleem Abdulrasool1-7/+7
llvm-svn: 270024