aboutsummaryrefslogtreecommitdiff
path: root/std/debug.zig
AgeCommit message (Collapse)Author
2019-03-16correct padding handling between std.pdb.ModInfo entries in DbiStreamSahnvour
2019-03-15breaking changes to std.mem.Allocator interface APIAndrew Kelley
Before, allocator implementations had to provide `allocFn`, `reallocFn`, and `freeFn`. Now, they must provide only `reallocFn` and `shrinkFn`. Reallocating from a zero length slice is allocation, and shrinking to a zero length slice is freeing. When the new memory size is less than or equal to the previous allocation size, `reallocFn` now has the option to return `error.OutOfMemory` to indicate that the allocator would not be able to take advantage of the new size. For more details see #1306. This commit closes #1306. This commit paves the way to solving #2009. This commit also introduces a memory leak to all coroutines. There is an issue where a coroutine calls the function and it frees its own stack frame, but then the return value of `shrinkFn` is a slice, which is implemented as an sret struct. Writing to the return pointer causes invalid memory write. We could work around it by having a global helper function which has a void return type and calling that instead. But instead this hack will suffice until I rework coroutines to be non-allocating. Basically coroutines are not supported right now until they are reworked as in #1194.
2019-03-02rename std lib files to new conventionAndrew Kelley
2017-12-23move std/debug.zig to a subdirectoryAndrew Kelley
self hosted compiler parser tests do some fuzz testing
2017-12-22explicitly return from blocksAndrew Kelley
instead of last statement being expression value closes #629
2017-12-18wip export rewriteAndrew Kelley
2017-12-12stack traces: support DW_AT_rangesAndrew Kelley
This makes some cases print stack traces where it previously failed.
2017-12-11self-hosted: test all out of memory conditionsAndrew Kelley
2017-12-11refactor debug.global_allocator into mem.FixedBufferAllocatorAndrew Kelley
2017-12-10add self-hosted parsing and rendering to main testsAndrew Kelley
2017-12-06add higher level arg-parsing API + misc. changesAndrew Kelley
* add @noInlineCall - see #640 This fixes a crash in --release-safe and --release-fast modes where the optimizer inlines everything into _start and clobbers the command line argument data. If we were able to verify that the user's code never reads command line args, we could leave off this "no inline" attribute. * add i29 and u29 primitive types. u29 is the type of alignment, so it makes sense to be a primitive. probably in the future we'll make any `i` or `u` followed by digits into a primitive. * add `aligned` functions to Allocator interface * add `os.argsAlloc` and `os.argsFree` so that you can get a `[]const []u8`, do whatever arg parsing you want, and then free it. For now this uses the other API under the hood, but it could be reimplemented to do a single allocation. * add tests to make sure command line argument parsing works.
2017-12-04rename builtin.is_big_endian to builtin.endianAndrew Kelley
See #307
2017-12-03rework enums and unions and their relationship to each otherAndrew Kelley
* @enumTagName renamed to @tagName and it works on enums and union-enums * Remove the EnumTag type. Now there is only enum and union, and the tag type of a union is always an enum. * unions support specifying the tag enum type, and they support inferring an enum tag type. * Enums no longer support field types but they do support setting the tag values. Likewise union-enums when inferring an enum tag type support setting the tag values. * It is now an error for enums and unions to have 0 fields. * switch statements support union-enums closes #618
2017-11-10add a std lib test for reading and writing filesAndrew Kelley
* fix fstat wrong on darwin * move std.debug.global_allocator to std.debug.global_allocator_state and make it private * add std.debug.global_allocator as a pointer (to upgrade your zig code remove the '&')
2017-11-07std.io: introduce buffered I/O and change APIAndrew Kelley
I started working on #465 and made some corresponding std.io API changes. New structs: * std.io.FileInStream * std.io.FileOutStream * std.io.BufferedOutStream * std.io.BufferedInStream Removed: * std.io.File.in_stream * std.io.File.out_stream Now instead of &file.out_stream or &file.in_stream to get access to the stream API for a file, you get it like this: var file_in_stream = io.FileInStream.init(&file); const in_stream = &file_in_stream.stream; var file_out_stream = io.FileOutStream.init(&file); const out_stream = &file_out_stream.stream; This is evidence that we might not need any OOP features - See #130.
2017-10-31breaking change to std.io APIAndrew Kelley
* Merge io.InStream and io.OutStream into io.File * Introduce io.OutStream and io.InStream interfaces - io.File implements both of these * Move mem.IncrementingAllocator to heap.IncrementingAllocator Instead of: ``` %return std.io.stderr.printf("hello\n"); ``` now do: ``` std.debug.warn("hello\n"); ``` To print to stdout, see `io.getStdOut()`. * Rename std.ArrayList.resizeDown to std.ArrayList.shrink.
2017-10-15fix std.io.InStream for windowsAndrew Kelley
now we handle PIPE_BROKEN as an EOF also set up framework for debugging unexpected posix/windows errors
2017-10-09implement os.path.real for windows and update allocator interfaceAndrew Kelley
2017-09-19Stop debug allocator ever panicking (#492)Marc Tiehuis
2017-08-29more alignment improvementsAndrew Kelley
* add alignment capability for fn protos * add @alignCast * fix some ast rendering code * fix some ir rendering code * add error for pointer cast increasing alignment * update allocators in std to correctly align See #37
2017-08-27fixups to linux buildAndrew Kelley
2017-08-26update for llvm 5.0.0rc1Andrew Kelley
2017-08-25unreachable still codegens to unreachable in ReleaseFast test modeAndrew Kelley
closes #430
2017-08-19bit shifting safetyAndrew Kelley
* add u3, u4, u5, u6, u7 and i3, i4, i5, i6, i7 * shift operations shift amount parameter type is integer with log2 bit width of other param - This enforces not violating undefined behavior on shift amount >= bit width with the type system * clean up math.log, math.ln, math.log2, math.log10 closes #403
2017-08-08add ptrToInt builtin, remove usize(ptr) castAndrew Kelley
closes #415
2017-06-14progress toward windows hello world workingAndrew Kelley
2017-06-04progress toward hello world without libc in windowsAndrew Kelley
2017-05-19change slicing syntax from ... to ..Andrew Kelley
See #359
2017-05-04std: rename List to ArrayList and re-organize...Andrew Kelley
...the exports of std. closes #356
2017-05-03change while syntaxAndrew Kelley
Old: ``` while (condition; expression) {} ``` New: ``` while (condition) : (expression) {} ``` This is in preparation to allow nullable and error union types as the condition. See #357
2017-05-03remove test and try expressions in favor of if expressionsAndrew Kelley
See #357
2017-05-01make debug safety stuff lazyAndrew Kelley
2017-05-01`@import("builtin")` instead of `@compileVar`Andrew Kelley
See #226 Closes #220
2017-04-26build system: consolidate duplicate code and moreAndrew Kelley
* add ability to add assembly files when building an exe, obj, or lib * add implicit cast from `[N]T` to `?[]const T` (closes #343) * remove link_exe and link_lib in favor of allowing build_exe and build_lib support no root zig source file
2017-04-24update READMEAndrew Kelley
2017-04-24stack traces support compile units with no pc rangeAndrew Kelley
2017-04-24better stack traces for ELF x86_64Andrew Kelley
2017-04-23fix check-statement-is-void. add testsJosh Wolfe
see #291
2017-04-23blocks check that their statements are voidJosh Wolfe
closes #291 This changes the error message "return value ignored" to "expression value is ignored". This is because this error also applies to {1;}, which has no function calls. Also fix ignored expression values in std and test. This caught a bug in debug.readAllocBytes where an early Eof error would have been missed. See #219.
2017-04-21rename `@ptrcast` to `@ptrCast` to follow conventionAndrew Kelley
2017-04-07ability to implicitly cast integer literal to &const IntAndrew Kelley
where Int is an integer type also introduce `@intToPtr` builtin for converting a usize to a pointer. users now have to use this instead of `(&T)(int)`. closes #311
2017-04-03zig build system: add setLinkerScript and setTargetAndrew Kelley
* See #204 - zig build system * allow builtin types Os, Environ, Arch to be used at runtime. they have zero_bits=false and debug info now. * Eradicate use of `@alloca` in std for syscalls. See #225 * add `std.io.writeFile` * `std.debug.panic` adds a newline to format
2017-03-31change `@bitcast` to `@ptrcast`Andrew Kelley
See #290
2017-03-31first pass at zig build systemAndrew Kelley
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`, `zig build_lib` and `zig build_exe` respectively. * `--name` parameter is optional when it can be inferred from the root source filename. closes #207 * `zig build` now looks for `build.zig` which interacts with `std.build.Builder` to describe the targets, and then the zig build system prints TODO: build these targets. See #204 * add `@bitcast` which is mainly used for pointer reinterpret casting and make explicit casting not do pointer reinterpretation. Closes #290 * fix debug info for byval parameters * sort command line help options * `std.debug.panic` supports format string printing * add `std.mem.IncrementingAllocator` * fix const ptr to a variable with data changing at runtime. closes #289
2017-03-26organize std and make import relative to current fileAndrew Kelley
closes #216
2017-03-26replace "&&" and "||" with "and" and "or"Andrew Kelley
closes #272
2017-03-26new unreachable syntaxAndrew Kelley
* `noreturn` is the primitive type. * `unreachable` is a control flow keyword. * `@unreachable()` builtin function is deleted. closes #214
2017-03-23improvements for windows and libc integrationAndrew Kelley
* standard library knows if it is linking against libc and will sometimes call libc functions in that case instead of providing redundant definitions * fix infinite loop bug when resolving use declarations * allow calling the same C function from different C imports. closes #277 * push more logic from compiler to std/bootstrap.zig * standard library provides way to access errno closes #274 * fix compile error in standard library for windows * add implementation of getRandomBytes for windows
2017-02-28rename CBuf to Buffer0 and some minor std API changesAndrew Kelley
2017-02-12slice and array re-work plus some misc. changesAndrew Kelley
* `@truncate` builtin allows casting to the same size integer. It also performs two's complement casting between signed and unsigned integers. * The idiomatic way to convert between bytes and numbers is now `mem.readInt` and `mem.writeInt` instead of an unsafe cast. It works at compile time, is safer, and looks cleaner. * Implicitly casting an array to a slice is allowed only if the slice is const. * Constant pointer values know if their memory is from a compile- time constant value or a compile-time variable. * Cast from [N]u8 to []T no longer allowed, but [N]u8 to []const T still allowed. * Fix inability to pass a mutable pointer to comptime variable at compile-time to a function and have the function modify the memory pointed to by the pointer. * Add the `comptime T: type` parameter back to mem.eql. Prevents accidentally creating instantiations for arrays.