Skip to content

Commit e0b1b05

Browse files
committed
exclude un-hittable lines from coverage
1 parent 33792a1 commit e0b1b05

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

src/austin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,9 @@ main(int argc, char** argv) {
308308
}
309309

310310
if (!isvalid(handler)) {
311-
log_e("Failed to create event handler");
311+
log_e("Failed to create event handler"); // GCOV_EXCL_START
312312
retval = -1;
313-
goto release;
313+
goto release; // GCOV_EXCL_STOP
314314
}
315315
event_handler_install(handler);
316316

src/events.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ collapsed_stack_event_handler__handle_stack_end(base_event_handler_t* self) {
9898
frame_t* native_frame = stack_native_pop();
9999
if (!isvalid(native_frame)) {
100100
log_e("Invalid native frame");
101-
break;
101+
break; // GCOV_EXCL_LINE
102102
}
103103
cached_string_t* scope = native_frame->scope;
104104

@@ -166,8 +166,8 @@ event_handler_t*
166166
collapsed_stack_event_handler_new(void) {
167167
event_handler_t* handler = (event_handler_t*)calloc(1, sizeof(base_event_handler_t));
168168
if (!isvalid(handler)) {
169-
log_e("Failed to allocate memory for event handler");
170-
return NULL;
169+
log_e("Failed to allocate memory for event handler"); // GCOV_EXCL_START
170+
return NULL; // GCOV_EXCL_STOP
171171
}
172172

173173
handler->spec.emit_stack_begin = (event_handler_stack_begin_t)collapsed_stack_event_handler__handle_stack_begin;
@@ -230,8 +230,8 @@ mojo_event_handler__handle_stack_end(base_event_handler_t* self) {
230230
while (!stack_native_is_empty()) {
231231
frame_t* native_frame = stack_native_pop();
232232
if (!isvalid(native_frame)) {
233-
log_e("Invalid native frame");
234-
break;
233+
log_e("Invalid native frame"); // GCOV_EXCL_START
234+
break; // GCOV_EXCL_STOP
235235
}
236236
cached_string_t* scope = native_frame->scope;
237237
int is_frame_eval = (scope == UNKNOWN_SCOPE) ? FALSE : isvalid(strstr(scope->value, "PyEval_EvalFrameDefault"));
@@ -296,8 +296,8 @@ event_handler_t*
296296
mojo_event_handler_new(void) {
297297
event_handler_t* handler = (event_handler_t*)calloc(1, sizeof(base_event_handler_t));
298298
if (!isvalid(handler)) {
299-
log_e("Failed to allocate memory for event handler");
300-
return NULL;
299+
log_e("Failed to allocate memory for event handler"); // GCOV_EXCL_START
300+
return NULL; // GCOV_EXCL_STOP
301301
}
302302

303303
handler->spec.emit_stack_begin = (event_handler_stack_begin_t)mojo_event_handler__handle_stack_begin;
@@ -346,12 +346,12 @@ where_event_handler__handle_stack_end(base_event_handler_t* self) {
346346
while (!stack_native_is_empty()) {
347347
frame_t* native_frame = stack_native_pop();
348348
if (!isvalid(native_frame)) {
349-
log_e("Invalid native frame");
350-
break;
349+
log_e("Invalid native frame"); // GCOV_EXCL_START
350+
break; // GCOV_EXCL_STOP
351351
}
352352
cached_string_t* scope = native_frame->scope;
353353
if (!isvalid(scope)) {
354-
scope = UNKNOWN_SCOPE;
354+
scope = UNKNOWN_SCOPE; // GCOV_EXCL_LINE
355355
}
356356

357357
int is_frame_eval = (scope == UNKNOWN_SCOPE) ? FALSE : isvalid(strstr(scope->value, "PyEval_EvalFrameDefault"));
@@ -396,8 +396,8 @@ event_handler_t*
396396
where_event_handler_new(void) {
397397
event_handler_t* handler = (event_handler_t*)calloc(1, sizeof(base_event_handler_t));
398398
if (!isvalid(handler)) {
399-
log_e("Failed to allocate memory for event handler");
400-
return NULL;
399+
log_e("Failed to allocate memory for event handler"); // GCOV_EXCL_START
400+
return NULL; // GCOV_EXCL_STOP
401401
}
402402

403403
handler->spec.emit_stack_begin = (event_handler_stack_begin_t)where_event_handler__handle_stack_begin;

src/events.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ extern
9292
static inline void
9393
event_handler__emit_stack_begin(sample_t* sample) {
9494
if (!isvalid(event_handler))
95-
return;
95+
return; // GCOV_EXCL_LINE
9696

9797
event_handler_stack_begin_t handler = event_handler->spec.emit_stack_begin;
9898
if (isvalid(handler))
@@ -102,7 +102,7 @@ event_handler__emit_stack_begin(sample_t* sample) {
102102
static inline void
103103
event_handler__emit_metadata(char* key, char* value, ...) {
104104
if (!isvalid(event_handler))
105-
return;
105+
return; // GCOV_EXCL_LINE
106106

107107
va_list args;
108108
va_start(args, value);
@@ -117,7 +117,7 @@ event_handler__emit_metadata(char* key, char* value, ...) {
117117
static inline void
118118
event_handler__emit_new_string(cached_string_t* cached_string) {
119119
if (!isvalid(event_handler))
120-
return;
120+
return; // GCOV_EXCL_LINE
121121

122122
event_handler_new_string_t handler = event_handler->spec.emit_new_string;
123123
if (isvalid(handler))
@@ -127,7 +127,7 @@ event_handler__emit_new_string(cached_string_t* cached_string) {
127127
static inline void
128128
event_handler__emit_new_frame(void* frame) {
129129
if (!isvalid(event_handler))
130-
return;
130+
return; // GCOV_EXCL_LINE
131131

132132
event_handler_new_frame_t handler = event_handler->spec.emit_new_frame;
133133
if (isvalid(handler))
@@ -137,7 +137,7 @@ event_handler__emit_new_frame(void* frame) {
137137
static inline void
138138
event_handler__emit_stack_end(void) {
139139
if (!isvalid(event_handler))
140-
return;
140+
return; // GCOV_EXCL_LINE
141141

142142
event_handler_stack_end_t handler = event_handler->spec.emit_stack_end;
143143
if (isvalid(handler))

src/py_proc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,14 +1036,14 @@ _py_proc__get_memory_delta(py_proc_t* self) {
10361036
int
10371037
py_proc__get_gc_state(py_proc_t* self) {
10381038
if (!isvalid(self->gc_state_raddr))
1039-
return GC_STATE_UNKNOWN;
1039+
return GC_STATE_UNKNOWN; // GCOV_EXCL_LINE
10401040

10411041
V_DESC(self->py_v);
10421042

10431043
GCRuntimeState gc_state;
10441044
if (fail(py_proc__get_type(self, self->gc_state_raddr, gc_state))) {
10451045
log_d("Failed to get GC runtime state");
1046-
return GC_STATE_UNKNOWN;
1046+
return GC_STATE_UNKNOWN; // GCOV_EXCL_LINE
10471047
}
10481048

10491049
return V_FIELD(int, gc_state, py_gc, o_collecting);

src/py_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static inline cached_string_t*
5050
cached_string_new(key_dt key, char* value) {
5151
cached_string_t* cached_string = (cached_string_t*)malloc(sizeof(cached_string_t));
5252
if (!isvalid(cached_string)) {
53-
return NULL;
53+
return NULL; // GCOV_EXCL_LINE
5454
}
5555

5656
cached_string->key = key;

src/py_thread.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,9 @@ _py_thread__unwind_native_frame_stack(py_thread_t* self) {
613613
if (unw_get_proc_name(&cursor, _native_buf, MAXLEN, &offset) == 0) {
614614
scope = cached_string_new(scope_key, strdup(_native_buf));
615615
if (!isvalid(scope)) {
616-
log_ie("Failed to create scope string");
616+
log_ie("Failed to create scope string"); // GCOV_EXCL_START
617617
set_error(ETHREAD);
618-
FAIL;
618+
FAIL; // GCOV_EXCL_STOP
619619
}
620620
lru_cache__store(string_cache, scope_key, (value_t)scope);
621621
event_handler__emit_new_string(scope);
@@ -630,9 +630,9 @@ _py_thread__unwind_native_frame_stack(py_thread_t* self) {
630630
if (isvalid(range)) { // For now this is only relevant in `where` mode
631631
filename = cached_string_new((key_dt)pc, range->name);
632632
if (!isvalid(filename)) {
633-
log_ie("Failed to create filename string");
633+
log_ie("Failed to create filename string"); // GCOV_EXCL_START
634634
set_error(ETHREAD);
635-
FAIL;
635+
FAIL; // GCOV_EXCL_STOP
636636
}
637637
} else {
638638
// The program counter carries information about the file name *and*
@@ -647,9 +647,9 @@ _py_thread__unwind_native_frame_stack(py_thread_t* self) {
647647
sprintf(_native_buf, "native@%" PRIxPTR, pc);
648648
filename = cached_string_new(filename_key, strdup(_native_buf));
649649
if (!isvalid(filename)) {
650-
log_ie("Failed to create filename string");
650+
log_ie("Failed to create filename string"); // GCOV_EXCL_START
651651
set_error(ETHREAD);
652-
FAIL;
652+
FAIL; // GCOV_EXCL_STOP
653653
}
654654
lru_cache__store(string_cache, filename_key, (value_t)filename);
655655
event_handler__emit_new_string(filename);

src/stack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@
3939
int
4040
stack_allocate(size_t size) {
4141
if (isvalid(_stack))
42-
SUCCESS;
42+
SUCCESS; // GCOV_EXCL_LINE
4343

4444
_stack = (stack_dt*)calloc(1, sizeof(stack_dt));
4545
if (!isvalid(_stack))
46-
FAIL;
46+
FAIL; // GCOV_EXCL_LINE
4747

4848
_stack->size = size;
4949
_stack->base = (frame_t**)calloc(size, sizeof(frame_t*));
@@ -59,7 +59,7 @@ stack_allocate(size_t size) {
5959
void
6060
stack_deallocate(void) {
6161
if (!isvalid(_stack))
62-
return;
62+
return; // GCOV_EXCL_LINE
6363

6464
free(_stack->base);
6565
free(_stack->py_base);

0 commit comments

Comments
 (0)