Commit Graph

97 Commits

Author SHA1 Message Date
Itamar
74070ef74d HackStudio: Map connections to langauge-servers by language name
HackStudio keeps a map that stores the different ServerConnection
instances we have open.

Previously, that map was indexed by a project's root path.
This did not make much sense because we only support opening a single
project with each instance of the HackStudio program.

We now index the different ServerConnections by the language name, which
allows us to support talking to multiple language-servers in the same
project (e.g C++ and Shell).

This also fixes an issue where if you first opened a Shell file, and
then a C++ file in the same project, then C++ language-server features
would not work.
2021-03-06 09:40:33 +01:00
Itamar
3f0ace6670 LanguageServers/Cpp: Allow the creation of DocumentData objects to fail
This fixes langauge-server crashes when trying to parse non-existant
header files, such as #include <new>.
Closes #5569.
2021-03-06 09:40:33 +01:00
Linus Groh
50ea0c3500 Profiler: Get perfcore file from ArgsParser
Fixes #5641.
2021-03-05 09:52:22 +01:00
Andreas Kling
1208fc7d37 AK: Simplify Bitmap and implement in terms of BitmapView
Add Bitmap::view() and forward most of the calls to BitmapView since
the code was identical.

Bitmap is now primarily concerned with its dynamically allocated
backing store and BitmapView deals with the rest.
2021-03-04 11:25:45 +01:00
AnotherTest
e59a631511 HackStudio/LanguageServers: Move some components out of Cpp
This makes them available for use by other language servers.
Also as a bonus, update the Shell language server to discover some
symbols and add go-to-definition functionality :^)
2021-03-04 11:21:43 +01:00
Andreas Kling
373a595c56 Profiler: Symbolicate addresses in non-PIE ELF objects
This is a little bit messy, but basically if an ELF object is non-PIE,
we have to account for the executable mapping being at a hard-coded
offset and subtract that when doing symbolication.

There's probably a nicer way to solve this, I just hacked this together
so we can see "cc1plus" and friends in profiles. :^)
2021-03-03 23:13:26 +01:00
Andreas Kling
0fc3983c8d Profiler: Cache and reuse mapped ELF objects
In multi-process profiles, the same ELF objects tend to occur many
times (everyone has libc.so for example) so we will quickly run out
of VM if we map each object once per process that uses it.

Fix this by adding a "mapped object cache" that maps the path of
an ELF object to a cached memory mapping and wrapping ELF::Image.
2021-03-03 22:57:45 +01:00
Bui Quang Minh
faed0e63dc HackStudio: Allow multi-selection in project view tree 2021-03-03 21:59:22 +01:00
Andreas Kling
5e7abea31e Kernel+Profiler: Capture metadata about all profiled processes
The perfcore file format was previously limited to a single process
since the pid/executable/regions data was top-level in the JSON.

This patch moves the process-specific data into a top-level array
named "processes" and we now add entries for each process that has
been sampled during the profile run.

This makes it possible to see samples from multiple threads when
viewing a perfcore file with Profiler. This is extremely cool! :^)
2021-03-02 22:38:06 +01:00
Bui Quang Minh
ee7c8fbd7b HackStudio: Implement removing file from disk 2021-03-02 14:45:18 +01:00
Itamar
05c48cc8d8 LanguageServers/Cpp: Fix nullptr dereference in ~LanguageClient
The WeakPtr to the ServerConnection is nullified if the server crashes.

Closes #5570.
2021-03-02 13:37:26 +01:00
Itamar
17e6287333 LanguageServers/Cpp: Fix typo 2021-03-02 12:50:37 +01:00
Brian Gianforcaro
007b6edce4 Profiler: Print addresses as pointers in new Samples view
The previous formatting was missing the "0x" prefix.
2021-03-01 11:12:53 +01:00
thislooksfun
225baa3cb7 Profiler: remove unimplemented Profile::LibraryMetadata::symbolicate() definition
The implementation of Profile::LibraryMetadata::symbolicate() was
removed in 340180ba05, but the
corresponding public declaration was not.
2021-02-28 15:28:08 +01:00
Andreas Kling
1fb1279cfd Profiler: Add a new "Samples" view to the main UI
You can now view the individual samples in a profile one by one with
the new "Samples" view. The "old" main view moves into a "Call Tree"
tab (but it remains the default view.)

