Commit Graph

23 Commits

Author SHA1 Message Date
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
Michal Gorny 2819136f0a [lldb] Add missing EINTR handling
Differential Revision: https://reviews.llvm.org/D59606

llvm-svn: 356703
2019-03-21 19:35:55 +00:00
Jorge Gorbe Moya 717b1c804b [lldb-vscode] Fix dangling pointer in request_evaluate.
SBError::GetCString() returns a pointer to a string owned by the SBError
object. The code here was calling GetCString on a temporary and using
the returned pointer after the temporary was destroyed.

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

llvm-svn: 356227
2019-03-15 01:46:50 +00:00
Jorge Gorbe Moya d383a342aa [lldb-vscode] Don't try to launch an invalid program.
If an invalid program is specified, lldb-vscode will send back a
response with "success" = false, but then will continue executing the
rest of request_launch(), try to launch the program anyway and try to
send another response (possibly using the `response` object after it was
moved).

This change adds a return statement so we stop executing the handler
after producing the first failing response.

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

llvm-svn: 356110
2019-03-13 23:50:35 +00:00
Adrian Prantl f05b42e960 Bring Doxygen comment syntax in sync with LLVM coding style.
This changes '@' prefix to '\'.

llvm-svn: 355841
2019-03-11 17:09:29 +00:00
Jonas Devlieghere fee5576f7c [lldb-vscode] Fix warning
I changed the variable to an unsigned to get rid of a signed and
unsigned compare without realizing the value could be negative. This
fixes the assert instead.

llvm-svn: 355708
2019-03-08 17:36:54 +00:00
Zachary Turner 7e89b3cc17 [lldb-vscode] Report an error if an invalid program is specified.
Previously if an invalid program was specified, there was a bug
which, when we attempted to launch the program, would report that
the operation succeeded, causing LLDB to then hang while waiting
indefinitely to receive some events from the process.

After this patch, when an invalid program is specified, we immediately
return to vs code with an error message that indicates that the
program can not be found.

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

llvm-svn: 355656
2019-03-08 00:11:27 +00:00
Jonas Devlieghere 8d359c147d Make bytes_read an unsigned
llvm-svn: 355651
2019-03-07 22:59:55 +00:00
Jonas Devlieghere 4e7301ecf2 Remove unused function
llvm-svn: 355650
2019-03-07 22:58:39 +00:00
Zachary Turner 29e8754172 [lldb-vscode] Support running in server mode on Windows.
Windows can't use standard i/o system calls such as read and write
to work with sockets, it instead needs to use the specific send
and recv calls.  This complicates matters for the debug adapter,
since it needs to be able to work in both server mode where it
communicates over a socket, as well as non-server mode where it
communicates via stdin and stdout.  To abstract this out, I've
introduced a class IOStream which hides all these details and
exposes a read/write interface that does the right on each
platform.

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

llvm-svn: 355637
2019-03-07 21:23:21 +00:00
Zachary Turner 3229000f63 [lldb-vscode] Correctly propagate errors back to VS Code.
llvm-svn: 355557
2019-03-06 22:30:06 +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
Stefan Granitz 5d005a856d [CMake] Revised RPATH handling
Summary:
If we build LLDB.framework, dependant tools need appropriate RPATHs in both locations, the build-tree (for testing) and the install-tree (for deployment). Luckily, CMake can handle it for us: https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling.

* In the build-tree, tools use the absolute path to the framework's actual output location.
* In the install-tree, tools get a list of RPATHs to look for the framework when deployed.

`LLDB_FRAMEWORK_INSTALL_DIR` is added to the `CMAKE_INSTALL_PREFIX` to change the relative location of LLDB.framework in the install-tree.
If it is not empty, it will be added as an additional RPATH to all dependant tools (so they are functional in the install-tree).
If it is empty, LLDB.framework goes to the root and tools will not be functional in the directory structure of the LLVM install-tree.
For historical reasons `LLDB_FRAMEWORK_INSTALL_DIR` defaults to "Library/Frameworks".

