| 3359 | } |
| 3360 | |
| 3361 | static std::string die_call_file(Dwarf_Debug dwarf, Dwarf_Die die, Dwarf_Die cu_die) |
| 3362 | { |
| 3363 | Dwarf_Attribute attr_mem; |
| 3364 | Dwarf_Error error = DW_DLE_NE; |
| 3365 | Dwarf_Unsigned file_index; |
| 3366 | |
| 3367 | std::string file; |
| 3368 | |
| 3369 | if (dwarf_attr(die, DW_AT_call_file, &attr_mem, &error) == DW_DLV_OK) { |
| 3370 | if (dwarf_formudata(attr_mem, &file_index, &error) != DW_DLV_OK) { |
| 3371 | file_index = 0; |
| 3372 | } |
| 3373 | dwarf_dealloc(dwarf, attr_mem, DW_DLA_ATTR); |
| 3374 | |
| 3375 | if (file_index == 0) { |
| 3376 | return file; |
| 3377 | } |
| 3378 | |
| 3379 | char** srcfiles = 0; |
| 3380 | Dwarf_Signed file_count = 0; |
| 3381 | if (dwarf_srcfiles(cu_die, &srcfiles, &file_count, &error) == DW_DLV_OK) { |
| 3382 | if (file_count > 0 && file_index <= static_cast<Dwarf_Unsigned>(file_count)) { |
| 3383 | file = std::string(srcfiles[file_index - 1]); |
| 3384 | } |
| 3385 | |
| 3386 | // Deallocate all strings! |
| 3387 | for (int i = 0; i < file_count; ++i) { |
| 3388 | dwarf_dealloc(dwarf, srcfiles[i], DW_DLA_STRING); |
| 3389 | } |
| 3390 | dwarf_dealloc(dwarf, srcfiles, DW_DLA_LIST); |
| 3391 | } |
| 3392 | } |
| 3393 | return file; |
| 3394 | } |
| 3395 | |
| 3396 | Dwarf_Die find_die(dwarf_fileobject& fobj, Dwarf_Addr addr) |
| 3397 | { |
no outgoing calls
no test coverage detected