When the entire purpose of this compilation is to perform a single zig
cc operation we could "tail call" clang by doing an execve, and any use
of the caching system would actually be problematic since the user is
presumably doing their own caching by using dep file flags.
Fixes#12317
This reverts commit 0f01e812ff.
This does not belong in `std.posix`, and it is already provided at
`std.os.windows.ws2_32.INVALID_SOCKET`.
See related issue #5019.
This reverts 6d679eb2bc and additionally
changes the command line parameters passed to Clang to match.
Clang 14 defaults to DWARFv5 which is an interesting choice. v5 has been
out for 5 years and yet Valgrind does not support it, and apparently
neither does either GDB or LLD, I haven't determined which, but I wasn't
able to use GDB to debug my LLVM-emitted dwarf 5 zig code that was linked
with LLD.
A couple years ago when I was working on the self-hosted ELF linker, I
emitted DWARFv5 but then downgraded to v4 when I realized that third
party tools were stuck in the past. Years later, they still are.
Hopefully, Clang 14's bold move will inspire third party tools to get
their shit together, however, in the meantime, everything's broken, so
we're passing `-gdwarf-4` to clang and instructing LLVM to emit DWARFv4.
Note that Zig's std.debug code *does* support DWARFv5 already as of a
previous commit that I made today.
We now do not allocate memory for headers and other metadata unless
requested by the caller. Instead, we read-in the entire contents
of the image into memory and operate on pointers and casts wherever
possible. I have a left a TODO to hook up Windows' memory-mapped API
here in-place of standard `readToEndAlloc` which should be more memory
proof on memory constrained hosts.
This commit also supplements our `std.coff` with a lot missing basic
extern structs required to make our COFF linker.
This `pdb.Pdb.init` call can return `error.FileNotFound`, which was previously resulting in:
Unable to print stack trace: FileNotFound
which also aborts the stack trace printing (so any deeper stack traces are not printed).
It makes more sense to treat it as `MissingDebugInfo` which then gets printed as:
???:?:?: 0x7fffa8817033 in ??? (???)
and allows the stack trace to continue printing.
Note: locally, the error.FileNotFound was being triggered for me when looking for kernel32.pdb and ntdll.pdb
* Added support for stroffsetsptr class in Dwarf stdlib
* Proper initializion of debug_str_offsets in DwarfInfo
* Added missing null initializer to DwarfInfo in Macho
* Added missing is_64 field to getAttrString in DwarfInfo
* Fixed formatting
* Added missing is_64 param to getAttrString
* Added required cast to usize
* Adding missing .debug_str_offsets initialization
* getAttrString now uses the str_offsets_base attr
This reverts commit 1a32f2a7f4.
Sorry, this workaround is not welcome. Instead, please solve the actual
issue by doing the accepted behavior in the compiler itself:
> in a catch or else (handling a returned error), if the block does not
> try or return error.xyz, set the index to 0
This also applies to if statements, such as the one that test runner is
doing just above this hack.
Essentially #1923 means "caught" errors still show up in error return traces.
The correct fix would require the compiler to fix this, but that could affect performance.
For now, simply workaround this issue by clearing the return traces
between tests.
This means that "caught" errors in one test will not show up in the
error traces of other tests.