Commit graph

877 commits

Author SHA1 Message Date
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
Itamar
f300b81648 HackStudio: Add "commit" and "refresh" actions to Git widget 2020-09-15 21:43:29 +02:00
Itamar
435c6c6f96 HackStudio: Add basic Git integration
This adds a "Git" tab to Hackstudio.
Currently has support for staging and unstaging files.
2020-09-15 21:43:29 +02:00
Andreas Kling
ad7030ce4a HackStudio: Tighten some unnecessarily broad lambda captures 2020-09-13 21:52:37 +02:00
Tom
c8d9f1b9c9 Kernel: Make copy_to/from_user safe and remove unnecessary checks
Since the CPU already does almost all necessary validation steps
for us, we don't really need to attempt to do this. Doing it
ourselves doesn't really work very reliably, because we'd have to
account for other processors modifying virtual memory, and we'd
have to account for e.g. pages not being able to be allocated
due to insufficient resources.

So change the copy_to/from_user (and associated helper functions)
to use the new safe_memcpy, which will return whether it succeeded
or not. The only manual validation step needed (which the CPU
can't perform for us) is making sure the pointers provided by user
mode aren't pointing to kernel mappings.

To make it easier to read/write from/to either kernel or user mode
data add the UserOrKernelBuffer helper class, which will internally
either use copy_from/to_user or directly memcpy, or pass the data
through directly using a temporary buffer on the stack.

Last but not least we need to keep syscall params trivial as we
need to copy them from/to user mode using copy_from/to_user.
2020-09-13 21:19:15 +02:00
Ben Wiederhake
04e3122526 HackStudio: Reduce debug spam 2020-09-12 13:46:15 +02:00
Andreas Kling
dbd2fa8b8f HackStudio: Use widget override cursors 2020-09-11 16:06:00 +02:00
Andreas Kling
b4f307f982 LibGUI+WindowServer: Rename window "override cursor" to just "cursor"
Let's just say each window has a cursor, there's not really overriding
going on.
2020-09-11 14:26:37 +02:00
Andreas Kling
0f9be82826 LibGfx: Move StandardCursor enum to LibGfx
This enum existed both in LibGUI and WindowServer which was silly and
error-prone.
2020-09-10 19:25:13 +02:00
Andreas Kling
f8e59addf7 Kernel+LibC+UE: Introduce SIGINFO (generated with ^T)
This signal is ignored by default, but can be caught to implement state
reporting a la BSD. :^)
2020-09-09 21:10:23 +02:00
thankyouverycool
60872a7c5a DevTools+Apps: Set correct icons for ThemeEditor and VisualBuilder
VB appears deprecated in favor of HackStudio, but until it's
officially gone-no app left behind!
2020-08-31 09:14:18 +02:00
Nico Weber
4b5cfce6b1 UserspaceEmulator: Emulate two FPU instructions! 2020-08-30 19:48:59 +02:00
Luke
5fd88e51c5 HackStudio: Highlight register changes, minor disassembly view fix
Also adds shortcuts for step in (F11), step out (Shift-F11) and
step over (F10).
2020-08-30 17:31:33 +02:00
Andreas Kling
57dd3b66c5 Kernel+LibC+UE: Implement sleep() via sys$clock_nanosleep()
This doesn't need to be its own syscall either. :^)
2020-08-30 13:21:24 +02:00
Andreas Kling
f857f3ce4c Kernel+LibC+UE: Implement usleep() via sys$clock_nanosleep()
This doesn't need to be its own syscall. Thanks @BenWiederhake for
the idea. :^)
2020-08-30 10:45:51 +02:00