mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-13 06:29:11 +00:00
Polish recent changes and make improvements
- Simulate SIGPIPE on Windows NT - Fix commandv() regression on Windows NT - Fix sigprocmask() strace bug on OpenBSD - Add many more system calls to --strace logging - Make errno state more pristine in redbean strace
This commit is contained in:
parent
10a766ebd0
commit
39688a73e4
69 changed files with 460 additions and 1976 deletions
|
@ -18,20 +18,6 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/log/log.h"
|
||||
|
||||
static const char *__addr2line;
|
||||
|
||||
static textstartup void __addr2line_init() {
|
||||
static bool once;
|
||||
if (!once) {
|
||||
__addr2line = commandvenv("ADDR2LINE", "addr2line");
|
||||
once = true;
|
||||
}
|
||||
}
|
||||
|
||||
const char *GetAddr2linePath(void) {
|
||||
return __addr2line;
|
||||
return commandvenv("ADDR2LINE", "addr2line");
|
||||
}
|
||||
|
||||
const void *const __addr2line_ctor[] initarray = {
|
||||
__addr2line_init,
|
||||
};
|
||||
|
|
|
@ -76,13 +76,11 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
|
|||
}
|
||||
|
||||
/*
|
||||
* DWARF is a weak standard. If we build on Linux then only the
|
||||
* precice same version of the same tools on Linux can be counted upon
|
||||
* to work reliably. So if it's not Linux, we fall back to our builtin
|
||||
* tooling which can be counted upon.
|
||||
* DWARF is a weak standard. Platforms that use LLVM or old GNU
|
||||
* usually can't be counted upon to print backtraces correctly.
|
||||
*/
|
||||
if (!IsLinux()) {
|
||||
ShowHint("won't print addr2line backtrace on non-linux");
|
||||
if (!IsLinux() /* && !IsWindows() */) {
|
||||
ShowHint("won't print addr2line backtrace because probably llvm");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -242,6 +242,20 @@ forceinline char *__strstr(const char *haystack, const char *needle) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
forceinline char16_t *__strstr16(const char16_t *haystack,
|
||||
const char16_t *needle) {
|
||||
size_t i;
|
||||
for (;;) {
|
||||
for (i = 0;; ++i) {
|
||||
if (!needle[i]) return (/*unconst*/ char16_t *)haystack;
|
||||
if (!haystack[i]) break;
|
||||
if (needle[i] != haystack[i]) break;
|
||||
}
|
||||
if (!*haystack++) break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
forceinline char *__getenv(char **p, const char *s) {
|
||||
size_t i, j;
|
||||
if (p) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue