iacore
f31e114f63
zig fmt: additionally auto-fix @byteSwap ( #16462 )
2023-07-22 01:42:39 -04:00
r00ster91
d962ad5ea0
codegen: writer().writeByteNTimes -> appendNTimes
...
Both ways do the same thing but I think the compiler might have an
easier time optimizing `appendNTimes` because it does less
things/the path is shorter.
I have not done any benchmarking at runtime but have compared the
instruction count of both ways a little here: https://zig.godbolt.org/z/vr193W9oj
`b` (`appendNTimes`) is ~103 instructions while `a`
(`writer().writeByteNTimes`) is ~117 instructions.
And looking at the implementation of `writeByteNTimes`, it only seems to
buffer up 256 bytes before doing another `writeAll` which for
`std.ArrayList` probably means another allocation, whereas when directly
using `appendNTimes`, the entire exact additional capacity required is known from the start.
Either way, this would be more consistent anyway.
2023-07-21 21:32:18 -07:00
Luuk de Gram
619140c0d2
wasm: correctly intcast signed integers
...
When a signed integer's bitsize is not 32 or 64, but the given
bitsize and wanted bitsize are either both represented by Wasm's i32
or i64, we must either sign extend or wrap the integer.
2023-07-22 02:12:07 +02:00
Josh Wolfe
8924f81d8c
std.json: Unify stringify and writeStream ( #16405 )
2023-07-21 19:56:46 -04:00
Andrew Kelley
a2d81c547c
llvm: fix building for 32-bit targets
2023-07-21 16:37:50 -07:00
Loris Cro
426e737292
autodoc: avoid recursing reference loops in call instructions
2023-07-21 18:45:50 +02:00
Jakub Konka
61d5b7c957
Merge pull request #15823 from kcbanner/dwarf_unwind
...
Add DWARF unwinding, and an external debug info loader for ELF
2023-07-21 17:37:22 +02:00
Jakub Konka
c43ee5bb22
Merge pull request #16456 from ziglang/check-object-more-elf
...
std: dump .dynamic, .symtab, .dysym for ELF in `CheckObject`; remove wildcard matchers in favour of `checkContains` helper
2023-07-21 07:25:44 +02:00
kcbanner
b1d86db7b4
dwarf: move macho unwind code from macho -> dwarf
...
dwarf: fixup unchecked .eh_frame CIE offset subtraction
2023-07-20 22:58:16 -04:00
kcbanner
8e6a62ba10
test: disable omit_frame_pointer unwinding tests on aarch64-macos
...
dwarf: handle signal frame CIE flag
2023-07-20 22:58:16 -04:00
kcbanner
6d87bb370a
debug: disable the new unwinder on aarch64-macos
2023-07-20 22:58:16 -04:00
kcbanner
253e6971ad
dwarf: implement aarch64 default register rules
2023-07-20 22:58:16 -04:00
kcbanner
4421b14878
dwarf: fixup rules for setting ip
2023-07-20 22:58:16 -04:00
kcbanner
2bc2b01dbc
dwarf: update the pc register
2023-07-20 22:58:16 -04:00
kcbanner
d99b40d38b
dwarf: fix the unwinder using the incorrect row from the FDE in certain cases
2023-07-20 22:58:16 -04:00
kcbanner
1a2bb70956
dwarf: write the CFA as SP before the register update, in case the SP itself is updated by a column rule
2023-07-20 22:58:16 -04:00
kcbanner
97bda56306
macho: don't scan all eh_frame entries, instead follow the offset from the __unwind_info directly
2023-07-20 22:58:16 -04:00
kcbanner
774dc2fdb7
dwarf: add explicit_fde_offset to support more optimal __unwind_info dwarf lookups
2023-07-20 22:58:16 -04:00
kcbanner
bdb0a6fa77
test: add a test for dwarf embedded in coff
2023-07-20 22:58:16 -04:00
kcbanner
2c76020e77
debug: load the macho unwind sections from the already-mapped image
2023-07-20 22:58:16 -04:00
kcbanner
618b0eb3d3
dwarf: fixup integer overflow in readEhPointer
...
debug: handle the possibility of eh_frame / debug_frame being mapped in memory or loaded from disk
2023-07-20 22:58:16 -04:00
kcbanner
5e399d97d7
use eh_frame from the mapped binary if available
2023-07-20 22:58:16 -04:00
kcbanner
ba813d00f5
dwarf: add abi.stripInstructionPtrAuthCode
2023-07-20 22:58:16 -04:00
kcbanner
ec96095efd
compilation: pass omit_frame_pointer through to builtin.zig
...
Renamed dwarf_unwinding -> stack_iterator to better reflect that it's not just DWARF unwinding.
Added a test for unwinding with a frame pointer.
2023-07-20 22:58:16 -04:00
kcbanner
7d8b423477
macho: remove unnecessary checks
2023-07-20 22:58:16 -04:00
kcbanner
9549b4acf6
debug: fixup an inconsistency in the getcontext implementation on aarch64-macos
2023-07-20 22:58:16 -04:00
kcbanner
06bf2e048b
tests: use a more portable way of determining the return address in the test code
2023-07-20 22:58:16 -04:00
kcbanner
b18031335a
dwarf: use cie.return_address_register instead of assuming it's in the IP register
2023-07-20 22:58:16 -04:00
kcbanner
9b25bee42c
debug: fixup have_getcontext
2023-07-20 22:58:15 -04:00
kcbanner
e5aa2bb224
debug: fixup last_error being printed too many times
2023-07-20 22:58:15 -04:00
kcbanner
891fa3b8b5
debug: fix initialization of the optional fields on StackIterator
...
dwarf: documentation fixups
target: enable unwind tables on macho
2023-07-20 22:58:15 -04:00
kcbanner
5dfb159e15
macho: add aarch64 implementation to unwindFrame
...
dwarf: map the V registers in abi.regBytes
test: add test case that exercises the stack-indirect __unwind_info mode in x86_64
2023-07-20 22:58:15 -04:00
kcbanner
203d96ae97
debug: add relocateContext
...
dwarf: fixup tests that used a ThreadContext
2023-07-20 22:58:15 -04:00
kcbanner
94354aa6aa
macho: add unwindFrame which can unwind stack frames using the __unwind_info section
...
dwarf: fixup missing error
2023-07-20 22:58:15 -04:00
kcbanner
d226b74ae8
dwarf: add ExpressionError to work around the compiler not being able to infer it
...
dwarf: implement OP.entry_value, add tests
2023-07-20 22:58:15 -04:00
kcbanner
21d0154139
dwarf: skip register tests on unimplemented arch / os, add tests for type convesions
...
debug: dupeContext -> copyContext
2023-07-20 22:58:15 -04:00
kcbanner
021f537863
dwarf: fixup default endianness in ExpressionOptions, add control flow tests
2023-07-20 22:58:15 -04:00
kcbanner
54ca62fef4
dwarf: fixup regBytes for the case where there is no context support
...
expressions: add more tests, fix tests for mipsel
debug: add lookupModuleName implementation for macos
2023-07-20 22:58:15 -04:00
kcbanner
5c0d4cef1a
debug: add dupeContext, store a pointer to a copy of ThreadContext on UnwindContext
2023-07-20 22:58:15 -04:00
kcbanner
463bbe7807
dwarf: implement constx,addrx, begin adding DWARF expression tests
2023-07-20 22:58:15 -04:00
kcbanner
5f72c6508d
debug: rename StackTraceContext to ThreadContext
...
dwarf: use ThreadContext instead of os.ucontext_t
dwarf: add regBytes impl for windows
dwarf: fixup expression types for non-native
2023-07-20 22:58:15 -04:00
kcbanner
8547c42ba5
dwarf: expression fixups for non-64bit arches, check call_frame_context when writing expressions
2023-07-20 22:58:15 -04:00
kcbanner
424b1299a8
dwarf: add expression writer
2023-07-20 22:58:14 -04:00
kcbanner
ad5f74c0b1
dwarf: introduce ExpressionContext, add more expression opcodes
2023-07-20 22:58:14 -04:00
kcbanner
576ffaa329
darwin: update mcontext_t definition for aarch64 to add neon state
2023-07-20 22:58:14 -04:00
kcbanner
412cd789bf
debug: fixup base address calculations for macho
...
dwarf: fixup x86 register mapping logic
dwarf: change the register context update to update in-place instead of copying
debug: always print the unwind error type
2023-07-20 22:58:14 -04:00
kcbanner
b85f84061a
dwarf: don't dupe function names, as they are backed by the memory mapped sections
...
dwarf: const-correctness fixups
dwarf: implement the remaining register rules
dwarf: start implmenting the DWARF expression stack machine
2023-07-20 22:58:14 -04:00
kcbanner
62598c2187
debug: rework how unwind errors are printed, and add module name lookup for linux
...
This change enhances stack trace output to include a note that debug info was missing,
and therefore the stack trace may not be accurate. For example, if the user is using a libc
compiled with -fomit-frame-pointer and doesn't have debug symbols installed, any traces
that begin in a libc function may not unwind correctly. This allows the user to notice this and
potentially install debug symbols to improve the output.
2023-07-20 22:58:14 -04:00
kcbanner
f04f9705cc
dwarf: add support for DWARF5 DW_AT_ranges in subprograms, add DebugRangeIterator
...
Some DWARF5 subprograms have non-contiguous instruction ranges. An example of such
a function is `puts` in Ubuntu's libc. This change fixes name lookups for functions that use
DW_AT_range in their DIE.
2023-07-20 22:58:14 -04:00
kcbanner
395ab474eb
dwarf: fix logic error in eh_frame_hdry binary search
2023-07-20 22:58:14 -04:00