Commit graph

741 commits

Author SHA1 Message Date
Andreas Kling
be4005cb9e Profiler: Implement "Top functions" feature like Instruments.app has
This view mode takes every stack frame and turns it into a root in the
profile graph. This allows functions that are called from many places
to bubble up to the top. It's a very handy way to discover heavy things
in a profile that are otherwise obscured by having many callers.
2020-10-19 20:08:57 +02:00
Andreas Kling
1d96ecf148 Everywhere: Add missing <AK/TemporaryChange.h> includes
Don't rely on HashTable.h pulling this in.
2020-10-15 23:49:53 +02:00
Paul Scharnofske
d94f674bbb
Use new format functions in remaining DevTools. (#3755)
* AK: Add formatter for JsonValue.

* Inspector: Use new format functions.

* Profiler: Use new format functions.

* UserspaceEmulator: Use new format functions.
2020-10-13 18:34:27 +02:00
asynts
0c5497829e IPCCompiler: Use new SourceGenerator class. 2020-10-12 19:40:49 +02:00
Linus Groh
2d84c0c184 HackStudio: Fix running JavaScript files
s/String::format/String::formatted/ - the command was not being
formatted properly.
2020-10-10 00:53:09 +02:00
asynts
7c4fb2b804 HackStudio: Use new format functions. 2020-10-09 20:52:17 +02:00
Linus Groh
b797de3adf HackStudio: Replace InProcessWebView with OutOfProcessWebView 2020-10-08 23:20:52 +02:00
Andreas Kling
f31ff86d14 IPCCompiler: Declare nested namespaces with a single "namespace" 2020-10-05 21:29:06 +02:00
AnotherTest
6b55b007dd HackStudio: Add a Shell language server 2020-10-04 23:12:28 +02:00
AnotherTest
34039d6639 HackStudio: Do not change the cursor in the LSP autocomplete request
The C++ completion somehow depends on this, so move that behaviour into
the C++ language server instead.
2020-10-04 23:12:28 +02:00
AnotherTest
9e73b0b696 HackStudio: Relay completions requests to the language server unfiltered
Previously, the client would decide when to ask the server for
completions, and it would only do so for identifiers that had spans
(determined via the highlighter!).
Swap this around and make the server decide if it wants to complete
something.
This commit also adds a CompletionKind (which only has one value:
Identifier), to work with other kinds of completions as well.
2020-10-04 23:12:28 +02:00
asynts
e089855af0 UserspaceEmulator: Remove remaining printf calls. 2020-10-04 17:04:55 +02:00
asynts
d5ffb51a83 AK: Don't add newline for outf/dbgf/warnf.
In the future all (normal) output should be written by any of the
following functions:

    out    (currently called new_out)
    outln
    dbg    (currently called new_dbg)
    dbgln
    warn   (currently called new_warn)
    warnln

However, there are still a ton of uses of the old out/warn/dbg in the
code base so the new functions are called new_out/new_warn/new_dbg. I am
going to rename them as soon as all the other usages are gone (this
might take a while.)

I also added raw_out/raw_dbg/raw_warn which don't do any escaping,
this should be useful if no formatting is required and if the input
contains tons of curly braces. (I am not entirely sure if this function
will stay, but I am adding it for now.)
2020-10-04 17:04:55 +02:00
Linus Groh
bcfc6f0c57 Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
asynts
6351a56d27 AK+Format: Do some housekeeping in the format implementation. 2020-10-02 20:48:19 +02:00
AnotherTest
ac5e08a541 HackStudio: Abstract away language-server details
This commit moves all the logic that deals with the language server
(from HackStudio) into a LanguageClient class, provides some functions
to make constructing them easier, and makes all language servers use a
singular IPC definition.
Also fixes the FIXME about making the autocompletion async.
This makes adding language servers in the future significantly less
duplicate-y, and significantly easier :^)
2020-10-02 20:47:57 +02:00
asynts
ba3488a6d5 UserspaceEmulator: Replace printf usages with format.
This replaces almost all usages. Some have to remain because 'outf'
always appends a newline. (It inherits this behaviour from LogStream.)
2020-10-02 13:44:42 +02:00
Andreas Kling
0245e0f03a DevTools: Remove VisualBuilder and FormCompiler
This functionality is being moved to HackStudio so let's not confuse
people by keeping the old stuff around.
2020-10-01 21:07:12 +02:00
Itamar
a39c4cc340 HackStudio: Integrate with C++ Language Server
Editors now communicate with the c++ language server when openning and
editing c++ source files, and go through the language server to get
autocomplete suggestions.
2020-09-30 21:46:59 +02:00
Itamar
863f14788f HackStudio: Add C++ Language Server
The language server keeps track of the content of currently edited
files by receiving updates about edit actions.

