2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-21 09:26:29 +08:00
artiq/soc/runtime/artiq_personality.h
whitequark 46476516ba ARTIQException: tell linecache where to look for runtime sources.
Runtime sources can appear in the backtrace when
artiq_raise_from_c is used.
2015-08-10 20:26:07 +03:00

60 lines
1.3 KiB
C

#ifndef __ARTIQ_PERSONALITY_H
#define __ARTIQ_PERSONALITY_H
#include <stdint.h>
#include <stddef.h>
struct artiq_exception {
union {
uintptr_t typeinfo;
const char *name;
};
const char *file;
int32_t line;
int32_t column;
const char *function;
const char *message;
int64_t param[3];
};
struct artiq_backtrace_item {
intptr_t function;
intptr_t offset;
};
#ifdef __cplusplus
extern "C" {
#endif
/* Provided by the runtime */
void __artiq_raise(struct artiq_exception *artiq_exn)
__attribute__((noreturn));
void __artiq_reraise(void)
__attribute__((noreturn));
#define artiq_raise_from_c(exnname, exnmsg, exnparam0, exnparam1, exnparam2) \
do { \
struct artiq_exception exn = { \
.name = exnname, \
.message = exnmsg, \
.param = { exnparam0, exnparam1, exnparam2 }, \
.file = __FILE__, \
.line = __LINE__, \
.column = -1, \
.function = __func__, \
}; \
__artiq_raise(&exn); \
} while(0)
/* Called by the runtime */
void __artiq_terminate(struct artiq_exception *artiq_exn,
struct artiq_backtrace_item *backtrace,
size_t backtrace_size)
__attribute__((noreturn));
#ifdef __cplusplus
}
#endif
#endif /* __ARTIQ_PERSONALITY_H */