aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
AgeCommit message (Collapse)Author
2022-03-19std: enable default panic handler for stage2 LLVM on LinuxVeikka Tuominen
2022-03-17debug: msync only current page when validation frame pointerJakub Konka
This fixes lack of stack traces on arm64 macOS which were regressed and not getting generated at all after this addition to write current stack traces. Prior to this, function `isValidMemory` would sync two subsequent pages if the aligned (base) address was different than the frame pointer. I fail to see what the logic for such assumption here is as the manual of `msync` clearly states it will fail with error if the passed in memory region length contains unmapped regions. This was the very reason why there were no stack traces print on arm64 macOS as the second page was unmapped thus incorrectly flagging the frame pointer as invalid.
2022-03-15std.dwarf: implement basic DWARF 5 parsingWilliam Sengir
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-12stage2 llvm: do not use getIntrinsic for airFrameAddressVeikka Tuominen
getIntrinsic gets the return type wrong so we have to add the function manually
2022-02-19StackIterator should not try to check validity on freestandingLee Cannon
2022-02-11validate in Windows using VirtualQuerym
2022-02-11std: validate frame-pointer address in stack walkingm
2022-02-07debug: implement segfault handler for macOS aarch64John Schmidt
Tested on a M1 MacBook Pro, macOS Monterey 12.2.
2022-01-31debug: fix edge cases in macOS debug symbol lookupJohn Schmidt
This commit fixes two related things: 1. If the loop goes all the way through the slice without a match, on the last iteration `mid == symbols.len - 1` which causes `&symbols[mid + 1]` to be out of bounds. End one step before that instead. 2. If the address we're looking for is greater than the address of the last symbol in the slice, we now match it to that symbol. Previously, we would miss this case since we only matched if the address was _in between_ the address of two symbols.
2022-01-27add std.debug.todoDavid John
2022-01-18Implement segfault handler for macOS x86_64John Schmidt
2021-12-19stage1, stage2: rename c_void to anyopaque (#10316)Isaac Freund
zig fmt now replaces c_void with anyopaque to make updating code easy.
2021-12-15macho: put `LC_*` consts in a typed enum(u32) LCJakub Konka
repeat for `PLATFORM_*` and `TOOL_*` sets
2021-11-30allocgate: renamed getAllocator function to allocatorLee Cannon
2021-11-30allocgate: std Allocator interface refactorLee Cannon
2021-11-30macos: remove >= 0x10000000 assertion when printing stack tracesJakub Konka
I don't think we can guarantee that especially for system dyld dylibs which can be loaded at any address (perhaps even some OS preferential low memory address). Incidentally, this fixes stack trace tests on x86_64 macOS 12.
2021-11-30macos: rewrite logic for generating stack traces on macOSJakub Konka
In order to be linker-independent, when parsing debug info in each linked OSO, we also create a quick lookup table for symbols defined within the OSO. We then use this lookup to map symbol from the EXE to its defined address within the original OSO which we can then use to extract its associated DWARF info (if any).
2021-11-30std lib API deprecations for the upcoming 0.9.0 releaseAndrew Kelley
See #3811
2021-11-09std.Thread.Mutex: change API to lock() and unlock()Andrew Kelley
This is a breaking change. Before, usage looked like this: ```zig const held = mutex.acquire(); defer held.release(); ``` Now it looks like this: ```zig mutex.lock(); defer mutex.unlock(); ``` The `Held` type was an idea to make mutexes slightly safer by making it more difficult to forget to release an aquired lock. However, this ultimately caused more problems than it solved, when any data structures needed to store a held mutex. Simplify everything by reducing the API down to the primitives: lock() and unlock(). Closes #8051 Closes #8246 Closes #10105
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-09-28improve panic hierarchy by always using builtin.panicrgreenblatt
2021-09-24Initial bringup of the Solaris/Illumos portStephen Gregoratto
2021-09-01std: fix regressions from this branchAndrew Kelley
Also move some usingnamespace test cases from compare_output to behavior.
2021-09-01std: reorganization that allows new usingnamespace semanticsAndrew Kelley
The proposal #9629 is now accepted, usingnamespace stays but no longer puts identifiers in scope.
2021-09-01std.os reorganization, avoiding `usingnamespace`Andrew Kelley
The main purpose of this branch is to explore avoiding the `usingnamespace` feature of the zig language, specifically with regards to `std.os` and related functionality. If this experiment is successful, it will provide a data point on whether or not it would be practical to entirely remove `usingnamespace` from the language. In this commit, `usingnamespace` has been completely eliminated from the Linux x86_64 compilation path, aside from io_uring. The behavior tests pass, however that's as far as this branch goes. It is very breaking, and a lot more work is needed before it could be considered mergeable. I wanted to put a pull requset up early so that zig programmers have time to provide feedback. This is progress towards closing #6600 since it clarifies where the actual "owner" of each declaration is, and reduces the number of different ways to import the same declarations. One of the main organizational strategies used here is to do namespacing with real namespaces (e.g. structs) rather than by having declarations share a common prefix (the C strategy). It's no coincidence that `usingnamespace` has similar semantics to `#include` and becomes much less necessary when using proper namespaces.
2021-08-29zig fmt: respect trailing commas in inline assemblyjdmichaud
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-20enables user-custom code to work with LI and SIIsaac Yonemoto
2021-08-02std: check for overflow in writeCurrentStackTraceJakub Konka
On arm64 macOS, the address of the last frame is 0x0 rather than a positive value like 0x1 on x86_64 macOS, therefore, we overflow an integer trying to subtract 1 when printing the stack trace. This patch fixes it by first checking for this condition before trying to subtract 1. Note that we do not need to signal the `SignalIterator` about this as it will correctly detect this condition on the subsequent iteration and return `null`, thus terminating the loop.
2021-07-08Add support for NO_COLORMartin Wickham
2021-06-30changes to accomodate std.Thread updatekprotty
2021-06-21fix unused locals from merge conflictAndrew Kelley
2021-06-21fix code broken from previous commitJacob G-W
2021-06-21stage2 tests: remove unused varsJacob G-W
2021-06-18Add support for reading DWARF debug information from COFF filesMatt Chudleigh
2021-06-12std: Move PDB-related code into its own fileLemonBoy
No functional changes are expected, this patch is only moving some code in order to slim the huge bowl of spaghetti that is debug.zig. The amount of memory leaked on error is much less than before but not zero, some further work is required to smooth the edges of this old part of the stdlib.
2021-06-10Correct a comment.purringChaos
2021-05-24enable symbol lookup for haikuAl Hoang
2021-05-15Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * build.zig * src/Compilation.zig * src/codegen/spirv/spec.zig * src/link/SpirV.zig * test/stage2/darwin.zig - this one might be problematic; start.zig looks for `main` in the root source file, not `_main`. Not sure why there is an underscore there in master branch.
2021-05-15std: Avoid using white color when printing stacktracesLemonBoy
Use .bold instead of .white, the effect is the same for light-on-dark terminals but greatly improves the readability for dark-on-light ones. Closes #8761
2021-04-28std: remove redundant comptime keywordAndrew Kelley
@g-w1's fancy new compile error in action
2021-04-28Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
In particular I wanted to take advantage of the new hex float parsing code.
2021-04-25std: Fix backtraces on sparcv9LemonBoy
Flush all the register windows to stack before starting the stack walk, we may otherwise try to read garbage and crash and burn. Add a few comptime annotations to debloat some functions.
2021-04-15std: change `@import("builtin")` to `std.builtin`Andrew Kelley
2021-04-08stage2: pretty print compilation errorsjacob gw
2021-03-18zld: use zld when linking aarch64 by default and cross-compJakub Konka
2021-03-01Merge pull request #7946 from koachan/sparc64-framefixesAndrew Kelley
SPARCv9: Handle various stack frame related quirks.
2021-02-25initial support for haiku defer debugAl Hoang
2021-02-25initial support for haiku continue clean upAl Hoang
* remove unused definitions * setup os specific blocks
2021-02-25initial support for haiku past stage0Al Hoang