Also, C++ autocompletion is no longer tied to HackStudio itself and
moved to be part of the language server.
2020-09-30 21:46:59 +02:00
Itamar
bf53d7ff64 LibCpp: Add library for working with c++ code
Moved the C++ Lexer we have from LibGUI to here, so that other
components could use it without linking with LibGUI.
2020-09-30 21:46:59 +02:00
AnotherTest
c1fc27cab2 HackStudio+TextEditor: Add the Shell syntax highlighter 2020-09-30 20:05:24 +02:00
Andreas Kling
709581e141 UserspaceEmulator: Implement the getsid() syscall 2020-09-28 23:34:55 +02:00
Itamar
8af67210cf HackStudio: Detach from debugged process before terminating
Fixes #3308
2020-09-26 17:18:21 +02:00
Itamar
6c73fdf8d1 HackStudio: Fix FormEditor widget icons loading
Previously, when resolving the paths for the FormEditor widget icons
we didn't take into the account that calling class_name() returns the
widget name with a "GUI::" prefix.

Also, we now skip over widgets that we don't have an icon for.
2020-09-26 17:18:21 +02:00
Andreas Kling
9bcc168b9b Inspector: Move everything into the Inspector namespace 2020-09-25 21:18:41 +02:00
Ben Wiederhake
64cc3f51d0 Meta+Kernel: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Ben Wiederhake
25488ddcad Meta+DevTools: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Maciej Zygmanowski
53f3313cee UserspaceEmulator: Use Core::ArgsParser 2020-09-24 20:24:12 +02:00
Andreas Kling
60c2fba9b9 UserspaceEmulator+LibX86: Clean up some obnoxious template spam
Don't require clients to templatize modrm().read{8,16,32,64}() with
the ValueWithShadow type when we can figure it out automatically.
The main complication here is that ValueWithShadow is a UE concept
while the MemoryOrRegisterReference inlines exist at the lower LibX86
layer and so doesn't have direct access to those types. But that's
nothing we can't solve with some simple template trickery. :^)
2020-09-23 21:15:01 +02:00
Nico Weber
993ceb66fd UserspaceEmulator: Fix off-by-one in code cache access
m_cached_code_end points at the first invalid byte, so we need to
update the cache if the last byte we want to read points at the
end or past it.  Previously we updated the cache 1 byte prematurely in
read16, read32, read64 (but not in read8).

