From 657585026a375d2cb2d06ab400f9deb487d89a17 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Sat, 17 Jun 2023 17:53:23 +0200 Subject: libc: expand psdata into a proper struct, include executable base this is very useful for debugging userland programs using the qemu gdb stub --- src/user/lib/include/_proc.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/user/lib/include') diff --git a/src/user/lib/include/_proc.h b/src/user/lib/include/_proc.h index c8fd70b..5f9c321 100644 --- a/src/user/lib/include/_proc.h +++ b/src/user/lib/include/_proc.h @@ -1,7 +1,14 @@ #pragma once -/* That page contains a null-terminated string that describes the process - * for tools such as ps. It's first allocated in the bootstrap process, and - * then it's freed on every exec() - just to be immediately reallocated by - * _start2(). */ -static char *const _libc_psdata = (void*)0x10000; +struct _psdata { + /* Description of the process, see setprogname. + * Assumed to be null terminated. */ + char desc[1024]; + + /* Base offset where the executable was loaded. */ + void *base; +}; + +/* First allocated in bootstrap. + * Freed on every exec(), just to be immediately reallocated by _start2(). */ +static struct _psdata *const _psdata_loc = (void*)0x10000; -- cgit v1.2.3