85 Commits

Author SHA1 Message Date
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
Rocknest
b7cd60a354 Changing stuff and seeing what happens 2020-01-29 21:09:00 +02:00
Benjamin Feng
4d134a01f5 Move debug.global_allocator to testing.allocator 2020-01-29 12:21:29 -06:00
Rocknest
3500b41bfe Add an advanced segfault handler on windows 2020-01-29 17:27:53 +02:00
Andrew Kelley
4591389497
Merge pull request #4300 from LemonBoy/debug-windows
More debug fixes - This time Windows gets a treat
2020-01-27 09:46:39 -05:00
LemonBoy
d5c2a20d8e Unify the two DWARF interpreters
* Let's consolidate the special-cased DWARF interpreter for OSX with the
  general purpose one

* Drop the assumption that all the debug data is contained in a single
  contiguous slice of memory. This is a good news for freestanding
  targets and paves the way for supporting compressed debug sections.
2020-01-27 09:46:20 -05:00
LemonBoy
7336b750bd Fix stack-trace address calculation on Windows
Let's always subtract 1 from the return address so that we're sure to be
inside the callee.

Fixes some edge case where the stack trace skipped the first entry.
2020-01-27 13:12:01 +01:00
LemonBoy
f8e015c85f Handle S_GPROC32 symbols in PDB files
Fixes some incomplete stack traces on Windows.
2020-01-27 13:10:35 +01:00
Andrew Kelley
51ac8eb08e fix regression in windows stack traces tty detection 2020-01-26 18:28:52 -05:00
Andrew Kelley
3839ea8978
fix debug info code not being freestanding compatible
in stack tracing code, the idea was to detect the tty settings at the
top of the stack and pass the information down. somewhere along the way
this got changed so that setTtyColor was assuming the global stderr_file
was related to the output stream the stack trace was being printed to.

now, tty_color is changed to tty_config, and it is an enum rather than a
bool, telling how tty colors are expected to be handled. windows is
still incorrectly looking at stderr_file.
2020-01-26 09:55:04 -05:00
LemonBoy
aaa2f9ab2f Fix handling of DW_LNE_end_sequence
The DWARF specification states that LNE_end_sequence should just reset
the state machine, it's not an error.
2020-01-25 20:03:50 -05:00