Noticed by reading the code (the code looked different from read8() and
the other 3).  I didn't find anything that actually hit this case.
2020-09-23 21:00:28 +02:00
Nico Weber
f1c0f661f4
UserspaceEmulator+LibX86: Add support for 64-bit memory reads and writes (#3584)
This is useful for reading and writing doubles for #3329.
It is also useful for emulating 64-bit binaries.

MemoryOrRegisterReference assumes that 64-bit values are always
memory references since that's enough for fpu support. If we
ever want to emulate 64-bit binaries, that part will need minor
updating.
2020-09-23 20:45:43 +02:00
Itamar
b7bd2ed9d2 HackStudio: Add auto-complete capability to the Editor 2020-09-21 20:16:03 +02:00
Itamar
7d6e6eb268 HackStudio: Add AutoCompleteBox
Can be used to display the list of autocomplete suggestions and apply
a suggestion that was chosen by the user.
2020-09-21 20:16:03 +02:00
Itamar
42bdcf1828 HackStudio: Basic C++ autocomplete logic
CppAutoComplete gets a string of code and a position within it, and
returns a Vector of auto-complete suggestions that are relevant for the
given position.

Currently, it's very naive - it uses our CppLexer to find identifiers
in the code which the auto-complete target is a prefix of.
2020-09-21 20:16:03 +02:00
asynts
c879ecf509 LibIPC: Use InputMemoryStream instead of BufferStream. 2020-09-21 09:37:49 +02:00
Itamar
e3e5e57fde HackStudio: Move bulk of GUI logic into HackStudioWidget
Previously, the GUI logic of HackStudio was all stuffed into main(),
and it started getting a bit out of hand :)
2020-09-19 21:39:05 +02:00
Nico Weber
31e7f73aae UserspaceEmulator: Support all msg_iovlens in recvmsg and sendmsg
The kernel doesn't support msg_iovlens != 1 yet and nothing passes
an amount != 1, but if anyone ever adds support for this they won't
have to worry about ue at least.
2020-09-19 00:39:05 +02:00
Itamar
b82a254da0 HackStudio: Only refresh Git widget on save if initialized 2020-09-18 15:20:55 +02:00
Nico Weber
47b3e98af8 Kernel+LibC+UserspaceEmulator: Add SO_TIMESTAMP, and cmsg definitions
When SO_TIMESTAMP is set as an option on a SOCK_DGRAM socket, then
recvmsg() will return a SCM_TIMESTAMP control message that
contains a struct timeval with the system time that was current
when the socket was received.
2020-09-17 17:23:01 +02:00
Nico Weber
b36a2d6686 Kernel+LibC+UserspaceEmulator: Mostly add recvmsg(), sendmsg()
The implementation only supports a single iovec for now.
Some might say having more than one iovec is the main point of
recvmsg() and sendmsg(), but I'm interested in the control message
bits.
2020-09-17 17:23:01 +02:00
asynts
f1b1a78f26 Userland: Use find_executable_in_path in UserspaceEmulator. 2020-09-16 19:39:17 +02:00
Nico Weber
62f615f0f4 UsespaceEmulator: Fix minor bugs in recvfrom() interception
* Pass the correct source address for copying tine addr_length.
  Previously, this was broken when addr_length was non-nullptr.

* Copy min(sizeof(address), address_length) bytes into address,
  instead of sizeof(address), which might be larger than the
  user buffer.

* Use sockaddr_storage instead of sockaddr_un. In practice they're
  both the same size, but this is what sockaddr_storage is for.

With this (in particular, the first fix), `ue /bin/ntpquery`
actually gets past the recvfrom() call :^)
2020-09-15 23:29:51 +02:00
Nico Weber
f0018aca1d UserspaceEmulator: Intercept sendto()
With this, `ue /bin/ntpquery` can be used to test sendto() and
recvfrom() in ue. (It eventually hits an unimplemented FILD_RM64,
but not before doing emulated network i/o and printing response
details.)
2020-09-15 23:29:51 +02:00
Itamar
1e96e46a81 HackStudio: Refresh the Git widget state on file save 2020-09-15 21:43:29 +02:00
Itamar
d1eedd0e9f HackStudio: View unstaged diffs in files with DiffViewer 2020-09-15 21:43:29 +02:00
Itamar
ba11082b4b HackStudio: Add functionality to GitRepo object
Added functionality for:
- Original files contents (without the current changes)
- Unstaged diffs
- Checking whether a file is tracked
2020-09-15 21:43:29 +02:00
Itamar
8306a84967 HackStudio: Add DiffViewer widget
This widget presents a diff in a nice graphical way, side by side.
2020-09-15 21:43:29 +02:00
Itamar
7c70183f3f HackStudio: Make the actions tab visible when using the form editor
Previously, the strucutre of the HackStudio widgets made it so the
actions tab would be hidden when the "edit mode" was something other
than EditMode::Text (for example, when using the form editor).
2020-09-15 21:43:29 +02:00
Itamar
dac7db830a HackStudio: Fix "Add new Editor" action 2020-09-15 21:43:29 +02:00