When you select a sample in the samples view, we show you the full
symbolicated backtrace in a separate view on the right hand side. :^)
2021-02-27 18:34:21 +01:00
Andreas Kling
2c1f71055f LibVT: Put TerminalWidget in the VT namespace :^) 2021-02-27 17:49:08 +01:00
Andreas Kling
340180ba05 Profiler: Move ELF object name to its own profile graph column
This way you don't have to look at all the library names if you don't
want to. Since we're pretty good about namespacing our things, the
library names are slightly redundant information.
2021-02-27 17:45:41 +01:00
Andreas Kling
2f0ea9ae33 Profiler: Unbreak DisassemblyModel after shared library introduction
This was failing to take the library base address into account when
tallying up the samples at each instruction.
2021-02-27 17:26:57 +01:00
Itamar
54bc9114b3 HackStudio: Support searching symbol declarations in the Locator
The Locator now keeps a cache of the declared symbol in a document.
The language client updates that cache whenever it gets an update from
the language server about declared symbols.

This allows searching for symbol declarations in the Locator, in
addition to file names.

Closes #5478
2021-02-27 16:37:35 +01:00
Itamar
a94b5376bc LanguageServers/Cpp: Update client asynchronously about symbols
As a document is parsed, the language server updates the client
asynchronously about symbol declarations it finds.
2021-02-27 16:37:35 +01:00
Itamar
71c7597130 LanguageServers/Cpp: Add type to Declarations 2021-02-27 16:37:35 +01:00
Itamar
4b483071fb LanguageServers: Add ProjectLoaction, Declaration types and use in IPC
With this we can avoid passing (name, line, column) tuples in many
different places.
2021-02-27 16:37:35 +01:00
Itamar
e20cd1d8db LanguageServers/Cpp: Don't VERIFY that a file could be found
... when creating a new DocumentData
2021-02-26 21:14:41 +01:00
Linus Groh
e265054c12 Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes
This is basically just for consistency, it's quite strange to see
multiple AK container types next to each other, some with and some
without the namespace prefix - we're 'using AK::Foo;' a lot and should
leverage that. :^)
2021-02-26 16:59:56 +01:00
thankyouverycool
885c17b583 HackStudio: Set correct icons, text and location in menus
Adds correct icon to New Project, moves Wrapping Mode to more
traditional View, and truncates overly verbose Project entries
2021-02-26 13:50:00 +01:00
Brendan Coles
0ffc06b795 Profiler: Add help documentation 2021-02-24 20:40:00 +01:00
Sahan Fernando
bf68939bcc Profiler: Make sure rendered timestamps don't overflow
If you drag-select a slice of the profile off of the side of the
Profiler window, the profiler will try to render a negative start time,
which will overflow. This commit fixes that bug by clamping timestamps
to the start/end of the profile before rendering.
2021-02-24 12:19:01 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
AnotherTest
29c8d34be7 HackStudio: Fix a misuse of dbgln() intended as dbgln_if()
This currently works accidentally, just because there's an overload for
`dbgln<bool>(...)` - it just bypasses the compiletime checks.
2021-02-23 13:59:33 +01:00
AnotherTest
1c4e15117d UserspaceEmulator: Fix an outln() format bug 2021-02-23 13:59:33 +01:00
Brendan Coles
501834ba45 Inspector: Add help documentation 2021-02-23 13:52:16 +01:00
Ivan Hansgaard Hansen
c9cd96894b
HackStudio: Fix opened files appearing empty (#5480)
When files where placed in outside of the project root, they would
appear empty because the label in the tree would differ from the
actual file path relative to the root.

Fixes #5471.
2021-02-22 23:00:57 +01:00
Itamar
5bc82c0185 LanguageServers/Cpp: Add 'FindDeclaration' capability
The C++ LanguageServer can now find the matching declaration for
variable names, function calls, struct/class types and properties.

When clicking on one of the above with Ctrl pressed, HackStudio will
ask the language server to find a matching declaration, and navigate
to the result in the Editor. :^)
2021-02-20 15:53:37 +01:00
Itamar
d3ff82ba80 LibCpp: Store filename in ASTNodes
As part of the position information, we now also store the filename the
ASTNode belongs to.
2021-02-20 15:53:37 +01:00
Itamar
c4139be461 HackStudio: Always use relative paths when opening project files 2021-02-20 15:53:37 +01:00
Itamar
50f887c9d5 HackStudio: Display identifiers as clickable
This extends the "navigate to include" feature to also display
identifiers as clickable when they're hovered over while left control
is pressed.
2021-02-20 15:53:37 +01:00
Linus Groh
3583b62ad3 LibGUI: Swap order of InputBox value and parent window args
This is now consistent with the other dialog classes.
2021-02-20 12:19:46 +01:00
Andreas Kling
4f0be55770 LibGUI: Remove GUI::FilePicker::file_exists()
I have no idea why this existed but everyone should just use
Core::File::exists() instead. :^)
2021-02-19 23:46:54 +01:00
Andreas Kling
781d29a337 Kernel+Userland: Give sys$recvfd() an options argument for O_CLOEXEC
@bugaevc pointed out that we shouldn't be setting this flag in
userspace, and he's right of course.
2021-02-14 10:39:48 +01:00
Itamar
c2e5bc442d LanguageServers/cpp: Use parser-based autocomplete engine by default 2021-02-13 19:50:09 +01:00
Itamar
715933ce8b HackStudio: Handle crash of the LanguageServer gracefully
Previously, HackStudio exited whenever a LanguageServer crashed.

