MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / read_lnct

Function read_lnct

Dependencies/tracy/libbacktrace/dwarf.cpp:2813–2894  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2811 data. Return 1 on success, 0 on failure. */
2812
2813static int
2814read_lnct (struct backtrace_state *state, struct dwarf_data *ddata,
2815 struct unit *u, struct dwarf_buf *hdr_buf,
2816 const struct line_header *hdr, size_t formats_count,
2817 const struct line_header_format *formats, const char **string)
2818{
2819 size_t i;
2820 const char *dir;
2821 const char *path;
2822
2823 dir = NULL;
2824 path = NULL;
2825 for (i = 0; i < formats_count; i++)
2826 {
2827 struct attr_val val;
2828
2829 if (!read_attribute (formats[i].form, 0, hdr_buf, u->is_dwarf64,
2830 u->version, hdr->addrsize, &ddata->dwarf_sections,
2831 ddata->altlink, &val))
2832 return 0;
2833 switch (formats[i].lnct)
2834 {
2835 case DW_LNCT_path:
2836 if (!resolve_string (&ddata->dwarf_sections, u->is_dwarf64,
2837 ddata->is_bigendian, u->str_offsets_base,
2838 &val, hdr_buf->error_callback, hdr_buf->data,
2839 &path))
2840 return 0;
2841 break;
2842 case DW_LNCT_directory_index:
2843 if (val.encoding == ATTR_VAL_UINT)
2844 {
2845 if (val.u.uint >= hdr->dirs_count)
2846 {
2847 dwarf_buf_error (hdr_buf,
2848 ("invalid directory index in "
2849 "line number program header"),
2850 0);
2851 return 0;
2852 }
2853 dir = hdr->dirs[val.u.uint];
2854 }
2855 break;
2856 default:
2857 /* We don't care about timestamps or sizes or hashes. */
2858 break;
2859 }
2860 }
2861
2862 if (path == NULL)
2863 {
2864 dwarf_buf_error (hdr_buf,
2865 "missing file name in line number program header",
2866 0);
2867 return 0;
2868 }
2869
2870 if (dir == NULL)

Callers 1

Calls 4

read_attributeFunction · 0.85
resolve_stringFunction · 0.85
dwarf_buf_errorFunction · 0.85
backtrace_allocFunction · 0.85

Tested by

no test coverage detected