mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 07:29:23 +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 │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "ape/sections.internal.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/rusage.internal.h"
|
||||
#include "libc/calls/struct/siginfo.h"
|
||||
|
@ -55,6 +56,10 @@ struct Buffer {
|
|||
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, ...) {
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
|
@ -224,18 +229,19 @@ relegated void __oncrash_arm64(int sig, struct siginfo *si, void *arg) {
|
|||
Append(b, "\n");
|
||||
|
||||
// PRINT LINKED LOCATION
|
||||
pc = ctx->uc_mcontext.regs[30];
|
||||
Append(b, " %016lx sp %lx lr", ctx->uc_mcontext.sp, pc);
|
||||
if (pc && (symbol = __get_symbol(st, pc))) {
|
||||
addend = pc - st->addr_base;
|
||||
addend -= st->symbols[symbol].x;
|
||||
Append(b, " ");
|
||||
if (!AppendFileLine(b, addr2line, debugbin, pc)) {
|
||||
Append(b, "%s", __get_symbol_name(st, symbol));
|
||||
if (addend) Append(b, "%+d", addend);
|
||||
if (IsCode((pc = ctx->uc_mcontext.regs[30]))) {
|
||||
Append(b, " %016lx sp %lx lr", ctx->uc_mcontext.sp, pc);
|
||||
if (pc && (symbol = __get_symbol(st, pc))) {
|
||||
addend = pc - st->addr_base;
|
||||
addend -= st->symbols[symbol].x;
|
||||
Append(b, " ");
|
||||
if (!AppendFileLine(b, addr2line, debugbin, pc)) {
|
||||
Append(b, "%s", __get_symbol_name(st, symbol));
|
||||
if (addend) Append(b, "%+d", addend);
|
||||
}
|
||||
}
|
||||
Append(b, "\n");
|
||||
}
|
||||
Append(b, "\n");
|
||||
|
||||
// PRINT FRAME POINTERS
|
||||
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() - 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;
|
||||
if (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));
|
||||
}
|
||||
}
|
||||
if (is_terminated) {
|
||||
break;
|
||||
}
|
||||
embd.clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue