Commit Graph

51 Commits

Author SHA1 Message Date
Nico Weber
fd316728a0 Everywhere: Remove references to UserspaceEmulator 2024-01-29 20:20:55 +00:00
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Sönke Holz
6824d2a788 Userland+Tests: Add initial riscv64 support 2023-11-10 10:30:08 -07:00
kleines Filmröllchen
062e0db46c LibCore: Make MappedFile OwnPtr-based
Since it will become a stream in a little bit, it should behave like all
non-trivial stream classes, who are not primarily intended to have
shared ownership to make closing behavior more predictable. Across all
uses of MappedFile, there is only one use case of shared mapped files in
LibVideo, which now uses the thin SharedMappedFile wrapper.
2023-09-27 03:22:56 +02:00
Ben Wiederhake
0fab68ee16 LibCoredump: Avoid unnecessary conversion to DeprecatedString 2023-05-27 17:30:55 +02:00
Daniel Bertalan
ff2fa72e28 LibCoredump+CrashReporter: Make CrashReporter work on AArch64
This commit implements printing out the AArch64 register file and
generating backtraces. Tested to work on the sshd port.
2023-04-23 14:30:59 +02:00
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Andreas Kling
359d6e7b0b Everywhere: Stop using NonnullOwnPtrVector
Same as NonnullRefPtrVector: weird semantics, questionable benefits.
2023-03-06 23:46:35 +01:00
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Linus Groh
6e7459322d AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and
keeping the more obvious name should flush out more uses of deprecated
strings.
No behavior change.
2023-01-27 20:38:49 +00:00
Sam Atkins
08f932259a LibCoreDump: Replace uses of JsonObject::get_deprecated()/get_ptr() 2023-01-26 09:57:14 -05:00
Tim Schumacher
e62269650a LibDebug: Propagate errors throughout DWARF parsing
Splitting this into a separate commit was an afterthought, so this does
not yet feature any fallible operations.
2023-01-22 19:12:26 +01:00
Andrew Kaster
046c23f567 Kernel+LibC: Move LibC/signal_numbers.h to Kernel/API/POSIX
Make Userland and Tests users just include signal.h, and move Kernel
users to the new API file.
2023-01-21 10:43:59 -07:00
Sam Atkins
1dd6b7f5b7 AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-17 19:52:52 -05:00
Liav A
eca57006f6 LibCoredump: Remove i686 support 2022-12-28 11:53:41 +01:00
Tim Schumacher
f93c7fbb5e LibCompress: Port GzipDecompressor to Core::Stream 2022-12-10 12:05:55 +00:00
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Tim Schumacher
ce2f1b845f Everywhere: Mark dependencies of most targets as PRIVATE
Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
2022-11-01 14:49:09 +00:00
Tim Schumacher
7834e26ddb Everywhere: Explicitly link all binaries against the LibC target
Even though the toolchain implicitly links against -lc, it does not know
where it should get LibC from except for the sysroot. In the case of
Clang this causes it to pick up the LibC stub instead, which might be
slightly outdated and feature missing symbols.

This is currently not an issue that manifests because we pass through
the dependency on LibC and other libraries by accident, which causes
CMake to link against the LibC target (instead of just the library),
and thus points the linker at the build output directory.

Since we are looking to fix that in the upcoming commits, let's make
sure that everything will still be able to find the proper LibC first.
2022-11-01 14:49:09 +00:00
Gunnar Beutner
31bd5b1a02 AK+Userland: Stub out code that isn't currently implemented on AARCH64
Even though this almost certainly wouldn't run properly even if we had
a working kernel for AARCH64 this at least lets us build all the
userland binaries.
2022-10-14 13:01:13 +02:00
Undefine
97cc33ca47 Everywhere: Make the codebase more architecture aware 2022-07-27 21:46:42 +00:00
sin-ack
c8585b77d2 Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack
c70f45ff44 Everywhere: Explicitly specify the size in StringView constructors
This commit moves the length calculations out to be directly on the
StringView users. This is an important step towards the goal of removing
StringView(char const*), as it moves the responsibility of calculating
the size of the string to the user of the StringView (which will prevent
naive uses causing OOB access).
2022-07-12 23:11:35 +02:00
Linus Groh
643faa1144 Everywhere: Fix two inconsistent serenity_lib() output names
- No underscores between word boundaries, i.e. `languageserver` and not
  `language_server` for LibLanguageServer
- All lowercase, i.e. `coredump` and not `Coredump` for LibCoredump
2022-07-03 22:59:13 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
Lenny Maiorani
5c21f963ff Libraries: Use default constructors/destructors in LibX86
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-13 22:34:38 +01:00
Lenny Maiorani
cb87d13dd5 Libraries: Use default constructors/destructors in LibCoredump
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-10 18:04:26 -08:00
Sviatoslav Peleshko
a666140a68 LibCoredump: Respect coredump's LD_LIBRARY_PATH when searching libraries
Previously, we would only resolve libraries from `/usr/lib`, which is
not the only path from which the crashed process could've loaded the
libraries from.
2022-02-14 11:42:19 +01:00
Maciej
6df246091b LibCoredump: Add stack frame entry even if there is no object info
We know the object name and are able to include it. Function name and
source position are still unknown and will just be displayed as "??? ()"
2022-02-04 20:03:47 +01:00
Maciej
394227b2f9 LibCoredump: Fix use-after-free in Backtrace::object_info_for_region()
The first line was creating a StringView object with region name. Then,
if the path didn't start with '/', it had assigned a String made from a
temporary LexicalPath join result.

