95 Commits

Author SHA1 Message Date
LemonBoy
dc54e50db2 std: Fix one more sentinel buffer overrun 2020-04-03 12:03:36 +02:00
LemonBoy
070ace4b22 std: Fix more NetBSD bits
Fix some more libc definitions.
2020-04-01 12:11:19 +02:00
daurnimator
3cf302a71d
Tidy up some mem.spanZ use-sites now that null is accepted 2020-04-01 01:50:34 +11:00
Andrew Kelley
9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
LemonBoy
d6739b1397 std: Fix undefined field error 2020-03-23 23:26:21 +01:00
LemonBoy
336ed03f0f debug: Accept relative paths in mapWholeFile 2020-03-23 18:51:49 +01:00
LemonBoy
27344464ed std: Add missing C defines for NetBSD 2020-03-23 18:47:40 +01:00
LemonBoy
2501e80500 Even better idle waiting method 2020-03-13 19:20:18 +01:00
LemonBoy
e496ef26da Nicer idle wait loop
Trying to acquire twice the same mutex generates an idle loop.
2020-03-13 18:40:18 +01:00
LemonBoy
edcf8e0636 std: Multithreaded-aware panic handler
Gracefully handle the case of several threads panicking at the same
time.
2020-03-13 17:55:40 +01:00
Andrew Kelley
2bff0dda79
fix regressions found by test suite 2020-03-10 20:22:30 -04:00
Andrew Kelley
9abee660dc
fix stack trace code not opening files in forced blocking mode 2020-03-10 19:28:05 -04:00
Andrew Kelley
cd26d3b0bb
fix regressions caused earlier in this branch 2020-03-10 18:54:24 -04:00
Andrew Kelley
ba0e3be5cf
(breaking) rework stream abstractions
The main goal here is to make the function pointers comptime, so that we
don't have to do the crazy stuff with async function frames.

Since InStream, OutStream, and SeekableStream are already generic
across error sets, it's not really worse to make them generic across the
vtable as well.

See #764 for the open issue acknowledging that using generics for these
abstractions is a design flaw.

See #130 for the efforts to make these abstractions non-generic.

This commit also changes the OutStream API so that `write` returns
number of bytes written, and `writeAll` is the one that loops until the
whole buffer is written.
2020-03-10 15:32:32 -04:00
Andrew Kelley
4616af0ca4
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
   `std.build.Target` wraps `std.Target` so that it can be annotated as
   "the native target" or an explicitly specified target.
 * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
   struct which has the tag as well as version range information.
 * `std.elf` gains some more ELF header constants.
 * `std.Target.parse` gains the ability to parse operating system
   version ranges as well as glibc version.
 * Added `std.Target.isGnuLibC()`.
 * self-hosted dynamic linker detection and glibc version detection.
   This also adds the improved logic using `/usr/bin/env` rather than
   invoking the system C compiler to find the dynamic linker when zig
   is statically linked. Related: #2084
   Note: this `/usr/bin/env` code is work-in-progress.
 * `-target-glibc` CLI option is removed in favor of the new `-target`
   syntax. Example: `-target x86_64-linux-gnu.2.27`

