46 Commits

Author SHA1 Message Date
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
Rocknest
b7cd60a354 Changing stuff and seeing what happens 2020-01-29 21:09:00 +02: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
LemonBoy
8516ee392c Fix parsing of DW_AT_Ranges debug entry
Follow the specification about what the base address is and how it can
be changed by some entries in the list itself.
2020-01-25 16:12:11 -05:00
LemonBoy
b8601e9252 Adjust tests & work around a nasty ICE 2020-01-21 23:17:02 +01:00
LemonBoy
bc82e0f3d3 Refactor some code in the debug output 2020-01-21 20:51:57 +01:00
LemonBoy
7fe13f4a86 Pointer alignment fixes for the stdlib 2020-01-08 20:03:03 +01:00
Andrew Kelley
53913acaf7
zig fmt and update extern fn to callconv(.C) 2020-01-06 15:34:50 -05:00
LemonBoy
563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
Andrew Kelley
8918cb06fc
sentinel slicing improvements
* add runtime safety for slicing pointers, arrays, and slices.
 * slicing without a sentinel value results in non-sentineled slice
 * improved `std.debug.panic` handling of panic-during-panic
2019-12-20 18:28:59 -05:00
Andrew Kelley
f8cd981c04
use -fsanitize=undefined for C code in safe build modes
closes #3569
2019-12-16 13:06:02 -05:00
Robin Voetter
4b4fbe3887
Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Andrew Kelley
7a4f704258
windows-specific fixes 2019-12-08 23:26:19 -05:00
Andrew Kelley
8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Andrew Kelley
ad214c7aa0
bring your own OS layer in the std lib
closes #3784
2019-12-02 15:02:17 -05:00
Andrew Kelley
b36c07a95a
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion 2019-12-01 09:56:01 -05:00
Andrew Kelley
951dc451d6
Merge pull request #3808 from LemonBoy/i386-for-ya
linux-i386 support
2019-11-30 22:00:00 -05:00
Andrew Kelley
413f9a5cfc
move std.fs.Dir.cwd to std.fs.cwd
update to non-deprecated std.fs APIs throughout the codebase

Related: #3811
2019-11-30 15:35:27 -05:00
LemonBoy
e1e06e6766 linux-i386 support 2019-11-30 16:13:33 +01:00
Andrew Kelley
d87b13f2f7
fix windows std lib regressions 2019-11-29 21:55:27 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
daurnimator
c0cb676745 std: refactor std/debug.zig DwarfInfo operations to be methods 2019-11-25 22:49:46 -05:00
Andrew Kelley
659c1bdeee
Merge branch 'wasi-run-tests' of https://github.com/fengb/zig into fengb-wasi-run-tests 2019-11-25 17:53:26 -05:00
Andrew Kelley
cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Andrew Kelley
29e438fd1f
more sentinel-terminated pointers std lib integration
See #3767
2019-11-25 00:43:36 -05:00
Andrew Kelley
cd37c1a377
add std.fs.Dir.openRead
This is progress towards file system APIs that encourage avoiding
Time Of Check, Time Of Use bugs.
2019-11-21 17:07:29 -05:00
Benjamin Feng
218f9ff34e Work around WASI's nonexistent @returnAddress() 2019-11-19 20:55:55 -06:00
Andrew Kelley
0237e7a701 std.io.getStdOut and related fns no longer can error
Thanks to the Windows Process Environment Block, it is possible to
obtain handles to the standard input, output, and error streams without
possibility of failure.
2019-11-13 04:01:40 +00:00
Andrew Kelley
e0db54e89d
update the codebase to use @as 2019-11-08 15:57:24 -05:00
Sebastian Keller
f81f36e2ff std.json.Value: added dumpStream(), utilize WriteStream for dump() 2019-11-06 18:21:52 -05:00
LemonBoy
c8b6e55299 Make the leb module available to non-std code 2019-11-04 20:33:40 +01:00
Tse
33cc204481 DragonFlyBSD support 2019-10-30 21:21:58 -04:00
Andrew Kelley
60cd11bd4b
get rid of std.os.foo.is_the_target
It had the downside of running all the comptime blocks and resolving
all the usingnamespaces of each system, when just trying to discover if
the current system is a particular one.

For Darwin, where it's nice to use `std.Target.current.isDarwin()`, this
demonstrates the utility that #425 would provide.
2019-10-24 01:14:52 -04:00
LemonBoy
b164e0ae55 Fix stack iteration stop condition 2019-10-13 17:49:47 -04:00
LemonBoy
b1f3f59d66 Fix fp-based backtracing on RISC-V
The fp points to the top of the frame instead of pointing to the old fp,
compensate this difference with an offset.
2019-10-13 12:13:41 +02:00
Andrew Kelley
a55db08a7b
generated docs contain generic instantiations and comptime calls 2019-10-08 00:15:16 -04:00
LemonBoy
17f2af10b5 Correct signal bits for MIPS
Also enable the segfault handler for all the supported architectures
beside MIPS.
2019-10-01 13:58:58 -04:00
Andrew Kelley
ed36dbbd9c
mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00