This fixes the bug that only main executable's frames were displayed.
2022-02-04 20:03:47 +01:00
Ali Mohammad Pur
e72521f286 LibCoredump: Copy out the FooInfo structs to an aligned address
We were handing out unaligned pointers to these, which made UBSAN super
mad, copy them out to avoid that.
2022-01-28 22:51:27 +00:00
Ali Mohammad Pur
e0db9cb876 LibDebug+LibCoredump: Replace remaining reinterpret_casts and C casts
You misused your toys and I'm now taking them away, reflect on what you
did wrong for a bit.
2022-01-28 22:51:27 +00:00
Ali Mohammad Pur
da3c4e5df5 LibDebug+LibCoredump: Use ByteReader to do unaligned reads
The previous solution of "lol whats a UB" was not nice and tripped over
itself when it was run under UBSAN, fix this by doing explicit
byte-by-byte reads where needed.
2022-01-28 22:51:27 +00:00
Ali Mohammad Pur
6d64b13a1b LibDebug+Everywhere: Avoid void* -> FlatPtr -> void* dance
And limit the `void*` to the functions that interface the system (i.e.
ptrace wrappers).
This generally makes the code less riddled with casts.
2022-01-28 22:51:27 +00:00
Sam Atkins
45cf40653a Everywhere: Convert ByteBuffer factory methods from Optional -> ErrorOr
Apologies for the enormous commit, but I don't see a way to split this
up nicely. In the vast majority of cases it's a simple change. A few
extra places can use TRY instead of manual error checking though. :^)
2022-01-24 22:36:09 +01:00
Andreas Kling
58fb3ebf66 LibCore+AK: Move MappedFile from AK to LibCore
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
2021-11-23 11:33:36 +01:00
Itamar
1c0a7cde63 LibCoredump: Add Coredump::Inspector
The coredump Inspector implements the ProcessInspector interface for
a coredump. It is implemented using Coredump::Reader.
2021-11-20 21:22:24 +00:00
Itamar
ac762fbbc3 LibCoredump: Add Reader::for_each_library 2021-11-20 21:22:24 +00:00
Andreas Kling
587f9af960 AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional)
Also add slightly richer parse errors now that we can include a string
literal with returned errors.

This will allow us to use TRY() when working with JSON data.
2021-11-17 00:21:10 +01:00
Andreas Kling
80d4e830a0 Everywhere: Pass AK::ReadonlyBytes by value 2021-11-11 01:27:46 +01:00
Tim Schumacher
80cb44afae Everywhere: Move shared library checks into a common function
While we're at it, unify the various different conditions that are
scattered accross the codebase.
2021-11-10 14:42:49 +01:00
Tim Schumacher
31c634be5a LibCoredump: Restrict library name check when querying symbols
`object_name()` already returns the cleaned library name, and we
currently don't have any libraries with suffixes in /usr/lib, so we can
convert this to an `ends_with()` check.
2021-11-10 14:42:49 +01:00
Daniel Bertalan
3c3df95958 LibCoredump: Show frames from Loader.so if the crash occurs in it
Previously we rejected all entries from Loader.so even if the faulting
address was located in it, i.e. the actual issue was with the dynamic
loader. We no longer do that to make debugging Loader crashes easier.
2021-10-17 17:09:58 +01:00
Daniel Bertalan
1b63c8f3b0 LibCoredump: Accept dynamic libraries with versioned names
Our Clang toolchain uses versioned names for its shared libraries,
meaning that our applications link against `libc++.so.1.0`, not simply
`libc++.so`. Without this change, the LLVM runtime libraries are
excluded from backtraces, which makes debugging toolchain issues harder.
2021-10-17 17:09:58 +01:00
Andreas Kling
784ab75d2d LibCoredump: Don't copy uncompressed coredumps into a ByteBuffer
This was completely unnecessary and accounted for 6% of the total time
spent when loading a WebContent coredump into CrashReporter.
2021-09-22 00:40:07 +02:00
Andreas Kling
f6f9599899 CrashReporter+LibCoredump: Show progress window while loading coredump
Some coredumps take a long time to symbolicate, so let's show a simple
window with a progress bar while they are loading.

I'm not super happy with the factoring of this feature, but it's an
absolutely kickass feature that makes crashing feel 100% more responsive
than before, since you now get GUI feedback almost immediately after a
crash occurs. :^)
2021-09-21 20:52:29 +02:00
Andreas Kling
38b0200151 LibCoredump: Make Backtrace getters return const references 2021-09-21 20:52:29 +02:00
Ali Mohammad Pur
97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00