Commit Graph

51 Commits

Author SHA1 Message Date
Michael Dusan
bac3c2748f
netbsd: std.dwarf.abi: disable x86_64 regBytes()
We do not yet have correct implementation to access xmm registers from
the world of ucontext/mcontext.

Unimplement .netbsd to allow building zig compiler.
2023-08-15 17:26:39 -04:00
Jakub Konka
fdce18cd30 std: fix compilation errors in dwarf/abi.zig when targeting iOS 2023-08-15 22:09:51 +02:00
kcbanner
1054e67f01 dwarf: add missing length check in rowColumns 2023-08-14 11:18:04 -07:00
kcbanner
661028a907 target: emit unwind tables if the platform supports unwinding 2023-07-26 20:58:29 -04:00
kcbanner
8e4cc0ce5a dwarf: small code size reduction in expression runner 2023-07-25 10:28:03 -04:00
kcbanner
d1ed1c167b simplify call frame instruction parser 2023-07-24 10:43:14 -04:00
kcbanner
20ce7455b9 fixup inline switch 2023-07-24 02:07:59 -04:00
kcbanner
253e6971ad dwarf: implement aarch64 default register rules 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
ba813d00f5 dwarf: add abi.stripInstructionPtrAuthCode 2023-07-20 22:58:16 -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
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
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
89ef004646 debug: x86 unwinding support, more unwinding fixes
- Fix unwindFrame using the previous FDE row instead of the current one
- Handle unwinding through noreturn functions
- Add x86-linux getcontext
- Fixup x86_64-linux getcontext not restoring the fp env
- Fix start_addr filtering on x86-windows
2023-07-20 22:58:14 -04:00
kcbanner
6abf1fbfe6 update to new builtin syntax 2023-07-20 22:58:14 -04:00
kcbanner
a47212c72e - rebase and update to lastest master 2023-07-20 22:58:13 -04:00
kcbanner
5781016c35 dwarf: add support for .eh_frame_hdr when unwinding
- .eh_frame_hdr contains a binary-searchable data structure for finding an FDE. If present, we can use this
section to avoid having to parse the entire FDE/CIE list in the binary, instead only entries that are actually
required for unwinding are read.
- rework the inputs pc-relative pointer decoding to support both already-mapped sections as well as sections
mapped from a file
- store the VirtualMachine on UnwindContext so the allocations can be reused
2023-07-20 22:58:13 -04:00
kcbanner
5ebca4392e debug: fixing more compile errors on arches that I hadn't tested on yet 2023-07-20 22:58:13 -04:00
kcbanner
551f153718 dwarf: fixes for non-64 bit systems 2023-07-20 22:58:13 -04:00
kcbanner
a325d7f6d1 fmt and cleanup 2023-07-20 22:58:13 -04:00
kcbanner
c98e03fc7e - rework CFI instruction parsing to not use std.meta
- move register formatting code to zig-dwardump
2023-07-20 22:58:13 -04:00
kcbanner
e72e762d1e dwarf: implement more register mappings, fix up macos compile 2023-07-20 22:58:13 -04:00
kcbanner
9145ff7da0 dwarf: implement more register number mappings
- add dwarf.abi.RegisterContext to handle register numbers changing based on DWARF format
2023-07-20 22:58:13 -04:00
kcbanner
b449d98a93 - rework StackIterator to optionally use debug_info to unwind the stack
- add abi routines for getting register values
- unwding is working!
2023-07-20 22:58:13 -04:00
kcbanner
69399fbb82 - add default register rule
- fixup eh pointer decoding
2023-07-20 22:58:13 -04:00
kcbanner
a0a40c2e7e - implement more opcodes 2023-07-20 22:58:13 -04:00
kcbanner
7b4611cfb3 - move writing code to zig-dwarfdump
- implement restore_state, restore_extended, offset_extended
2023-07-20 22:58:13 -04:00
kcbanner
338df862d1 - fix remember_state
- implement def_cfa_register
2023-07-20 22:58:13 -04:00
kcbanner
f3f3c877e0 - add DWARF expression parser
- change read apis to use a stream
- add register formatters
2023-07-20 22:58:13 -04:00
kcbanner
38303d7b9c add VirtualMachine to run CFA instructions 2023-07-20 22:58:13 -04:00
kcbanner
8b8d627137 - add call frame instruction parser
- add register printing
2023-07-20 22:58:13 -04:00
kcbanner
6c1d1aa45c begin working on parsing unwind info 2023-07-20 22:58:13 -04:00
kcbanner
f6148f123e add CommonInformationEntry parser 2023-07-20 22:58:12 -04:00
Luuk de Gram
33b2f4f382 wasm: Implement debug info for parameters 2022-05-09 18:51:46 +02:00
William Sengir
6de8b4bc3d std.dwarf: implement basic DWARF 5 parsing
DWARF 5 moves around some fields and adds a few new ones that can't be
parsed or ignored by our current DWARF 4 parser. This isn't a complete
implementation of DWARF 5, but this is enough to make stack traces
mostly work. Line numbers from C++ don't show up, but I know the info
is there. I think the answer is to iterate through .debug_line_str in
getLineNumberInfo, but I didn't want to fall into an even deeper rabbit
hole tonight.
2022-03-15 16:53:45 -04:00