Reviewers: xiaobai, JDevlieghere, aprantl, clayborg

Reviewed By: JDevlieghere

Subscribers: ki.stfu, mgorny, lldb-commits, #lldb

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

llvm-svn: 350392
2019-01-04 12:46: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
Nathan Lanza a0d52cbdc9 Add a check whether or not a str is utf8 prior to emplacing
Summary:
Highlighing junk data on VSCode can send a query for evaluate which
fails. In particular cases on Windows, this the error message can end
up as a c-string of [-35,-35,-35,-35,...]. Attempting to emplace this
as the error message causes an assert failure.

Prior to emplacing the error message, confirm that it is valid UTF8 to
eliminate errors such as mentione above.

Reviewers: xiaobai, clayborg

Reviewed By: clayborg

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

llvm-svn: 346988
2018-11-15 19:49:57 +00:00
Nathan Lanza 067cc509d0 Adjust some id bit shifts to fit inside 32 bit integers
Summary:
The DAP on vscode uses a JavaScript `number` for identifiers while the
Visual Studio version uses a C# `Int` for identifiers. lldb-vscode is
bit shifting identifiers 32 bits and then bitwise ORing another 32 bit
identifier into a 64 bit id to form a unique ID. Change this to
a a partitioning of the 32 bits that makes sense for the data types.

Reviewers: clayborg

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

llvm-svn: 346346
2018-11-07 19:27:36 +00:00
Nathan Lanza 8b73fa61d1 Adjust the comment section of CreateSource to account for lines longer than 60
Summary:
On rare occasions, the address, instruction and arguments of a line of
assembly in the CreateSource printout would reach > 60 characters. The
function would integer overflow and try to indent a line by `0xfff...`.

Change the calculated offset to be the maximum of 60 or
`line_strm.str().size()`

Reviewers: clayborg, xiaobai

Reviewed By: clayborg

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

llvm-svn: 346179
2018-11-05 22:55:30 +00:00
Nathan Lanza c61ee1bd04 Set stdout/stdin to binary mode on Windows
Summary:
A file opened in text mode on Windows will have `\n` automatically changed to `13,10` while Darwin and Linux leave it as `10`.

Set the file to binary mode to avoid this automatic conversion so that Darwin, Linux and Windows have equivalent treatment of `\r`.

Reviewers: clayborg, xiaobai

Reviewed By: clayborg

Subscribers: emaste, ki.stfu, mgorny, eraman, JDevlieghere, mgrang

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

llvm-svn: 346174
2018-11-05 22:25:00 +00:00
Bruce Mitchener 173946dca6 Fix typos.
Reviewers: lldb-commits

Subscribers: srhines, ki.stfu

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

llvm-svn: 343825
2018-10-04 22:33:39 +00:00
Alex Langford fde4cda9f7 Fix lldb-vscode README.md
Summary: The readme was missing "-" characters to enable links

Patch by Nathan Lanza <nathan@lanza.io>

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

llvm-svn: 342266
2018-09-14 19:41:20 +00:00
Greg Clayton ada3f77e44 Update the Core file loading instructions so they keep the process stopped after attaching to a core file.
llvm-svn: 339954
2018-08-16 22:13:01 +00:00
Reid Kleckner 8b5e6991d2 Fix lldb-vscode build on Windows
Include PosixAPI.h to get a PATH_MAX definition and replace CreateEvent
with CreateEventObject to avoid conflicts with the windows.h definition
of CreateEvent to CreateEventW.

llvm-svn: 339920
2018-08-16 18:24:59 +00:00
Greg Clayton 2f5cf8511a Add a new tool named "lldb-vscode" that implements the Visual Studio Code Debug Adaptor Protocol
This patch adds a new lldb-vscode tool that speaks the Microsoft Visual Studio Code debug adaptor protocol. It has full unit tests that test all packets.

This tool can be easily packaged up into a native extension and used with Visual Studio Code, and it can also be used by Nuclide

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

llvm-svn: 339911
2018-08-16 17:59:38 +00:00