Semaphore upping done with irqsave
[akaros.git] / kern / include / kdebug.h
1 #ifndef ROS_KERN_KDEBUG_H
2 #define ROS_KERN_KDEBUG_H
3
4 #include <ros/common.h>
5 #include <arch/kdebug.h>
6
7 // Debug information about a particular instruction pointer
8 typedef struct eipdebuginfo {
9         const char *eip_file;           // Source code filename for EIP
10         int eip_line;                           // Source code linenumber for EIP
11
12         const char *eip_fn_name;        // Name of function containing EIP
13                                                                 //  - Note: not null terminated!
14         int eip_fn_namelen;                     // Length of function name
15         uintptr_t eip_fn_addr;          // Address of start of function
16         int eip_fn_narg;                        // Number of function arguments
17 } eipdebuginfo_t;
18
19 int debuginfo_eip(uintptr_t eip, eipdebuginfo_t *NONNULL info);
20 void *debug_get_fn_addr(char *fn_name);
21 void backtrace(void);
22
23 /* Arch dependent, listed here for ease-of-use */
24 static inline uintptr_t get_caller_pc(void);
25
26 /* Returns a null-terminated string with the function name for a given PC /
27  * instruction pointer.  kfree() the result. */
28 char *get_fn_name(uintptr_t pc);
29
30 #endif /* ROS_KERN_KDEBUG_H */