Age | Commit message (Collapse) | Author |
|
C++20 can automatically synthesize `operator!=` from `operator==`, so
there is no point in writing such functions by hand if all they do is
call through to `operator==`.
This fixes a compile error with compilers that implement P2468 (Clang
16 currently). This paper restores the C++17 behavior that if both
`T::operator==(U)` and `T::operator!=(U)` exist, `U == T` won't be
rewritten in reverse to call `T::operator==(U)`. Removing `!=` operators
makes the rewriting possible again.
See https://reviews.llvm.org/D134529#3853062
|
|
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.
|
|
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.
|
|
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.
|
|
Doesn't use them in libc headers so that those don't have to pull in
AK/Platform.h.
AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is
defined in clang builds as well.) Using AK_COMPILER_GCC simplifies
things some.
AK_COMPILER_CLANG isn't as much of a win, other than that it's
consistent with AK_COMPILER_GCC.
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
Previously this caused a crash when no breakpoint was active since we
tried to get value().address before the has_value() check.
|
|
|
|
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."
|
|
You misused your toys and I'm now taking them away, reflect on what you
did wrong for a bit.
|
|
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.
|
|
And limit the `void*` to the functions that interface the system (i.e.
ptrace wrappers).
This generally makes the code less riddled with casts.
|
|
|
|
|
|
If set, this callback gets called right after fork() in the child
process.
It can be used by the caller if it wants to perform some logic in the
child process before it starts executing the debuggee program.
|
|
The format of the address range section is different between DWARF
version 4 and version 5. This meant that we parsed programs compiled
with `-gdwarf-4` incorrectly.
|
|
The parameter of this operator is an unsigned LEB128 integer, so it can
be more than 1 byte in length. If we only read 1 byte, we might mess up
the offsets for the instructions following it.
|
|
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
|
|
|
|
ProcessInspector is an abstract base class for an object that can
inspect the address space of a process.
Concrete sub classes need to implement methods for peeking & poking
memory and walking the loaded libraries.
It is currently only implemented by DebugSession.
|
|
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.
|
|
|
|
While we're at it, unify the various different conditions that are
scattered accross the codebase.
|
|
Now that our DWARF 5 support is nearly feature-complete, there is no
reason anymore to special-case this library, as we can process it just
fine.
|
|
Our implementation (naively) assumes that there is a one-to-one
correspondence between compilation units and line programs, and that
their orders are identical. This is not the case for embedded resources,
as Clang only creates line programs for it, but not compilation units.
This mismatch caused an assertion failure, which made generating
backtraces for GUI applications impossible. This commit introduces a
hack that skips creating CompilationUnit objects for LinePrograms that
come from embedded resources.
|
|
With this change, our DWARF 5 support is nearly feature-complete.
|
|
Clang emits this form at all debug levels.
|
|
These forms were introduced in DWARF5, and have a fair deal of
advantages over the more traditional encodings: they reduce the size of
the binary and the number of relocations.
GCC does not emit these with `-g1` by default, but Clang does at all
debug levels.
|
|
This will be needed when we add `DW_FORM_strx*` and `DW_FORM_addrx*`
support, which requires us to fetch `DW_AT_str_offsets_base` and
`DW_AT_addr_base` attributes from the parent compilation unit. This
can't be done as we read the values, because it would create infinite
recursion (as we might try to parse the compilation unit's
`DW_FORM_strx*` encoded name before we get to the attribute). Having
getters ensures that we will perform lookups if they are needed.
|
|
|
|
Previously, we only supported DIEs with a contiguous address ranges and
ignored ones with a non-contiguous set of ranges.
We now check if a DIE has the DW_AT_ranges attribute, and if it does we
parse its range list.
This improves the quality of our backtraces - we previously missed many
inlined function calls because their DIEs had non-contigues address
ranges.
|
|
This adds support for parsing DWARF "range lists", which are identified
by the DW_AT_ranges form.
They contain code addresses for DIEs whose location is not contiguous.
|
|
The base address of the compilation unit is used in some range lists
entry types.
|
|
These API's are used in a variety of ways when building the die cache.
Each AbbreviationEntry has vector and other members, so avoid copying
it at all costs.
|
|
This algorithm is both iterative and recursive, so allocating on every
recursion, or when iterating each child is extremely costly.
Instead allow the on stack DIE to be re-initialized so it can be reused.
|
|
When parsing the libraries of the debugee process, we previously
assumed that the region that's called `<library name>: .text` was also
the base of the ELF file.
However, since we started linking with `-z separate-code`, this is no
longer the case - our executables have a read-only segment before the
.text segment, and that segment is actually at the base of the ELF.
This broke inserting breakpoints with the debugger since they were
inserted at a wrong offset.
To fix that, we now use the address of the first segment in the memory
map for the ELF's base address (The memory map is sorted by address).
|
|
|
|
This helps us avoid weird truncation issues and fixes a bug on Clang
builds where truncation while reading caused the DIE offsets following
large LEB128 numbers to be incorrect. This removes the need for the
separate `LongUnsignedNumber` type.
|
|
This LineProgram instruction is emitted by Clang. Although we currently
have no use for it (it's mostly a debugger feature), we need to handle
this opcode, as otherwise CrashReporter wouldn't work.
|
|
This is required to avoid copying the image where otherwise a reference
would be enough.
|
|
|
|
This fixes displaying 64-bit addresses in readelf and also fixes
showing backtraces from core dumps on x86_64.
|
|
This commit makes LibRegex (mostly) capable of operating on any of
the three main string views:
- StringView for raw strings
- Utf8View for utf-8 encoded strings
- Utf32View for raw unicode strings
As a result, regexps with unicode strings should be able to properly
handle utf-8 and not stop in the middle of a code point.
A future commit will update LibJS to use the correct type of string
depending on the flags.
|
|
|
|
|
|
This fixes a couple of warnings emitted by Clang.
|