Commit Graph

116 Commits

Author SHA1 Message Date
daurnimator
521aaf3501
std: return Elf object from constructors instead of filling in pointer 2019-08-03 15:56:25 +10:00
Sahnvour
05032c8693 coff & pdb: improved correctness of our implementation, it is now able to handle stage1's pdb and print its stack traces 2019-07-29 23:40:18 +02:00
Andrew Kelley
bc31c1280e
disable segfault handler when panicking
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:41:59 -04:00
Nick Erdmann
33eaaadd01 fix documentation of assert 2019-07-15 19:52:07 -04:00
Andrew Kelley
d1cda00b36
workaround for no equality operator for enum literal and tagged union 2019-07-03 18:41:52 -04:00
emekoi
53ca4118bd added segfault handler support for windows 2019-07-03 14:02:48 -04:00
Andrew Kelley
06733c3ff5
Merge pull request #2788 from emekoi/pdb-fix
fixed coff header parsing
2019-07-02 14:48:45 -04:00
Andrew Kelley
1a1598c58c
stack traces on segfault by default for linux-x86_64
closes #2355
2019-07-02 13:41:16 -04:00
emekoi
027517a0c9 added init function for Coff 2019-06-29 13:56:23 -05:00
emekoi
b780dee3e8 initialize sections in openSelfDebugInfoWindows 2019-06-28 18:22:02 -05:00
Sahnvour
987c209b40 heap: make one global instance of DirectAllocator
it is now stateless, so the de/init are not necessary anymore
2019-06-22 14:10:53 -04:00
Andrew Kelley
7c5ceb0c4c
standard library integrates with knowledge of stripped debug info 2019-06-14 18:45:41 -04:00
tgschultz
34a22a85ca altered all instances of readInt* in std.io (and std.debug) to consume the minimum byte size required instead of @sizeOf(). 2019-06-10 17:10:35 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
2019-06-09 19:26:32 -04:00
Andrew Kelley
abf959a0c9
fix debug builds of WASI 2019-05-27 02:16:05 -04:00
Andrew Kelley
6be79d79aa
fixes for Windows and WASI 2019-05-27 00:48:56 -04:00
Andrew Kelley
2b42e910bf
behavior tests passing on Linux 2019-05-26 19:56:37 -04:00
Andrew Kelley
2f040a23c8
clean up references to os 2019-05-26 18:32:44 -04:00
Andrew Kelley
7cb6279ac0
clean up references to posix 2019-05-26 18:32:44 -04:00
Andrew Kelley
ca6debcaf4
starting to fix the regressions 2019-05-26 18:32:44 -04:00
Andrew Kelley
17b0166e00
do Jay's suggestion with posix/os API naming & layout 2019-05-26 18:32:44 -04:00
emekoi
1c73c08298 ran zig fmt on stdlib 2019-05-19 16:33:31 -04:00
LemonBoy
232bc1bdee Remove more 64bit-centric assumptions from stdlib 2019-05-18 11:08:04 +02:00
Marc Tiehuis
c4d1597f50 Mmap debug info on linux
Closes #907.
2019-05-13 20:04:25 +12:00
LemonBoy
8cc4eaea9f Use matching types when parsing fields 2019-05-10 00:44:24 +02:00
LemonBoy
4d8f96dd88 Fix minor bug in LEB128 parsing 2019-05-10 00:41:05 +02:00
Andrew Kelley
9c12237d2d
std.debug: fix stack trace iteration code
Previously, the stack trace iteration code was using the number of
frames collected as the number of frames to print, not recognizing the
fixed size of the buffer. So it would redundantly print items, matching
the total number of frames ever collected.

Now the iteration code is limited to the actual stack trace frame count,
and will not print duplicate frames.

Closes #2447
Closes #2151
2019-05-08 19:11:01 -04:00
LemonBoy
374d16793f Go one instruction before the return address
The return address may not point to an area covered by the debug infos
so we hope for the best and decrement the address so that it points to
the caller instruction.
2019-04-23 10:05:46 +02:00
LemonBoy
b095e33667 Fix silly typo 2019-04-23 09:57:57 +02:00
LemonBoy
57ec183c09 Fix reading of signed leb128 values 2019-04-23 09:57:22 +02:00
Andrew Kelley
9b83fe6b4c
fixup and zig fmt 2019-04-20 13:48:38 -04:00
LemonBoy
c2542bb7b7 Recover symbol infos from DWARF sections 2019-04-20 10:35:39 +02:00
LemonBoy
0286be127e Fix parseFormValueConstant
Signed/unsigned confusion made the code fail an assertion sometimes.
2019-04-19 19:59:14 +02:00
Andrew Kelley
3ce024dd85
A bunch of fixes for the DWARF parser (#2254)
* Correct parsing of DWARF line_info section

* Fix reading of udata/sdata encoded attributes

* Add definition for DW_AT_alignment

Even though it's been standardized in DWARF5 some compilers produce it
anyway for DWARF4 infos too.

* Fix reading of reference attributes

* Distinguish between absolute/relative addresses
2019-04-11 14:34:13 -04:00
Matthew Iannucci
27cd830ec8 Add initial support for iOS targets (#2237)
* Add iOS C int sizes... try to hack in iOS DebugInfo

* Get rid of ios link check for now

* Remove macos linkversion check
2019-04-11 13:15:17 -04:00
LemonBoy
51eb4ebec1 Distinguish between absolute/relative addresses 2019-04-11 15:41:42 +02:00
LemonBoy
38492b2ea4 Fix reading of reference attributes 2019-04-11 10:36:15 +02:00
LemonBoy
795b3e9b68 Fix reading of udata/sdata encoded attributes 2019-04-11 10:36:15 +02:00
LemonBoy
60e2a04322 Correct parsing of DWARF line_info section 2019-04-10 23:30:41 +02:00
Sahnvour
ae9b90cf6e print a message instead of returning an error when debug info comes from a source file not found (for example compiled on another computer) 2019-03-16 15:34:14 +01:00
Sahnvour
704dfaaabf avoid reading LineBlockFragmentHeader at all if the address is not in range, thus simplifying code and improving speed of execution 2019-03-16 15:34:14 +01:00
Sahnvour
094d40fb1a allow pdb modules to have no C13 data, this happens if the module is stripped 2019-03-16 15:34:14 +01:00
Sahnvour
0d4a5c40bc correct padding handling between std.pdb.ModInfo entries in DbiStream 2019-03-16 15:34:14 +01:00
Andrew Kelley
9c13e9b7ed
breaking changes to std.mem.Allocator interface API
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-15 17:57:21 -04:00
Andrew Kelley
e402455704
rename std lib files to new convention 2019-03-02 16:46:04 -05:00
Andrew Kelley
4183c6f1a5 move std/debug.zig to a subdirectory
self hosted compiler parser tests do some fuzz testing
2017-12-23 22:15:48 -05:00
Andrew Kelley
d917815d81 explicitly return from blocks
instead of last statement being expression value

closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley
1fdebc1dc4 wip export rewrite 2017-12-18 09:59:57 -05:00
Andrew Kelley
caa6433b56 stack traces: support DW_AT_ranges
This makes some cases print stack traces where it previously failed.
2017-12-12 12:05:28 -05:00
Andrew Kelley
ed4d94a5d5 self-hosted: test all out of memory conditions 2017-12-11 21:12:47 -05:00