aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
AgeCommit message (Collapse)Author
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
2021-02-05Fix previous %fp calculationKoakuma
2021-02-04std.debug.StackIterator: account for SPARC %fp quirkKoakuma
On SPARC, previous %fp is saved with a 14 slots offset from current %fp+bias. Also account for the bias constant at the new_fp calculation.
2021-01-21Bring back stack trace printing on ARM DarwinJakub Konka
This temporary patch fixes a segfault caused by miscompilation by the LLD when generating stubs for initialization of thread local storage. We effectively bypass TLS in the default panic handler so that no segfault is generated and the stack trace is correctly reported back to the user. Note that, this is linked directly to a bigger issue with LLD ziglang/zig#7527 and when resolved, we only need to remove the `comptime` code path introduced with this patch to use the default panic handler that relies on TLS. Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2021-01-14organize std lib concurrency primitives and add RwLockAndrew Kelley
* move concurrency primitives that always operate on kernel threads to the std.Thread namespace * remove std.SpinLock. Nobody should use this in a non-freestanding environment; the other primitives are always preferable. In freestanding, it will be necessary to put custom spin logic in there, so there are no use cases for a std lib version. * move some std lib files to the top level fields convention * add std.Thread.spinLoopHint * add std.Thread.Condition * add std.Thread.Semaphore * new implementation of std.Thread.Mutex for Windows and non-pthreads Linux * add std.Thread.RwLock Implementations provided by @kprotty
2021-01-10debug: don't fail printLineInfo if the source file is not readableVincent Rischmann
Without this dumping a stacktrace fails with this: Unable to dump stack trace: AccessDenied
2021-01-07Reduce use of deprecated IO typesJay Petacat
Related: #4917
2021-01-02std: Use {s} instead of {} when printing stringsLemonBoy
2021-01-01std.debug: adjust panic messageAndrew Kelley
also extern "c" instead of extern "pthread"
2021-01-01std: Show the panicking thread IDLemonBoy
Annotate the panic message with the thread ID to know who's the culprit.
2020-12-31Year++Frank Denis
2020-12-23rework std.ResetEvent, improve std lib Darwin integrationAndrew Kelley
* split std.ResetEvent into: - ResetEvent - requires init() at runtime and it can fail. Also requires deinit(). - StaticResetEvent - can be statically initialized and requires no deinitialization. Initialization cannot fail. * the POSIX sem_t implementation can in fact fail on initialization because it is allowed to be implemented as a file descriptor. * Completely define, clarify, and explain in detail the semantics of these APIs. Remove the `isSet` function. * `ResetEvent.timedWait` returns an enum instead of a possible error. * `ResetEvent.init` takes a pointer to the ResetEvent instead of returning a copy. * On Darwin, `ResetEvent` is implemented using Grand Central Dispatch, which is exposed by libSystem. stage2 changes: * ThreadPool: use a single, pre-initialized `ResetEvent` per worker. * WaitGroup: now requires init() and deinit() and init() can fail. - Add a `reset` function. - Compilation initializes one for the work queue in creation and re-uses it for every update. - Rename `stop` to `finish`. - Simplify the implementation based on the usage pattern.
2020-12-23openbsd: implement segfault handling on openbsd x86_64Sébastien Marie
2020-12-23Enable segfault handling on FreeBSD.Alex Cameron
2020-12-12std: Further siginfo refinementsLemonBoy
* Define siginfo and sigaction for Darwin * Define sigaction/handler union for maximum libc compatibility * Minor correction to some type definitions
2020-12-03makes the implementation publicIsaac Yonemoto
2020-12-02std: Add nosuspend around stderr.print callsLemonBoy
2020-11-29std.meta: add assumeSentinelJonathan Marler
2020-11-29std: Avoid deadlock in the signal handlerLemonBoy
stderr_mutex may still be held when we reach the signal handler, grab our own stderr handle to print the error messages and avoid deadlocking. Closes #7247
2020-11-19Update code to not use unsupported calling conventions for targetTadeo Kondrak
2020-11-18Merge pull request #7005 from jshholland/deprecate-spanVeikka Tuominen
Remove ArrayList.span
2020-11-16Move leb128 and remove trivial *mem functions as discussed in #5588 (#6876)tgschultz
* Move leb128 out of debug and remove trivial *mem functions as discussed in #5588 * Turns out one of the *Mem functions was used by MachO. Replaced with trivial use of FixedBufferStream.
2020-11-09Don't prevent compilation on platforms where debug info is unsupportedFrank Denis
We don't support debug information on platforms that are not tier-1, but it shouldn't be a hard error that completely prevents compilation.
2020-11-07remove deprecated uses of ArrayList.spanJosh Holland
2020-10-19std: Minor changes to startup codeLemonBoy
* Smaller startup sequence for ppc64 * Terminate the frame-pointer chain when executing _start * Make the stack traces work on ppc64 * Make the stack traces coloured on ppc64, some ioctls numbers are different and the whole set of constants should be audited.
2020-10-17Merge branch 'master' into openbsd-minimalSebastien Marie
2020-10-12Rename .macosx to .macosVignesh Rajagopalan
2020-10-11add minimal openbsd supportSébastien Marie
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-08-07improvements & fixes for general purpose allocator integrationAndrew Kelley
* std.Mutex API is improved to not have init() deinit(). This API is designed to support static initialization and does not require any resource cleanup. This also happens to work around some kind of stage1 behavior that wasn't letting the new allocator mutex code get compiled. * the general purpose allocator now returns a bool from deinit() which tells if there were any leaks. This value is used by the test runner to fail the tests if there are any. * self-hosted compiler is updated to use the general purpose allocator when not linking against libc.
2020-08-07std: introduce GeneralPurposeAllocatorAndrew Kelley
`std.GeneralPurposeAllocator` is now available. It is a function that takes a configuration struct (with default field values) and returns an allocator. There is a detailed description of this allocator in the doc comments at the top of the new file. The main feature of this allocator is that it is *safe*. It prevents double-free, use-after-free, and detects leaks. Some deprecation compile errors are removed. The Allocator interface gains `old_align` as a new parameter to `resizeFn`. This is useful to quickly look up allocations. `std.heap.page_allocator` is improved to use mmap address hints to avoid obtaining the same virtual address pages when unmapping and mapping pages. The new general purpose allocator uses the page allocator as its backing allocator by default. `std.testing.allocator` is replaced with usage of this new allocator, which does leak checking, and so the LeakCheckAllocator is retired. stage1 is improved so that the `@typeInfo` of a pointer has a lazy value for the alignment of the child type, to avoid false dependency loops when dealing with pointers to async function frames. The `std.mem.Allocator` interface is refactored to be in its own file. `std.Mutex` now exposes the dummy mutex with `std.Mutex.Dummy`. This allocator is great for debug mode, however it needs some work to have better performance in release modes. The next step will be setting up a series of tests in ziglang/gotta-go-fast and then making improvements to the implementation.