| 1 |
#include "debug_internal.h" |
| 2 |
#include "dctx.h" |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
HPyContext* pypy_hpy_debug_get_ctx(HPyContext *uctx) { |
| 7 |
return hpy_debug_get_ctx(uctx); |
| 8 |
} |
| 9 |
|
| 10 |
int pypy_hpy_debug_ctx_init(HPyContext *dctx, HPyContext *uctx) { |
| 11 |
return hpy_debug_ctx_init(dctx, uctx); |
| 12 |
} |
| 13 |
|
| 14 |
HPy_ssize_t pypy_hpy_debug_open_handle(HPyContext *dctx, HPy_ssize_t _uh) { |
| 15 |
HPy uh = {._i = _uh}; |
| 16 |
HPy dh = hpy_debug_open_handle(dctx, uh); |
| 17 |
return dh._i; |
| 18 |
} |
| 19 |
|
| 20 |
HPy_ssize_t pypy_hpy_debug_unwrap_handle(HPyContext *dctx, HPy_ssize_t _dh) { |
| 21 |
HPy dh = {._i = _dh}; |
| 22 |
HPy uh = hpy_debug_unwrap_handle(dctx, dh); |
| 23 |
return uh._i; |
| 24 |
} |
| 25 |
|
| 26 |
void pypy_hpy_debug_close_handle(HPyContext *dctx, HPy_ssize_t _dh) { |
| 27 |
DHPy dh = {._i = _dh}; |
| 28 |
hpy_debug_close_handle(dctx, dh); |
| 29 |
} |
| 30 |
|
| 31 |
HPyModuleDef* pypy_HPyInit__debug() { |
| 32 |
return HPyInit__debug(); |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
static HPyContext *g_current_debug_ctx = NULL; |
| 37 |
|
| 38 |
void pypy_hpy_debug_set_ctx(HPyContext *dctx) { |
| 39 |
hpy_debug_set_ctx(dctx); |
| 40 |
g_current_debug_ctx = dctx; |
| 41 |
} |
| 42 |
|
| 43 |
HPyContext* pypy_hpy_debug_get_current_ctx(void) { |
| 44 |
return g_current_debug_ctx; |
| 45 |
} |
| 46 |
|
| 47 |
HPyContext* pypy_hpy_debug_ctx_before_call(HPyContext *dctx) { |
| 48 |
HPyContext *next_dctx = hpy_debug_get_next_dctx_from_cache(dctx); |
| 49 |
get_ctx_info(dctx)->is_valid = false; |
| 50 |
get_ctx_info(next_dctx)->is_valid = true; |
| 51 |
g_current_debug_ctx = next_dctx; |
| 52 |
return next_dctx; |
| 53 |
} |
| 54 |
|
| 55 |
void pypy_hpy_debug_ctx_after_call(HPyContext *original_dctx, HPyContext *next_dctx) { |
| 56 |
get_ctx_info(next_dctx)->is_valid = false; |
| 57 |
get_ctx_info(original_dctx)->is_valid = true; |
| 58 |
g_current_debug_ctx = original_dctx; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
struct _HPyContext_s g_universal_ctx; |