closes #1907
2020-02-28 14:51:53 -05:00
Andrew Kelley
0a88352689
fix behavior tests with --test-evented-io 2020-02-26 13:17:38 -05:00
LemonBoy
08047cd6d7 correct test expectations 2020-02-23 22:47:48 +01:00
LemonBoy
495e894225 delete extra code, more forgiveness 2020-02-22 12:44:21 +01:00
LemonBoy
41bca1ce76 unification: windows debug info 2020-02-22 12:05:50 +01:00
LemonBoy
c060cae3ce unification: osx debug info 2020-02-22 11:51:45 +01:00
LemonBoy
8df4d7e4f4 unsure 2020-02-21 12:11:04 +01:00
LemonBoy
a4d0d7f1de soldier on 2020-02-20 20:48:54 +01:00
LemonBoy
342a274948 tidy interface, const correctness 2020-02-20 20:18:51 +01:00
LemonBoy
ce2efbdca6 Correctly count all the loaded modules on Windows 2020-02-20 19:41:29 +01:00
LemonBoy
d5b583008a sudoku 2020-02-20 19:41:29 +01:00
LemonBoy
fabab58528 less hideous 2020-02-20 19:41:29 +01:00
LemonBoy
b9c02e4076 elvis entered the building 2020-02-20 19:41:29 +01:00
LemonBoy
2a350cf174 osx 2020-02-20 19:41:29 +01:00
LemonBoy
b3f728585a windows widestring 2020-02-20 19:41:29 +01:00
LemonBoy
463f704431 wide 2020-02-20 19:41:29 +01:00
LemonBoy
99649794e9 win 2020-02-20 19:41:29 +01:00
LemonBoy
b0b60cd468 tmp 2020-02-20 19:41:29 +01:00
LemonBoy
3620b67c26 debug: Split the DWARF stuff in its own file 2020-02-20 19:41:28 +01:00
Andrew Kelley
014f66e6de Merge pull request #4404 from ziglang/async-std
a big step towards std lib integration with async I/O
2020-02-10 00:22:59 -05:00
LemonBoy
be02616c86 debug: Show a nice error message on SIGBUS 2020-02-07 16:06:33 +01:00
Andrew Kelley
0b5bcd2f56
more std lib async I/O integration
* `zig test` gainst `--test-evented-io` parameter and gains the ability
   to seamlessly run async tests.
 * `std.ChildProcess` opens its child process pipe with O_NONBLOCK when
   using evented I/O
 * `std.io.getStdErr()` gives a File that is blocking even in evented
   I/O mode.
 * Delete `std.event.fs`. The functionality is now merged into `std.fs`
   and async file system access (using a dedicated thread) is
   automatically handled.
 * `std.fs.File` can be configured to specify whether its handle is
   expected to block, and whether that is OK to block even when in
   async I/O mode. This makes async I/O work correctly for e.g. the
   file system as well as network.
 * `std.fs.File` has some deprecated functions removed.
 * Missing readv,writev,pread,pwrite,preadv,pwritev functions are added
   to `std.os` and `std.fs.File`. They are all integrated with async
   I/O.
 * `std.fs.Watch` is still bit rotted and needs to be audited in light
   of the new async/await syntax.
 * `std.io.OutStream` integrates with async I/O
 * linked list nodes in the std lib have default `null` values for
   `prev` and `next`.
 * Windows async I/O integration is enabled for reading/writing file
   handles.
 * Added `std.os.mode_t`. Integer sizes need to be audited.
 * Fixed #4403 which was causing compiler to crash.

This is working towards:

./zig test ../test/stage1/behavior.zig --test-evented-io

Which does not successfully build yet. I'd like to enable behavioral
tests and std lib tests with --test-evented-io in the test matrix in the
future, to prevent regressions.
2020-02-06 18:05:50 -05:00
LemonBoy
cfcaf09cce debug: Improve the frame-walking strategy
Clean up the code a bit and introduce a few checks meant to avoid
overshooting the end of the frame chain.
The code is now stable enough not to cause panics during the call frame
walking.
2020-02-06 11:25:40 -05:00
Andrew Kelley
378d733439
Merge pull request #4345 from Rocknest/open-di
Fix double close in openElfDebugInfo
2020-02-05 15:56:56 -05:00
Rocknest
f30feab1b9 Link the issue in doc comment 2020-02-05 17:19:00 +02:00
Rocknest
a56183197d Fix double close in openElfDebugInfo 2020-02-05 17:18:30 +02:00
Michaël Larouche
9b11e5e1f1 Add InstallRawStep to Zig build system that does a similar job to llvm-objcopy. To use it, do 'exe.installRaw("kernel.bin");' where exe is a LibExeObjStep
Part of #2826
2020-02-03 15:07:34 -05:00
Andrew Kelley
65b1a4953f
Merge pull request #4324 from fengb/testing-allocator
Remove debug.global_allocator in favor of testing.allocator
2020-01-30 10:01:40 -05:00
Andrew Kelley
0303e7bd8e
Merge pull request #4319 from Rocknest/windows-traces
Bring windows segfault handler on par with linux
2020-01-30 09:26:39 -05:00
LemonBoy
e77a102e24 Small DWARF fixups
* Clang doesn't seem to emit a DW_AT_low_pc together with DW_AT_ranges
  for asm files.
* Keep reading the other CUs if the lookup fails.
2020-01-30 09:11:02 -05:00
Rocknest
a5f18c2b2a Fix one more edge case 2020-01-30 10:00:28 +02:00
Benjamin Feng
b077f3ab7d Promoted "leak_count_allocator" to the main testing.allocator 2020-01-29 22:22:00 -06:00
Benjamin Feng
0c137934cb Move FailingAllocator to testing 2020-01-29 17:38:42 -06:00
Rocknest
c0c9c601d4 Fix off-by-one error 2020-01-29 23:48:52 +02:00
Rocknest
4a4d6f2be9 Reorganize definitions 2020-01-29 23:15:17 +02:00
Benjamin Feng
aa9caf5064 Create leak_count_allocator 2020-01-29 14:37:01 -06:00