Commit graph

899 commits

Author SHA1 Message Date
Nico Weber
009c753a12 Playground: Show placeholders for unregistered widgets
With this, Playground can be used to interactively edit e.g.
DisplaySettingsWindow.gml.
2021-01-11 20:12:26 +01:00
Lenny Maiorani
f99d1d3bd7 Vector: Implement find, find_if, find_first_matching in terms of AK::find*
Problem:
- The implementation of `find` is coupled to the implementation of `Vector`.
- `Vector::find` takes the predicate by value which might be expensive.

Solution:
- Decouple the implementation of `find` from `Vector` by using a
  generic `find` algorithm.
- Change the name of `find` with a predicate to `find_if` so that a
  binding reference can be used and the predicate can be forwarded to
  avoid copies.
- Change all the `find(pred)` call sites to use `find_if`.
2021-01-11 19:45:05 +01:00
Andreas Kling
cf3d2411fa UserspaceEmulator: Implement the ftruncate and umask syscalls
It's now possible to copy files with FileManager running in UE. :^)
2021-01-11 12:01:42 +01:00
Andreas Kling
5dafb72370 Kernel+Profiler: Make profiling per-process and without core dumps
This patch merges the profiling functionality in the kernel with the
performance events mechanism. A profiler sample is now just another
perf event, rather than a dedicated thing.

Since perf events were already per-process, this now makes profiling
per-process as well.

Processes with perf events would already write out a perfcore.PID file
to the current directory on death, but since we may want to profile
a process and then let it continue running, recorded perf events can
now be accessed at any time via /proc/PID/perf_events.

This patch also adds information about process memory regions to the
perfcore JSON format. This removes the need to supply a core dump to
the Profiler app for symbolication, and so the "profiler coredump"
mechanism is removed entirely.

There's still a hard limit of 4MB worth of perf events per process,
so this is by no means a perfect final design, but it's a nice step
forward for both simplicity and stability.

Fixes #4848
Fixes #4849
2021-01-11 11:36:00 +01:00
Brendan Coles
b53664a8ef UserspaceEmulator: Implement clock_settime syscall 2021-01-10 18:20:29 +01:00
Andreas Kling
2f3b901f7f AK: Make MappedFile heap-allocated and ref-counted
Let's adapt this class a bit better to how it's actually being used.

Instead of having valid/invalid states and storing an error in case
it's invalid, a MappedFile is now always valid, and the factory
function that creates it will return an OSError if mapping fails.
2021-01-10 16:49:13 +01:00
asynts
019c9eb749 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-09 21:11:09 +01:00
Andreas Kling
b4918bbe2f LibC: Move bzero() and bcopy() per Dr. POSIX 2021-01-09 19:56:59 +01:00
Itamar
4728d0dd6a Profiler: Fix disassembly view to work with shared libraries
Also, update path to kernel image from "boot/kernel" to "boot/Kernel".

Fixes #4555
2021-01-09 10:56:04 +01:00
Itamar
1af2f65df5 Profiler: Use CoreDumpReader::library_containing 2021-01-09 10:56:04 +01:00
Itamar
94db04fc12 HackStudio: Make debugger support shared libraries 2021-01-09 10:55:46 +01:00
Brendan Coles
fc9f79fe01 Profiler: load_from_perfcore_file: handle invalid JSON gracefully 2021-01-09 10:36:40 +01:00
Andreas Kling
6a970611d6 UserspaceEmulator: Fix build after MOVSX shadowing changes 2021-01-08 12:29:46 +01:00
Gal Horowitz
2fd2396d63 UserspaceEmulator: Fix incorrect shadowing on mov sign extend
Unlike zero-extend moves, the upper bytes are not just zeroed,
but rather are based on the sign bit of the source, which means
if the source is tainted, so should the upper bytes be.
2021-01-08 12:17:06 +01:00
Brendan Coles
5c0c4f4b2d Playground: Support opening gml file by path as command line argument 2021-01-05 17:12:54 +01:00
Rok Povsic
b4a783d923 TextEditor+EditingEngine: Add support for the basics of Vim emulation 2021-01-05 00:00:36 +01:00
Andreas Kling
32c319ba81 HackStudio: Make the title bar say "Hack Studio" too.. 2021-01-04 23:59:22 +01:00
Andreas Kling
737504464a HackStudio: The app menu should say "Hack Studio" 2021-01-04 23:55:48 +01:00
Andreas Kling
fedf561f57 Everywhere: Use GUI::CommonActions::make_about_action() 2021-01-04 23:51:49 +01:00
Andreas Kling
f2f4695bdd HackStudio: Correct use of ellipsis (...) in menu items 2021-01-04 23:07:04 +01:00
Brendan Coles
1f03b6ad57 Playground: Add help documentation 2021-01-04 18:50:26 +01:00
Tom
cf89180c35 LibCore: Report error condition when reading process statistics failed 2021-01-03 22:12:19 +01:00
Linus Groh
7b21335caa Playground: Add "Format GML" menu action
This can be invoked via the Edit menu or with Ctrl+Alt+F. If the current
text in the editor can be parsed as valid GML, it will be formatted and
updated, otherwise an alert is shown (no specific error message as those
are only printed to the debug console in the parser for now).
If the source contains comments, which would be lost after formatting,
the user will be notified and has to confirm the action.
2021-01-03 22:12:08 +01:00
AnotherTest
6dbdbec835 Playground: Improve the autocompleted suggestions
- Now sorted
- Add a "layout" property to GUI::Widget and GUI::Frame
- Only complete Layouts for the values of "layout"
- Don't suggest anything if the only suggestion is what the user has
  already typed
2021-01-03 10:47:29 +01:00
Linus Groh
306aff80d0 LibGUI: Remove Widget's unused m_{foreground,background}_color
...as well as the few remaining references to set_foreground_color().

These properties are not being used for rendering anymore, presumably
because they completely mess up theming - assigning random white and
gray backgrounds just doesn't work with dark themes.
I've chosen to not replace most of the few remaining uses of this
broken functionality with custom palette colors (the closest
replacement is background_role) for now (except for Minesweeper where
squares with mines are painted red again now), as no one has actually
complained about them being broken, so it must look somewhat decent
(some just look right anyway). :^)

Examples of this are the taskbar buttons, which apparently had a
DarkGray foreground color for minimized windows once - this has since
been replaced with bold/regular font. Another one is the Profiler's
ProfileTimelineWidget, which is supposed to have a white background -
which it didn't have for quite some time, it's grey now (with the
default theme, that is). Doesn't look bad either.
2021-01-02 23:31:22 +01:00
Andreas Kling
05f5d0dda3 LibGfx: Add Gfx::TextAttributes (and use it in GUI::TextDocumentSpan) 2021-01-02 20:57:43 +01:00
AnotherTest
7785d9715d Playground: Enable automatic autocomplete in the editor
This makes it a bit more useful, as the user doesn't have to explicitly
ask for completion, it just provides completions, and tries really hard
to avoid suggesting things where they're not expected, for instance:
(cursor positions denoted as pipes)
```
@G | {|
    foo: bar |
    foo |
}
```

The user does not expect any suggestions in any of those cursor positions,
so provide no suggestions for such cases. This prevents the automatic autocomplete
getting in the way of the user, esp. when they try to press return fully
expecting to go to a new line.
2021-01-02 11:37:01 +01:00
Linus Groh
7d72168b14 Playground: Use pledge() 2021-01-02 01:49:48 +01:00
Linus Groh
fb7cc4ec46 Playground: Add "Help" menu with "About" action
An application with menubar that's missing an about dialog feels
incomplete! :^)
2021-01-02 01:49:48 +01:00
Andreas Kling
93e82e8459 HackStudio: Use is<T> instead of strcmp on a widget class_name() :^) 2021-01-01 23:02:31 +01:00
Andrew Kaster
744322c247 HackStudio: Call Thread::join instead of pthread_join
It's really awkward that HackStudioWidget was calling the pthread API on
its LibThread::Thread. Change to calling the new Thread::join call,
which returns the information it wants to log.
2021-01-01 23:01:48 +01:00
Andreas Kling
febc8a5ac7 UserspaceEmulator: Remove hand-rolled is_foo() helpers in favor of RTTI 2021-01-01 19:37:36 +01:00
Andreas Kling
865f524d5b AK+LibGUI+LibWeb: Remove AK::TypeTraits in favor of RTTI-based helpers
Now that we have RTTI in userspace, we can do away with all this manual
hackery and use dynamic_cast.

We keep the is<T> and downcast<T> helpers since they still provide good
readability improvements. Note that unlike dynamic_cast<T>, downcast<T>
does not fail in a recoverable way, but will assert if the object being
casted is not a T.
2021-01-01 15:33:30 +01:00
Andrew Kaster
2b3993b008 LibThread: Hide Thread's constructor, as it is a Core::Object
Just constructing one of these guys on the stack willy nilly will leak
the first reference to them. There might be other C_OBJECTs that have
public constructors, seems like a good place for some static analysis
checks :).

Force users to call the construct() method for it.
2020-12-31 21:59:20 +01:00
Andreas Kling
e27d281bf1 UserspaceEmulator: Support sys$mremap()
This makes UE able to run dynamically linked executables once again.
2020-12-31 14:22:56 +01:00
Luke
0f66589007 Everywhere: Fix more typos 2020-12-31 01:47:41 +01:00
Luke
28bad49ed4 DevTools: Add open, save as and quit actions to GML playground 2020-12-31 01:08:58 +01:00
Stephan Unverwerth
b4d1390714 LibGFX: Move default_xxx_font() methods from Font to FontDatabase
When we have an abstract font class it makes no sense to keep
these methods in the Font class.
2020-12-30 20:40:30 +01:00
asynts
7e62ffbc6e AK+Format: Remove TypeErasedFormatParams& from format function. 2020-12-30 20:33:53 +01:00
AnotherTest
7d30692ac2 Playground: Add autocomplete 2020-12-30 12:53:39 +01:00
AnotherTest
20b74e4ede LibGUI+HackStudio: Add an opt-in autocompletion interface to TextEditor
...and use that to implement autocomplete in HackStudio.

Now everyone can have autocomplete :^)
2020-12-30 12:53:39 +01:00
Andreas Kling
7dc5a3ead8 LibGUI: Rewrite layout system in terms of min and max sizes
This patch removes size policies and preferred sizes, and replaces them
with min-size and max-size for each widget.

Box layout now works in 3 passes:

    1) Set all items (widgets/spacers) to their min-size
    2) Distribute remaining space evenly, respecting max-size
    3) Place widgets one after the other, adding spacing in between

I've also added convenience helpers for setting a fixed size (which is
the same as setting min-size and max-size to the same value.)

This significantly reduces the verbosity of widget layout and makes GML
a bit more pleasant to write, too. :^)
2020-12-30 01:36:41 +01:00
Linus Groh
e2e2b2c08e LibELF: Add MemoryRegionInfo::object_name()
We had multiple implementations of this function, and it's a small
helper related to MemoryRegionInfo's region_name, so let's move it
there.
2020-12-29 15:42:30 +01:00
Linus Groh
8ec1da2fca LibCoreDump: CoreDumpReader => CoreDump::Reader
As mentioned in 2d39da5 the usual pattern is that LibFoo provides a Foo
namespace - LibCoreDump doesn't, so this renames CoreDumpReader to
Reader and puts it in the CoreDump namespace. :^)
2020-12-29 15:42:30 +01:00
Linus Groh
f1b596e75e Inspector: unveil("/bin", "r") so it can show app icons 2020-12-29 13:42:21 +01:00
Linus Groh
fe6a312714 Base+Playground: Add app-playground.png 16x16 and 32x32 icons 2020-12-27 18:36:43 +01:00
Linus Groh
dc55fbeb79 Playground: Pre-populate the text editor with some GML
The text editor is now populated with some very basic GML after startup:

    @GUI::Widget {
        layout: @GUI::VerticalBoxLayout {
        }

        // Now add some widgets!
    }

Less typing, less intimidating! :^)
2020-12-27 18:36:43 +01:00
Linus Groh
e955c024b2 LibCore: Add Object::remove_all_children() 2020-12-27 18:36:43 +01:00
Andreas Kling
0e2b7f9c9a Kernel: Remove the per-process icon_id and sys$set_process_icon()
This was a goofy kernel API where you could assign an icon_id (int) to
a process which referred to a global shbuf with a 16x16 icon bitmap
inside it.

Instead of this, programs that want to display a process icon now
retrieve it from the process executable instead.
2020-12-27 01:16:56 +01:00
Andreas Kling
2588b14d38 DevTools: Add a simple GML Playground application :^)
This app allows you to edit GML and see the results live. Pretty cool!
2020-12-26 19:04:46 +01:00