Now, we disconnect all clients from that language server instance and
show a nice notification.
2021-02-13 19:50:09 +01:00
Itamar
2da5ecba41 LanguageServers/Cpp: Handle autocomplete request on an empty line 2021-02-13 19:50:09 +01:00
Itamar
18a9b66f10 HackStudio: Set icon for 'make is not available' notification 2021-02-13 19:50:09 +01:00
Nick Vella
b671577223 HackStudio: Project templates and New Project dialog
This commit adds a simple project template system to HackStudio,
as well as a pretty New Project dialog, inspired by early VS.NET
and MS Office.
2021-02-13 19:49:30 +01:00
Itamar
ef9bfbd383 LanguageServers/Cpp: Autocomplete declarations from included headers
We now also look at the available declarations from included header
files when autocompleting names.

Additionally, you can now request autocomplete on an empty token, which
brings up all available names, starting from the inner-most scope.
2021-02-10 23:09:40 +01:00
Itamar
64c80f6ea4 LanguageServers/Cpp: Autocomplete function and struct/class names 2021-02-10 23:09:40 +01:00
Itamar
e42b9e879c HackStudio: Show notification if 'make' is not available
We previously popped a MessageBox for this, but a notification is less
disruptive.
2021-02-10 23:04:54 +01:00
Itamar
72fdab7bfb LanguageServers/Cpp: ParserAutoComplete engine inspects header files
... and performs preprocessing on the source code before parsing.

To support this, we are now able to keep track of multiple
files in the autocomplete engine. We re-parse a file whenever it is
edited.
2021-02-08 23:10:38 +01:00
Itamar
02038a0ede LanguageServers/Cpp: Use FileDB and AutoCompleteEngine base class 2021-02-08 23:10:38 +01:00
Itamar
bed06b13f3 LanguageServers/Cpp: Add FileDB and pass project_root in Greet()
FileDB wraps the access to the contents of project files.

When asked to fetch a file, FileDB will either return its in-memory
model of the file if it has been "opened" by the language-server
protocol, or otherwise fetch it from the filesystem.

Previously, the cpp language server did not pledge "rpath" and got
access to the contents of files whenever they were opened by the
language client.
However, features like inspection of header files require the language
server to get the content of files that were not opened by the client.

The language server now pledges rpath but makes sure to only unveil
the project's directory and /usr/include.
2021-02-08 23:10:38 +01:00