mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:37:35 +00:00
Kernel+LibC: Add a dump_backtrace() syscall.
This is very simple but already very useful. Now you're able to call to dump_backtrace() from anywhere userspace to get a nice symbolicated backtrace in the debugger output. :^)
This commit is contained in:
parent
3965fcc484
commit
d2b521f0ab
6 changed files with 18 additions and 1 deletions
|
@ -2718,3 +2718,9 @@ int Process::sys$mknod(const char* pathname, mode_t mode, dev_t dev)
|
|||
|
||||
return VFS::the().mknod(StringView(pathname), mode, dev, current_directory());
|
||||
}
|
||||
|
||||
int Process::sys$dump_backtrace()
|
||||
{
|
||||
dump_backtrace();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -104,6 +104,7 @@ public:
|
|||
void die();
|
||||
void finalize();
|
||||
|
||||
int sys$dump_backtrace();
|
||||
int sys$gettid();
|
||||
int sys$donate(int tid);
|
||||
int sys$shm_open(const char* name, int flags, mode_t);
|
||||
|
|
|
@ -291,6 +291,8 @@ static u32 handle(RegisterDump& regs, u32 function, u32 arg1, u32 arg2, u32 arg3
|
|||
case Syscall::SC_reboot: {
|
||||
return current->process().sys$reboot();
|
||||
}
|
||||
case Syscall::SC_dump_backtrace:
|
||||
return current->process().sys$dump_backtrace();
|
||||
default:
|
||||
kprintf("<%u> int0x82: Unknown function %u requested {%x, %x, %x}\n", current->process().pid(), function, arg1, arg2, arg3);
|
||||
return -ENOSYS;
|
||||
|
|
|
@ -115,7 +115,8 @@ struct timeval;
|
|||
__ENUMERATE_SYSCALL(sched_getparam) \
|
||||
__ENUMERATE_SYSCALL(fchown) \
|
||||
__ENUMERATE_SYSCALL(halt) \
|
||||
__ENUMERATE_SYSCALL(reboot)
|
||||
__ENUMERATE_SYSCALL(reboot) \
|
||||
__ENUMERATE_SYSCALL(dump_backtrace)
|
||||
|
||||
namespace Syscall {
|
||||
|
||||
|
|
|
@ -526,4 +526,10 @@ int reboot()
|
|||
int rc = syscall(SC_reboot);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
void dump_backtrace()
|
||||
{
|
||||
syscall(SC_dump_backtrace);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ __BEGIN_DECLS
|
|||
|
||||
extern char** environ;
|
||||
|
||||
void dump_backtrace();
|
||||
int fsync(int fd);
|
||||
void sysbeep();
|
||||
int systrace(pid_t);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue