Branch Coverage

src/panda/dwarf.cc
Criterion Covered Total %
branch 31 276 11.2


line true false branch
26 8091 261 for (auto& so: so_map) {
27 8091 0 auto info = std::make_unique(so);
28 8091 0 string real_path(PANDA_PATH_MAX);
32 8091 0 file = fopen(so.name.c_str(), "rb");
8091 0 file = fopen(so.name.c_str(), "rb");
33 8091 0 DwarfInfo::file_guard_t file_guard (file, [](auto* f){ if (f) {fclose(f); }});
8091 0 DwarfInfo::file_guard_t file_guard (file, [](auto* f){ if (f) {fclose(f); }});
34 8091 0 int fd = file ? fileno(file) : 0;
35 8091 0 if (fd > 0) {
36 8091 0 auto err = dwarf_init_b(fd, DW_DLC_READ, DW_GROUPNUMBER_ANY, nullptr, &info->err_arg, &info->debug, &error);
38 8091 0 if (err == DW_DLV_OK) {
48 8091 0 result.emplace(so.name, std::move(info));
57 261 0 gather_info(so_map);
58 261 0 auto map = load_dwarf_info(so_map);
60 3370 0 for(auto& it: map) {
63 261 3109 if (frame) return frame;
3109 261 if (frame) return frame;
74 8091 0 if (debug) {
78 0 8091 if (res != DW_DLV_OK) {
96 8091 0 if (res != DW_DLV_OK) { break; }
101 0 0 if (res != DW_DLV_OK) { break; }
103 0 8091 dwarf::DieHolder cu_die_holder(cu_die, debug, nullptr);
112 493 2877 if (ip < so_info.begin || ip >= so_info.end) { return StackframePtr(); }
232 261 if (ip < so_info.begin || ip >= so_info.end) { return StackframePtr(); }
117 0 261 for(auto it = CUs.begin(); it != CUs.end(); ++it){
121 0 0 if (r.is_complete()) { return r.get_frame(ip, so_info); }
0 0 if (r.is_complete()) { return r.get_frame(ip, so_info); }
139 0 0 bool LookupResult::is_complete() noexcept { return cu && subprogram; }
0 0 bool LookupResult::is_complete() noexcept { return cu && subprogram; }
151 0 0 if (subprogram) {
157 0 0 if (cu) {
170 0 0 }
177 0 0 if (res == DW_DLV_OK) {
180 0 0 if (res == DW_DLV_OK) {
182 0 0 if (res == DW_DLV_OK) { return r; }
190 0 0 while (p->parent) { p = p->parent; }
199 0 0 if(res == DW_DLV_OK) {
203 0 0 assert(res == DW_DLV_OK);
216 0 0 assert(res == DW_DLV_OK);
217 0 0 if (off == target_offset) { return node.detach(); }
218 0 0 if (off > target_offset) { return panda::iptr(); } /* do not lookup for fail branch */
223 0 0 if (res == DW_DLV_OK) {
225 0 0 auto found = discover(target_offset, child);
226 0 0 if (found) { return found; }
0 0 if (found) { return found; }
231 0 0 if (res == DW_DLV_OK) {
233 0 0 auto found = discover(target_offset, child);
234 0 0 if (found) { return found; }
0 0 if (found) { return found; }
242 0 0 if (!details.name) {
246 0 0 if (res == DW_DLV_OK) {
247 0 0 iptr node = (it == die) ? iptr(this) : discover(it);
257 0 0 assert(res == DW_DLV_OK);
262 0 0 while(p) {
265 0 0 assert(res == DW_DLV_OK);
266 0 0 if (tag == DW_TAG_structure_type || tag == DW_TAG_class_type || tag == DW_TAG_namespace) {
0 0 if (tag == DW_TAG_structure_type || tag == DW_TAG_class_type || tag == DW_TAG_namespace) {
0 0 if (tag == DW_TAG_structure_type || tag == DW_TAG_class_type || tag == DW_TAG_namespace) {
269 0 0 if (res == DW_DLV_OK) {
272 0 0 assert(res == DW_DLV_OK);
286 0 0 if (!cu) { return; }
291 0 0 if (res != DW_DLV_OK) { return; }
298 0 0 if (res != DW_DLV_OK) { return; }
299 0 0 LineContextHolder line_context_guard(&line_context, [](auto it){ dwarf_srclines_dealloc_b(*it); });
304 0 0 if (res != DW_DLV_OK) { return; }
308 0 0 for (Dwarf_Signed i = base_index; i < end_index; ++i) {
315 0 0 if (res != DW_DLV_OK) { return; }
316 0 0 if (cu_name.find(source_name) != string::npos) {
317 0 0 if (dirindex) {
320 0 0 if (res != DW_DLV_OK) { return; }
322 0 0 if (cu_name.find(dir_name) != string::npos) {
333 0 0 if (cu_index == -1) { return; }
338 0 0 if (res != DW_DLV_OK) { return; }
343 0 0 for(Dwarf_Signed i = 0; i < linecount; ++i) {
349 0 0 if (res != DW_DLV_OK) { return; }
351 0 0 if (res != DW_DLV_OK) { return; }
353 0 0 if (res != DW_DLV_OK) { return; }
354 0 0 if (file_index != static_cast(cu_index)) { continue; }
356 0 0 if (lineaddr >= lr.offset) { found = true; break; }
360 0 0 if (found) {
361 0 0 details.line_no = prev_lineno;
368 0 0 if (!details.line_no) {
373 0 0 if (res == DW_DLV_OK) {
376 0 0 if (res == DW_DLV_OK) { details.line_no = line; }
388 0 0 if (!r.line_no || !r.name) {
0 0 if (!r.line_no || !r.name) {
0 0 if (!r.line_no || !r.name) {
390 0 0 if (die_spec) {
395 0 0 if (!r.line_no || !r.name) {
0 0 if (!r.line_no || !r.name) {
0 0 if (!r.line_no || !r.name) {
397 0 0 if (die_ao) {
399 0 0 if (die_ao) { refine_fn_ao(die_ao, r); }
408 0 0 if (die_spec) { refine_fn_spec(die_spec, details); }
423 0 0 if (res == DW_DLV_OK && name) { r.name = name; }
0 0 if (res == DW_DLV_OK && name) { r.name = name; }
428 0 0 assert(!owner || owner->die);
0 0 assert(!owner || owner->die);
434 0 0 if (!owner) { dwarf_dealloc(debug, die,DW_DLA_DIE); }
438 0 0 if (!owner) {
439 0 0 panda::iptr parent_ptr(parent ? parent->detach() : nullptr);
0 0 panda::iptr parent_ptr(parent ? parent->detach() : nullptr);
440 0 0 owner = panda::iptr(new DieRC(die, debug, parent_ptr));
0 0 owner = panda::iptr(new DieRC(die, debug, parent_ptr));
451 0 0 if (res == DW_DLV_OK) {
455 0 0 if (res == DW_DLV_OK) {
456 0 0 if (formclass == DW_FORM_CLASS_CONSTANT) { high += low; }
466 0 0 if (addr) {
467 0 0 if ((addr->high >= offset) || (addr->low < offset)) {
0 0 if ((addr->high >= offset) || (addr->low < offset)) {
0 0 if ((addr->high >= offset) || (addr->low < offset)) {
476 0 0 if (res == DW_DLV_OK) {
479 0 0 if (res == DW_DLV_OK) {
484 0 0 if (res == DW_DLV_OK) {
486 0 0 for(int i = 0; i < ranges_count; ++i) {
493 0 0 auto matches = (low <= offset) && (high > offset);
0 0 auto matches = (low <= offset) && (high > offset);
495 0 0 if (matches) {return Match::yes; }
502 0 0 if (ranges_count > 0) { return Match::no; }
517 0 0 assert(cu_die);
528 0 0 if (er || lr.is_complete()) { return er; }
0 0 if (er || lr.is_complete()) { return er; }
0 0 if (er || lr.is_complete()) { return er; }
536 0 0 if (res == DW_DLV_OK) {
539 0 0 if (lr.is_complete()) { return true; }
0 0 if (lr.is_complete()) { return true; }
540 0 0 } else if (res == DW_DLV_NO_ENTRY) {
548 0 0 if(res == DW_DLV_OK) {
551 0 0 if (lr.is_complete()) { return true; }
0 0 if (lr.is_complete()) { return true; }
552 0 0 } else if (res == DW_DLV_NO_ENTRY) {
565 0 0 assert(die.die);
567 0 0 if (res != DW_DLV_OK) { return true; }
569 0 0 if( tag == DW_TAG_subprogram ||
0 0 if( tag == DW_TAG_subprogram ||
581 0 0 else if(tag == DW_TAG_compile_unit) {
596 6 0 }}}
6 0 }}}