Skip to content

Commit 3fb897a

Browse files
committed
erts: Do not set debug breakpoints on BIFs
Debug breakpoints on BIFs are pointless (I think) and would just complicate the logic for when Export.is_bif_traced should be set/cleared.
1 parent d974e8c commit 3fb897a

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

erts/emulator/beam/beam_bp.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ erts_bp_init(void) {
178178

179179

180180
void
181-
erts_bp_match_functions(BpFunctions* f, ErtsCodeMFA *mfa, int specified)
181+
erts_bp_match_functions(BpFunctions* f, ErtsCodeMFA *mfa, int specified,
182+
int ignore_bifs)
182183
{
183184
ErtsCodeIndex code_ix = erts_active_code_ix();
184185
Uint max_funcs = 0;
@@ -232,6 +233,15 @@ erts_bp_match_functions(BpFunctions* f, ErtsCodeMFA *mfa, int specified)
232233
case 0:
233234
break;
234235
}
236+
237+
if (ignore_bifs) {
238+
Export *ep = erts_active_export_entry(ci->mfa.module,
239+
ci->mfa.function,
240+
ci->mfa.arity);
241+
if (ep && ep->bif_number >= 0) {
242+
continue;
243+
}
244+
}
235245
/* Store match */
236246
f->matching[i].code_info = ci;
237247
f->matching[i].mod = module[current];

erts/emulator/beam/beam_bp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ void erts_commit_staged_bp(void);
132132
ERTS_GLB_INLINE ErtsBpIndex erts_active_bp_ix(void);
133133
ERTS_GLB_INLINE ErtsBpIndex erts_staging_bp_ix(void);
134134

135-
void erts_bp_match_functions(BpFunctions* f, ErtsCodeMFA *mfa, int specified);
135+
void erts_bp_match_functions(BpFunctions* f, ErtsCodeMFA *mfa, int specified, int ignore_bifs);
136136
void erts_bp_match_export(BpFunctions* f, ErtsCodeMFA *mfa, int specified);
137137
void erts_bp_free_matched_functions(BpFunctions* f);
138138

erts/emulator/beam/beam_debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ erts_debug_breakpoint_2(BIF_ALIST_2)
246246
ASSERT(erts_staging_trace_session == NULL);
247247
erts_staging_trace_session = &erts_trace_session_0;
248248

249-
erts_bp_match_functions(&finish_debug_bp.f, &mfa, specified);
249+
erts_bp_match_functions(&finish_debug_bp.f, &mfa, specified,
250+
1); // ignore bifs
250251

251252
ASSERT(finish_debug_bp.f.matched >= 0);
252253
ASSERT(finish_debug_bp.process == NULL);

erts/emulator/beam/erl_bif_trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,7 +2394,7 @@ erts_set_trace_pattern(ErtsCodeMFA *mfa, int specified,
23942394
/*
23952395
* First do "local" code breakpoint tracing
23962396
*/
2397-
erts_bp_match_functions(&finish_bp.f, mfa, specified);
2397+
erts_bp_match_functions(&finish_bp.f, mfa, specified, 0);
23982398

23992399
if (on) {
24002400
if (! flags.breakpoint) {
@@ -2527,7 +2527,7 @@ prepare_clear_all_trace_pattern(ErtsTraceSession* session)
25272527
/*
25282528
* Clear all breakpoints in code for session
25292529
*/
2530-
erts_bp_match_functions(&finish_bp.f, NULL, 0);
2530+
erts_bp_match_functions(&finish_bp.f, NULL, 0, 0);
25312531
erts_clear_all_breaks(&finish_bp.f);
25322532

25332533
clear_event_trace(erts_staging_trace_session->send_tracing);

0 commit comments

Comments
 (0)