Commit Graph

45 Commits

Author SHA1 Message Date
Raphael Isemann 45c3fc97a2 [lldb][NFC] Make GetResumeCountForLaunchInfo return an unsigned.
The number of resumes should always be positive to let's make this an
unsigned everywhere. Also remove the unused 'localhost' parameter from
ConvertArgumentsForLaunchingInShell.
2020-10-27 16:25:01 +01:00
Pavel Labath 0610a25a85 [lldb] Delete copy operations on PluginInterface class
This is a polymorphic class, copying it is a bad idea.

This was not a problem because most classes inheriting from it were
deleting their copy operations themselves. However, this enables us to
delete those explicit deletions, and ensure noone forgets to add them in
the future.
2020-10-09 10:37:09 +02:00
Michał Górny a825eaa90e [lldb] [Platform] Move common ::DebugProcess() to PlatformPOSIX
Move common ::DebugProcess() implementation shared by Linux and NetBSD
(and to be shared by FreeBSD shortly) into PlatformPOSIX, and move
the old base implementation used only by Darwin to PlatformDarwin.

Differential Revision: https://reviews.llvm.org/D88852
2020-10-06 14:38:54 +02:00
Jonas Devlieghere 64ec505dd4 [lldb] Rename Master/Slave to Primary/Secondary (NFC) 2020-06-15 15:38:28 -07:00
Konrad Kleine eaebcbc679 [lldb] NFC remove DISALLOW_COPY_AND_ASSIGN
Summary:
This is how I applied my clang-tidy check (see
https://reviews.llvm.org/D80531) in order to remove
`DISALLOW_COPY_AND_ASSIGN` and have deleted copy ctors and deleted
assignment operators instead.

```
lang=bash
grep DISALLOW_COPY_AND_ASSIGN /opt/notnfs/kkleine/llvm/lldb -r -l | sort | uniq > files

for i in $(cat files);
do
  clang-tidy \
    --checks="-*,modernize-replace-disallow-copy-and-assign-macro" \
    --format-style=LLVM \
    --header-filter=.* \
    --fix \
    -fix-errors \
    $i;
done
```

Reviewers: espindola, labath, aprantl, teemperor

Reviewed By: labath, aprantl, teemperor

Subscribers: teemperor, aprantl, labath, emaste, sbc100, aheejin, MaskRay, arphaman, usaxena95, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80543
2020-06-02 13:23:53 -04:00
Jonas Devlieghere cdc514e4c6 [lldb] Update header guards to be consistent and compliant with LLVM (NFC)
LLDB has a few different styles of header guards and they're not very
consistent because things get moved around or copy/pasted. This patch
unifies the header guards across LLDB and converts everything to match
LLVM's style.

Differential revision: https://reviews.llvm.org/D74743
2020-02-17 23:15:40 -08:00
Jason Molenda 83bea6d99d Remove 'process launch failed:' message prefix in Target::Launch
SB API clients can describe the failure message in a more natural
way for their UI, this doesn't add information for them.

Differential Revision: https://reviews.llvm.org/D74585
<rdar://problem/49953304>
2020-02-14 18:42:38 -08:00
Jonas Devlieghere bba9ba8d95 [lldb/Plugin] s/LLDB_PLUGIN/LLDB_PLUGIN_DEFINE/ (NFC)
Rename LLDB_PLUGIN to LLDB_PLUGIN_DEFINE as Pavel suggested in D73067 to
avoid name conflict.
2020-02-14 09:58:24 -08:00
Martin Storsjö 6115bd9ba2 [LLDB] Fix GCC warnings about extra semicolons. NFC. 2020-02-10 11:20:44 +02:00
Jonas Devlieghere fbb4d1e43d [lldb/Plugins] Use external functions to (de)initialize plugins
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-02-07 15:28:27 -08:00
Raphael Isemann 808142876c [lldb][NFC] Fix all formatting errors in .cpp file headers
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
2020-01-24 08:52:55 +01:00
Jonas Devlieghere 3011d55f72 [lldb/Host] Use cmakedefine01 for LLDB_ENABLE_POSIX
Rename LLDB_DISABLE_POSIX to LLDB_ENABLE_POSIX and use cmakedefine01 for
consistency.
2019-12-13 10:00:59 -08:00
Konrad Kleine 248a13057a [lldb] NFC modernize codebase with modernize-use-nullptr
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

llvm-svn: 361484
2019-05-23 11:14:47 +00:00
Jonas Devlieghere 8b3af63b89 [NFC] Remove ASCII lines from comments
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-04-10 20:48:55 +00:00
Chandler Carruth 2946cd7010 Update the file headers across all of the LLVM projects in the monorepo
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
2019-01-19 08:50:56 +00:00
Pavel Labath cb8c699802 ProcessLaunchInfo: remove Debugger reference
Summary:
The Debuffer object was being used in "GetListenerForProcess" to provide
a default listener object if one was not specified in the launch_info
object.

Since all the callers of this function immediately passed the result to
Target::CreateProcess, it was easy to move this logic there instead.

This brings us one step closer towards being able to move the LaunchInfo
classes to the Host layer (which is there the launching code that
consumes them lives).

Reviewers: zturner, jingham, teemperor

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D56174

llvm-svn: 350510
2019-01-07 10:59:57 +00:00
Jonas Devlieghere a6682a413d Simplify Boolean expressions
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

llvm-svn: 349215
2018-12-15 00:15:33 +00:00
Jonas Devlieghere ceff6644bb Remove header grouping comments.
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-11 23:17:06 +00:00
Jonas Devlieghere f9a07e9f8d [NFC] Turn "load dependent files" boolean into an enum
This is an NFC commit to refactor the "load dependent files" parameter
from a boolean to an enum value. We want to be able to specify a
default, in which case we decide whether or not to load the dependent
files based on whether the target is an executable or not (i.e. a
dylib).

This is a dependency for D51934.

Differential revision: https://reviews.llvm.org/D51859

llvm-svn: 342633
2018-09-20 09:09:05 +00:00
Pavel Labath d821c997aa Move RegisterValue,Scalar,State from Core to Utility
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-08-07 11:07:21 +00:00
Adrian Prantl 05097246f3 Reflow paragraphs in comments.
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-04-30 16:49:04 +00:00
Kamil Rytarowski eb175a00ab Sync PlatformNetBSD.cpp with Linux
Summary:
Various changes in logging from log->Printf() to generic LLDB_LOG().

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg

Reviewed By: labath

Subscribers: llvm-commits, lldb-commits

Differential Revision: https://reviews.llvm.org/D42912

llvm-svn: 324251
2018-02-05 17:12:23 +00:00
Pavel Labath 07d6f881e7 Move PseudoTerminal to the lldb_private namespace
lldb_utility doesn't make sense, as it is no longer even living in the
"utility" module.

llvm-svn: 320346
2017-12-11 10:09:14 +00:00
Ed Maste 37c40af712 Make i386-*-freebsd expression work on JIT path
* Enable i386 ABI creation for freebsd
* Added an extra argument in ABISysV_i386::PrepareTrivialCall for mmap
  syscall
* Unlike linux, the last argument of mmap is actually 64-bit(off_t).
  This requires us to push an additional word for the higher order bits.
* Prior to this change, ktrace dump will show mmap failures due to
  invalid argument coming from the 6th mmap argument.

Patch by Karnajit Wangkhem

Differential Revision:	https://reviews.llvm.org/D34776

llvm-svn: 311002
2017-08-16 12:55:02 +00:00
Zachary Turner 97206d5727 Rename Error -> Status.
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-05-12 04:51:55 +00:00
Zachary Turner 5713a05b5b Move FileSpec from Host -> Utility.
llvm-svn: 298536
2017-03-22 18:40:07 +00:00
Zachary Turner 6f9e690199 Move Log from Core -> Utility.
All references to Host and Core have been removed, so this
class can now safely be lowered into Utility.

Differential Revision: https://reviews.llvm.org/D30559

llvm-svn: 296909
2017-03-03 20:56:28 +00:00
Kamil Rytarowski 3202ce6fe0 Synchronize PlatformNetBSD with Linux
Summary:
Update the code to the new world code.

These changes are needed for remote process plugin.

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, clayborg, joerg, labath

Reviewed By: clayborg, labath

Subscribers: #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D29266

llvm-svn: 294145
2017-02-05 21:32:38 +00:00
Pavel Labath ec9bc8ccd4 Push down more common code into PlatformPOSIX
Summary:
- GetFileWithUUID: All platforms except PlatformDarwin had this.
However, I see no reason why this code would not apply there as well.

- GetProcessInfo, FindProcesses: The implementation was the same in all classes.

- GetFullNameForDylib: This code should apply to all non-darwin
platforms. I've kept the PlatformDarwin override as the situation is
different there.

Reviewers: clayborg, krytarowski, emaste

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D29496

llvm-svn: 294019
2017-02-03 17:42:04 +00:00
Zachary Turner bf9a77305f Move classes from Core -> Utility.
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

llvm-svn: 293941
2017-02-02 21:39:50 +00:00
Pavel Labath fc89bbcc71 Unify PlatformPOSIX::ResolveExecutable
Summary:
various platforms very using nearly identical code for this method. As far as I
can tell there was nothing platform-specific about the differences, but rather
it looked like it was caused by tiny tweaks being made to individual copies
without affecting the overall functionality. I have taken the superset of all
these tweaks and put it into one method in the base class (incidentaly, nobody
was using the base class implementation of the method, as all classes were
overriding it). From the darwin class I took the slightly improved error
reporting (checking whether the file is readable) and the
ResolveExecutableInBundle call (which has no effect elsewhere as the function
is already a no-op on non-darwin platforms). From the linux class I took the
set-the-triple-vendor-to-host-if-unspecified tweak (present in PlatformKalimba
as well).

PlatformWindows has an identical copy as well. We could resolve that by pushing
this code further down into Platform class, that that would require pushing the
m_remote_platform_sp member as well, which seems like a bad design choice.

Reviewers: clayborg, emaste, krytarowski

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D29406

llvm-svn: 293910
2017-02-02 17:50:03 +00:00
Chris Bieneman 81b8f12b42 [CMake] [3/4] Update a batch of plugins
This is extending the updates from r293696 to more LLDB plugins.

llvm-svn: 293700
2017-01-31 22:29:11 +00:00
Zachary Turner a47464b273 Change CreateTarget and dependents to accept StringRef.
llvm-svn: 287376
2016-11-18 20:44:46 +00:00
Zachary Turner c156427ded Don't allow direct access to StreamString's internal buffer.
This is a large API change that removes the two functions from
StreamString that return a std::string& and a const std::string&,
and instead provide one function which returns a StringRef.

Direct access to the underlying buffer violates the concept of
a "stream" which is intended to provide forward only access,
and makes porting to llvm::raw_ostream more difficult in the
future.

Differential Revision: https://reviews.llvm.org/D26698

llvm-svn: 287152
2016-11-16 21:15:24 +00:00
Mehdi Amini c1edf566b9 Prevent at compile time converting from Error::success() to Expected<T>
This would trigger an assertion at runtime otherwise.

Differential Revision: https://reviews.llvm.org/D26482

llvm-svn: 286562
2016-11-11 04:29:25 +00:00
Mehdi Amini 41af43092c Make the Error class constructor protected
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-11-11 04:28:40 +00:00
Kate Stone b9c1b51e45 *** This commit represents a complete reformatting of the LLDB source code
*** 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-09-06 20:57:50 +00:00
Aidan Dodds 933d8db922 Refactor GetSoftwareBreakpointTrapOpcode
This patch aims to reduce the code duplication among all of the platforms in GetSoftwareBreakpointTrapOpcode by pushing all common code into the Platform base class.

Differential Revision: http://reviews.llvm.org/D17395

llvm-svn: 261536
2016-02-22 17:29:56 +00:00
Eugene Zelenko c33088f41e Remove autoconf support from source directories.
Differential revision: http://reviews.llvm.org/D16662

llvm-svn: 259098
2016-01-28 22:05:24 +00:00
Ed Maste d550002c9d Call Platform::SetHostPlatform in the NetBSD platform only on NetBSD
Patch by Kamil Rytarowski

Differential Revision: http://reviews.llvm.org/D14876

llvm-svn: 253699
2015-11-20 19:32:58 +00:00
Eugene Zelenko 222b937c55 Fix Clang-tidy modernize-use-override warnings in source/Plugins/LanguageRuntime and Platform; other minor fixes.
llvm-svn: 251374
2015-10-27 00:45:06 +00:00
Bruce Mitchener ac1cb4fadf Add initial gmake glue for the NetBSD platform
Summary:
These changes aren't everything what is needed for the autotools target, but it's significantly approaching it.

These changes shouldn't effect the build process on other platforms.

Patch by Kamil Rytarowski, thanks!

Reviewers: joerg, brucem

Subscribers: brucem, tberghammer, danalbert, srhines, lldb-commits

Differential Revision: http://reviews.llvm.org/D13715

llvm-svn: 251171
2015-10-24 01:28:24 +00:00
Bruce Mitchener 64f74da568 Add initial CMake glue for the NetBSD platform
Summary:
These changes aren't everything what is needed for the CMake target, but it's significantly approaching it.

These changes shouldn't effect the build process on other platforms.

Patch by Kamil Rytarowski, thanks!

Reviewers: joerg, brucem

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13711

llvm-svn: 251164
2015-10-24 00:27:04 +00:00
Bruce Mitchener 87156d25bc Remove definition of ~PlatformNetBSD(), since its declaration is marked as '= default'
Summary: Local definition of ~PlatformNetBSD() results with a compiler error.

Patch by Kamil Rytarowski. Thanks!

Reviewers: joerg, brucem

Subscribers: brucem, lldb-commits

Differential Revision: http://reviews.llvm.org/D13707

llvm-svn: 250249
2015-10-13 23:22:40 +00:00
Bruce Mitchener 910af4d9dc Preliminary NetBSD support
Summary:
This adds platform code without the cmake/gmake glue to the existing infrastructure.

The missing and incompatibility ptrace(2) bits (existing in FreeBSD) are under active research and development and will be submitted once verified to work.

This code was tested to build and run on NetBSD-current/amd64.

Proper build scripts will be integrated separately as a new commit.

Reviewers: joerg

Subscribers: tfiala, brucem, labath, emaste, lldb-commits

Differential Revision: http://reviews.llvm.org/D13334

llvm-svn: 250146
2015-10-13 05:04:13 +00:00