MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / inliners_search_cb

Class inliners_search_cb

src/backward.h:3101–3202  ·  view source on GitHub ↗

defined here because in C++98, template function cannot take locally defined types... grrr.

Source from the content-addressed store, hash-verified

3099 // defined here because in C++98, template function cannot take locally
3100 // defined types... grrr.
3101 struct inliners_search_cb {
3102 void operator()(Dwarf_Die die, std::vector<std::string>& ns)
3103 {
3104 Dwarf_Error error = DW_DLE_NE;
3105 Dwarf_Half tag_value;
3106 Dwarf_Attribute attr_mem;
3107 Dwarf_Debug dwarf = fobj.dwarf_handle.get();
3108
3109 dwarf_tag(die, &tag_value, &error);
3110
3111 switch (tag_value) {
3112 char* name;
3113 case DW_TAG_subprogram:
3114 if (!trace.source.function.empty())
3115 break;
3116 if (dwarf_diename(die, &name, &error) == DW_DLV_OK) {
3117 trace.source.function = std::string(name);
3118 dwarf_dealloc(dwarf, name, DW_DLA_STRING);
3119 }
3120 else {
3121 // We don't have a function name in this DIE.
3122 // Check if there is a referenced non-defining
3123 // declaration.
3124 trace.source.function = get_referenced_die_name(dwarf, die, DW_AT_abstract_origin, true);
3125 if (trace.source.function.empty()) {
3126 trace.source.function = get_referenced_die_name(dwarf, die, DW_AT_specification, true);
3127 }
3128 }
3129
3130 // Append the function parameters, if available
3131 set_function_parameters(trace.source.function, ns, fobj, die);
3132
3133 // If the object function name is empty, it's possible that
3134 // there is no dynamic symbol table (maybe the executable
3135 // was stripped or not built with -rdynamic). See if we have
3136 // a DWARF linkage name to use instead. We try both
3137 // linkage_name and MIPS_linkage_name because the MIPS tag
3138 // was the unofficial one until it was adopted in DWARF4.
3139 // Old gcc versions generate MIPS_linkage_name
3140 if (trace.object_function.empty()) {
3141 details::demangler demangler;
3142
3143 if (dwarf_attr(die, DW_AT_linkage_name, &attr_mem, &error) != DW_DLV_OK) {
3144 if (dwarf_attr(die, DW_AT_MIPS_linkage_name, &attr_mem, &error) != DW_DLV_OK) {
3145 break;
3146 }
3147 }
3148
3149 char* linkage;
3150 if (dwarf_formstring(attr_mem, &linkage, &error) == DW_DLV_OK) {
3151 trace.object_function = demangler.demangle(linkage);
3152 dwarf_dealloc(dwarf, linkage, DW_DLA_STRING);
3153 }
3154 dwarf_dealloc(dwarf, attr_mem, DW_DLA_ATTR);
3155 }
3156 break;
3157
3158 case DW_TAG_inlined_subroutine:

Callers 2

resolveMethod · 0.70
resolveMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected