Add ability to put breakpoints in FFI.h

This commit is contained in:
Ben Grant
2024-10-03 17:04:08 -07:00
parent c4d3ef5e53
commit f8ce2bfa42
2 changed files with 7 additions and 0 deletions

View File

@@ -65,6 +65,8 @@ void* NapiHandleScope__push(void* jsGlobalObject, bool detached);
void NapiHandleScope__pop(void* jsGlobalObject, void* handleScope);
#endif
// call this to cause a breakpoint, in case you need to debug functions in FFI.h
void __builtin_debugtrap(void);
#ifdef INJECT_BEFORE
// #include <stdint.h>

View File

@@ -2442,6 +2442,10 @@ const CompilerRT = struct {
@memcpy(dest[0..byte_count], source[0..byte_count]);
}
fn breakpoint() callconv(.C) void {
@breakpoint();
}
pub fn define(state: *TCC.TCCState) void {
if (comptime Environment.isX64) {
_ = TCC.tcc_define_symbol(state, "NEEDS_COMPILER_RT_FUNCTIONS", "1");
@@ -2489,6 +2493,7 @@ const CompilerRT = struct {
_ = TCC.tcc_add_symbol(state, "memcpy", &memcpy);
_ = TCC.tcc_add_symbol(state, "NapiHandleScope__push", &bun.JSC.napi.NapiHandleScope.NapiHandleScope__push);
_ = TCC.tcc_add_symbol(state, "NapiHandleScope__pop", &bun.JSC.napi.NapiHandleScope.NapiHandleScope__pop);
_ = TCC.tcc_add_symbol(state, "__builtin_debugtrap", &breakpoint);
_ = TCC.tcc_add_symbol(
state,