+2018-11-22 Tom de Vries <tdevries@suse.de>
+
+ * dwarf.c (read_initial_length): Factor out of ...
+ (build_address_map, read_line_info): ... here.
+
2018-11-21 Tom de Vries <tdevries@suse.de>
* dwarf.c (read_string): Factor out of ...
return ret;
}
+/* Read initial_length from BUF and advance the appropriate number of bytes. */
+
+static uint64_t
+read_initial_length (struct dwarf_buf *buf, int *is_dwarf64)
+{
+ uint64_t len;
+
+ len = read_uint32 (buf);
+ if (len == 0xffffffff)
+ {
+ len = read_uint64 (buf);
+ *is_dwarf64 = 1;
+ }
+ else
+ *is_dwarf64 = 0;
+
+ return len;
+}
+
/* Free an abbreviations structure. */
static void
unit_data_start = info.buf;
- is_dwarf64 = 0;
- len = read_uint32 (&info);
- if (len == 0xffffffff)
- {
- len = read_uint64 (&info);
- is_dwarf64 = 1;
- }
-
+ len = read_initial_length (&info, &is_dwarf64);
unit_buf = info;
unit_buf.left = len;
line_buf.data = data;
line_buf.reported_underflow = 0;
- is_dwarf64 = 0;
- len = read_uint32 (&line_buf);
- if (len == 0xffffffff)
- {
- len = read_uint64 (&line_buf);
- is_dwarf64 = 1;
- }
+ len = read_initial_length (&line_buf, &is_dwarf64);
line_buf.left = len;
if (!read_line_header (state, u, is_dwarf64, &line_buf, hdr))