mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-06 13:44:55 +00:00
Fine tune crash reports for llama.com
This commit is contained in:
parent
1f2a5a8fc1
commit
ca19ecf49c
2 changed files with 20 additions and 11 deletions
|
@ -16,6 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "ape/sections.internal.h"
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/calls/struct/rusage.internal.h"
|
#include "libc/calls/struct/rusage.internal.h"
|
||||||
#include "libc/calls/struct/siginfo.h"
|
#include "libc/calls/struct/siginfo.h"
|
||||||
|
@ -55,6 +56,10 @@ struct Buffer {
|
||||||
int i;
|
int i;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool IsCode(uintptr_t p) {
|
||||||
|
return _base <= (uint8_t *)p && (uint8_t *)p < _etext;
|
||||||
|
}
|
||||||
|
|
||||||
static void Append(struct Buffer *b, const char *fmt, ...) {
|
static void Append(struct Buffer *b, const char *fmt, ...) {
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, fmt);
|
va_start(va, fmt);
|
||||||
|
@ -224,18 +229,19 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
|
||||||
Append(b, "\n");
|
Append(b, "\n");
|
||||||
|
|
||||||
// PRINT LINKED LOCATION
|
// PRINT LINKED LOCATION
|
||||||
pc = ctx->uc_mcontext.regs[30];
|
if (IsCode((pc = ctx->uc_mcontext.regs[30]))) {
|
||||||
Append(b, " %016lx sp %lx lr", ctx->uc_mcontext.sp, pc);
|
Append(b, " %016lx sp %lx lr", ctx->uc_mcontext.sp, pc);
|
||||||
if (pc && (symbol = __get_symbol(st, pc))) {
|
if (pc && (symbol = __get_symbol(st, pc))) {
|
||||||
addend = pc - st->addr_base;
|
addend = pc - st->addr_base;
|
||||||
addend -= st->symbols[symbol].x;
|
addend -= st->symbols[symbol].x;
|
||||||
Append(b, " ");
|
Append(b, " ");
|
||||||
if (!AppendFileLine(b, addr2line, debugbin, pc)) {
|
if (!AppendFileLine(b, addr2line, debugbin, pc)) {
|
||||||
Append(b, "%s", __get_symbol_name(st, symbol));
|
Append(b, "%s", __get_symbol_name(st, symbol));
|
||||||
if (addend) Append(b, "%+d", addend);
|
if (addend) Append(b, "%+d", addend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Append(b, "\n");
|
||||||
}
|
}
|
||||||
Append(b, "\n");
|
|
||||||
|
|
||||||
// PRINT FRAME POINTERS
|
// PRINT FRAME POINTERS
|
||||||
fp = (struct StackFrame *)ctx->uc_mcontext.regs[29];
|
fp = (struct StackFrame *)ctx->uc_mcontext.regs[29];
|
||||||
|
|
5
third_party/ggml/main.cc
vendored
5
third_party/ggml/main.cc
vendored
|
@ -492,7 +492,7 @@ int main(int argc, char ** argv) {
|
||||||
last_n_tokens.end() - (n_past - n_keep) / 2 - embd.size(),
|
last_n_tokens.end() - (n_past - n_keep) / 2 - embd.size(),
|
||||||
last_n_tokens.end() - embd.size());
|
last_n_tokens.end() - embd.size());
|
||||||
}
|
}
|
||||||
for (int i = 0; i < (int) embd.size(); i += params.n_batch) {
|
for (int i = 0; i < (int) embd.size() && !is_terminated; i += params.n_batch) {
|
||||||
int n_eval = (int) embd.size() - i;
|
int n_eval = (int) embd.size() - i;
|
||||||
if (n_eval > params.n_batch) {
|
if (n_eval > params.n_batch) {
|
||||||
n_eval = params.n_batch;
|
n_eval = params.n_batch;
|
||||||
|
@ -509,6 +509,9 @@ int main(int argc, char ** argv) {
|
||||||
(int)(n_consumed / (double)embd_inp.size() * 100));
|
(int)(n_consumed / (double)embd_inp.size() * 100));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (is_terminated) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
embd.clear();
|
embd.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue