Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vere: support stack traces on failing boot / full replay #523

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions pkg/noun/vortex.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,12 @@ c3_o
u3v_boot(u3_noun eve)
{
c3_d len_d;

{
u3_noun len = u3qb_lent(eve);
u3_assert( c3y == u3r_safe_chub(len, &len_d) );
u3z(len);
}

// ensure zero-initialized kernel
//
u3A->roc = 0;
u3A->eve_d = 0;

{
u3_noun pro = u3m_soft(0, u3v_life, eve);

Expand All @@ -59,6 +53,7 @@ u3v_boot(u3_noun eve)
return c3n;
}

u3z(u3A->roc);
u3A->roc = u3k(u3t(pro));
u3A->eve_d = len_d;
u3z(pro);
Expand Down
25 changes: 25 additions & 0 deletions pkg/vere/mars.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "noun.h"
#include "types.h"
#include "vere.h"
#include "ivory.h"
#include "ur.h"
#include "db/lmdb.h"
#include <mars.h>
#include <stdio.h>
Expand Down Expand Up @@ -179,6 +181,29 @@ _mars_do_boot(u3_disk* log_u, c3_d eve_d)
//
eve = u3m_love(u3ke_cue(u3ke_jam(eve)));

// install an ivory pill to support stack traces
//
// XX support -J
//
{
c3_d len_d = u3_Ivory_pill_len;
c3_y* byt_y = u3_Ivory_pill;
u3_cue_xeno* sil_u = u3s_cue_xeno_init_with(ur_fib27, ur_fib28);
u3_weak pil;

if ( u3_none == (pil = u3s_cue_xeno_with(sil_u, len_d, byt_y)) ) {
u3l_log("lite: unable to cue ivory pill");
exit(1);
}

u3s_cue_xeno_done(sil_u);

if ( c3n == u3v_boot_lite(pil)) {
u3l_log("lite: boot failed");
exit(1);
}
}

u3l_log("--------------- bootstrap starting ----------------");

u3l_log("boot: 1-%u", u3qb_lent(eve));
Expand Down
25 changes: 22 additions & 3 deletions pkg/vere/serf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#include "noun.h"

#include "vere.h"
#include "ivory.h"
#include "ur.h"

/*
|%
Expand Down Expand Up @@ -538,11 +540,28 @@ _serf_play_life(u3_serf* sef_u, u3_noun eve)
u3z(len);
}

// ensure zero-initialized kernel
// install an ivory pill to support stack traces
//
// XX assert?
// XX support -J
//
u3A->roc = 0;
{
c3_d len_d = u3_Ivory_pill_len;
c3_y* byt_y = u3_Ivory_pill;
u3_cue_xeno* sil_u = u3s_cue_xeno_init_with(ur_fib27, ur_fib28);
u3_weak pil;

if ( u3_none == (pil = u3s_cue_xeno_with(sil_u, len_d, byt_y)) ) {
u3l_log("lite: unable to cue ivory pill");
exit(1);
}

u3s_cue_xeno_done(sil_u);

if ( c3n == u3v_boot_lite(pil)) {
u3l_log("lite: boot failed");
exit(1);
}
}

gon = u3m_soft(0, u3v_life, eve);

Expand Down