On 11/12/24 5:57 PM, Mark Harmstone wrote:
If a function is contained in two sections, for instance if it is
partially cold, it gets a DW_AT_ranges attribute in its DIE rather than
the normal DW_AT_low_pc and DW_AT_high_pc.

There's no way to express this in CodeView, so rather than skipping the
function entirely, use the labels in the first entry in the range list.

gcc/
        * dwarf2codeview.cc (write_function): If no DW_AT_low_pc or
        DW_AT_high_pc in DIE, handle DW_AT_ranges instead.
        * dwarf2out.cc (struct dw_ranges): Move to dwarf2out.h.
        (get_AT_range_list): New function.
        (get_range_list_labels): New function.
        * dwarf2out.h (struct dw_ranges): Move from dwarf2out.cc.
        (get_AT_range_list, get_range_list_labels): Add declarations.
Presumably the first entries in the range list are for the "main" part of the function and thus you're getting something generally useful as opposed to just a random blob of (potentially cold) cold?




@@ -5532,6 +5513,36 @@ get_AT_file (dw_die_ref die, enum dwarf_attribute 
attr_kind)
    return a ? AT_file (a) : NULL;
  }
+dw_ranges *
+get_AT_range_list (dw_die_ref die, enum dwarf_attribute attr_kind)
Needs a function comment, similarly for get_range_list_labels. They're pretty simple functions, but even so we do try to make sure everything gets a basic function comment. So maybe something like

/* Return the range list for DIE with type ATTR_KIND or NULL if no
   range list exists.  */

For the get_AT_range_list. Something along the same lines for get_range_list_labels.

OK with that change.

jeff

Reply via email to