Kernel: Make /proc/PID/stacks/TID a JSON array

The contents of these files are now raw JSON arrays. We no longer
symbolicate the addresses. That's up to userspace from now on.
This commit is contained in:
Andreas Kling 2021-02-04 18:57:12 +01:00
parent 6a00e338a8
commit 54d28df97d
Notes: sideshowbarker 2024-07-18 22:35:56 +09:00

View file

@ -615,8 +615,16 @@ static bool procfs$tid_stack(InodeIdentifier identifier, KBufferBuilder& builder
auto thread = Thread::from_tid(to_tid(identifier));
if (!thread)
return false;
builder.appendf("Thread %d (%s):\n", thread->tid().value(), thread->name().characters());
builder.append(thread->backtrace());
JsonArraySerializer array { builder };
bool show_kernel_addresses = Process::current()->is_superuser();
for (auto address : Processor::capture_stack_trace(*thread, 1024)) {
if (!show_kernel_addresses && !is_user_address(VirtualAddress { address }))
address = 0xdeadc0de;
array.add(JsonValue(address));
}
array.finish();
return true;
}