Skip to content

Commit

Permalink
Utilise seL4_DebugNameThread for debugging
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan-Velickovic <[email protected]>
  • Loading branch information
Ivan-Velickovic committed Dec 22, 2024
1 parent 9bc4568 commit 92e2c4b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
16 changes: 16 additions & 0 deletions monitor/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ seL4_IPCBuffer *__sel4_ipc_buffer;
char _stack[4096];

static char pd_names[MAX_PDS][MAX_NAME_LEN];
seL4_Word pd_names_len;

seL4_Word fault_ep;
seL4_Word reply;
Expand Down Expand Up @@ -958,6 +959,21 @@ void main(seL4_BootInfo *bi)
offset = perform_invocation(system_invocation_data, offset, idx);
}

#if CONFIG_DEBUG_BUILD
/*
* Assign PD names to each TCB with seL4, this helps debugging when an error
* message is printed by seL4 or if we dump the scheduler state.
* This is done specifically in the monitor rather than being prepared as an
* invocation like everything else because it is technically a separate system
* call and not an invocation.
* If we end up doing various different kinds of system calls we should add
* support in the tooling and make the monitor generic.
*/
for (unsigned idx = 1; idx < pd_names_len + 1; idx++) {
seL4_DebugNameThread(tcbs[idx], pd_names[idx]);
}
#endif

puts("MON|INFO: completed system invocations\n");

monitor();
Expand Down
11 changes: 11 additions & 0 deletions monitor/src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,14 @@ sel4_strerror(seL4_Word err)

return "<invalid seL4 error>";
}

char *strcpy(char *restrict dst, const char *restrict src)
{
int i = 0;
while (src[i]) {
dst[i] = src[i];
i++;
}

return dst;
}
1 change: 1 addition & 0 deletions tool/microkit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3571,6 +3571,7 @@ fn main() -> Result<(), String> {
pd_names_bytes[start + PD_MAX_NAME_LENGTH - 1] = 0;
}
monitor_elf.write_symbol("pd_names", &pd_names_bytes)?;
monitor_elf.write_symbol("pd_names_len", &system.protection_domains.len().to_le_bytes())?;

// Write out all the symbols for each PD
pd_write_symbols(
Expand Down

0 comments on commit 92e2c4b

Please sign in to comment.