1 /* Copyright (c) 2008-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
16 #include <elfutils/libdw.h>
20 #include "mc/Frame.hpp"
21 #include "mc/ObjectInformation.hpp"
22 #include "mc/Variable.hpp"
24 #include "mc/mc_dwarf.hpp"
25 #include "mc/mc_libdw.hpp"
27 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_libdw, mc, "DWARF processing");
29 /** \brief Get the name of the tag of a given DIE
32 * \return name of the tag of this DIE
34 static inline const char *MC_dwarf_die_tagname(Dwarf_Die * die)
36 return MC_dwarf_tagname(dwarf_tag(die));
40 simgrid::mc::DwarfExpression MC_dwarf_expression(Dwarf_Op* ops, std::size_t len)
42 simgrid::mc::DwarfExpression expression(len);
43 for (std::size_t i = 0; i != len; ++i) {
44 expression[i].atom = ops[i].atom;
45 expression[i].number = ops[i].number;
46 expression[i].number2 = ops[i].number2;
47 expression[i].offset = ops[i].offset;
49 return std::move(expression);
52 static void mc_dwarf_location_list_init_libdw(
53 simgrid::mc::LocationList* list, simgrid::mc::ObjectInformation* info,
54 Dwarf_Die * die, Dwarf_Attribute * attr)
59 Dwarf_Addr base, start, end;
65 offset = dwarf_getlocations(attr, offset, &base, &start, &end, &ops, &len);
68 else if (offset == -1)
69 xbt_die("Error while loading location list");
71 simgrid::mc::LocationListEntry entry;
72 entry.expression = MC_dwarf_expression(ops, len);
74 void *base = info->base_address();
75 // If start == 0, this is not a location list:
76 entry.lowpc = start == 0 ? NULL : (char *) base + start;
77 entry.highpc = start == 0 ? NULL : (char *) base + end;
79 list->push_back(std::move(entry));
86 /** \brief Get an attribute of a given DIE as a string
89 * \param attribute attribute
90 * \return value of the given attribute of the given DIE
92 static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die,
96 if (!dwarf_attr_integrate(die, attribute, &attr)) {
99 return dwarf_formstring(&attr);
103 /** \brief Get the linkage name of a DIE.
105 * Use either DW_AT_linkage_name or DW_AT_MIPS_linkage_name.
106 * DW_AT_linkage_name is standardized since DWARF 4.
107 * Before this version of DWARF, the MIPS extensions
108 * DW_AT_MIPS_linkage_name is used (at least by GCC).
111 * \return linkage name of the given DIE (or NULL)
113 static const char *MC_dwarf_at_linkage_name(Dwarf_Die * die)
115 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_linkage_name);
117 name = MC_dwarf_attr_integrate_string(die, DW_AT_MIPS_linkage_name);
121 static Dwarf_Off MC_dwarf_attr_dieoffset(Dwarf_Die * die, int attribute)
123 Dwarf_Attribute attr;
124 if (dwarf_hasattr_integrate(die, attribute) == 0)
126 dwarf_attr_integrate(die, attribute, &attr);
127 Dwarf_Die subtype_die;
128 if (dwarf_formref_die(&attr, &subtype_die) == NULL)
129 xbt_die("Could not find DIE");
130 return dwarf_dieoffset(&subtype_die);
133 static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die * die,
136 Dwarf_Attribute attr;
137 if (dwarf_hasattr_integrate(die, attribute) == 0)
139 dwarf_attr_integrate(die, DW_AT_type, &attr);
140 Dwarf_Die subtype_die;
141 if (dwarf_formref_die(&attr, &subtype_die) == NULL)
142 xbt_die("Could not find DIE");
143 return dwarf_dieoffset(&subtype_die);
146 /** \brief Find the type/subtype (DW_AT_type) for a DIE
149 * \return DW_AT_type reference as a global offset in hexadecimal (or NULL)
152 std::uint64_t MC_dwarf_at_type(Dwarf_Die * die)
154 return MC_dwarf_attr_integrate_dieoffset(die, DW_AT_type);
157 static std::uint64_t MC_dwarf_attr_integrate_addr(Dwarf_Die * die, int attribute)
159 Dwarf_Attribute attr;
160 if (dwarf_attr_integrate(die, attribute, &attr) == NULL)
163 if (dwarf_formaddr(&attr, &value) == 0)
164 return (std::uint64_t) value;
169 static std::uint64_t MC_dwarf_attr_integrate_uint(Dwarf_Die * die, int attribute,
170 std::uint64_t default_value)
172 Dwarf_Attribute attr;
173 if (dwarf_attr_integrate(die, attribute, &attr) == NULL)
174 return default_value;
176 return dwarf_formudata(dwarf_attr_integrate(die, attribute, &attr),
177 &value) == 0 ? (std::uint64_t) value : default_value;
180 static bool MC_dwarf_attr_flag(Dwarf_Die * die, int attribute, bool integrate)
182 Dwarf_Attribute attr;
183 if ((integrate ? dwarf_attr_integrate(die, attribute, &attr)
184 : dwarf_attr(die, attribute, &attr)) == 0)
188 if (dwarf_formflag(&attr, &result))
189 xbt_die("Unexpected form for attribute %s", MC_dwarf_attrname(attribute));
193 /** \brief Finds the number of elements in a DW_TAG_subrange_type or DW_TAG_enumeration_type DIE
196 * \param unit DIE of the compilation unit
197 * \return number of elements in the range
199 static std::uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die,
202 xbt_assert(dwarf_tag(die) == DW_TAG_enumeration_type
203 || dwarf_tag(die) == DW_TAG_subrange_type,
204 "MC_dwarf_subrange_element_count called with DIE of type %s",
205 MC_dwarf_die_tagname(die));
207 // Use DW_TAG_count if present:
208 if (dwarf_hasattr_integrate(die, DW_AT_count))
209 return MC_dwarf_attr_integrate_uint(die, DW_AT_count, 0);
210 // Otherwise compute DW_TAG_upper_bound-DW_TAG_lower_bound + 1:
212 if (!dwarf_hasattr_integrate(die, DW_AT_upper_bound))
213 // This is not really 0, but the code expects this (we do not know):
216 std::uint64_t upper_bound =
217 MC_dwarf_attr_integrate_uint(die, DW_AT_upper_bound, -1);
219 std::uint64_t lower_bound = 0;
220 if (dwarf_hasattr_integrate(die, DW_AT_lower_bound))
221 lower_bound = MC_dwarf_attr_integrate_uint(die, DW_AT_lower_bound, -1);
223 lower_bound = MC_dwarf_default_lower_bound(dwarf_srclang(unit));
224 return upper_bound - lower_bound + 1;
227 /** \brief Finds the number of elements in a array type (DW_TAG_array_type)
229 * The compilation unit might be needed because the default lower
230 * bound depends on the language of the compilation unit.
232 * \param die the DIE of the DW_TAG_array_type
233 * \param unit the DIE of the compilation unit
234 * \return number of elements in this array type
237 std::uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit)
239 xbt_assert(dwarf_tag(die) == DW_TAG_array_type,
240 "MC_dwarf_array_element_count called with DIE of type %s",
241 MC_dwarf_die_tagname(die));
246 for (res = dwarf_child(die, &child); res == 0;
247 res = dwarf_siblingof(&child, &child)) {
248 int child_tag = dwarf_tag(&child);
249 if (child_tag == DW_TAG_subrange_type
250 || child_tag == DW_TAG_enumeration_type)
251 result *= MC_dwarf_subrange_element_count(&child, unit);
256 // ***** simgrid::mc::Type*
258 /** \brief Initialize the location of a member of a type
259 * (DW_AT_data_member_location of a DW_TAG_member).
261 * \param type a type (struct, class)
262 * \param member the member of the type
263 * \param child DIE of the member (DW_TAG_member)
265 static void MC_dwarf_fill_member_location(simgrid::mc::Type* type, simgrid::mc::Type* member,
268 if (dwarf_hasattr(child, DW_AT_data_bit_offset))
269 xbt_die("Can't groke DW_AT_data_bit_offset.");
271 if (!dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
272 if (type->type == DW_TAG_union_type)
275 ("Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%"
276 PRIx64 ">%s", member->name.c_str(),
277 (std::uint64_t) type->id, type->name.c_str());
280 Dwarf_Attribute attr;
281 dwarf_attr_integrate(child, DW_AT_data_member_location, &attr);
282 int form = dwarf_whatform(&attr);
283 int klass = MC_dwarf_form_get_class(form);
285 case MC_DW_CLASS_EXPRLOC:
286 case MC_DW_CLASS_BLOCK:
287 // Location expression:
291 if (dwarf_getlocation(&attr, &expr, &len))
293 ("Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%"
294 PRIx64 ">%s", MC_dwarf_attr_integrate_string(child, DW_AT_name),
295 (std::uint64_t) type->id, type->name.c_str());
296 member->location_expression = MC_dwarf_expression(expr, len);
299 case MC_DW_CLASS_CONSTANT:
300 // Offset from the base address of the object:
303 if (!dwarf_formudata(&attr, &offset))
304 member->offset(offset);
306 xbt_die("Cannot get %s location <%" PRIx64 ">%s",
307 MC_dwarf_attr_integrate_string(child, DW_AT_name),
308 (std::uint64_t) type->id, type->name.c_str());
311 case MC_DW_CLASS_LOCLISTPTR:
312 // Reference to a location list:
314 case MC_DW_CLASS_REFERENCE:
315 // It's supposed to be possible in DWARF2 but I couldn't find its semantic
318 xbt_die("Can't handle form class (%i) / form 0x%x as DW_AT_member_location",
324 /** \brief Populate the list of members of a type
326 * \param info ELF object containing the type DIE
327 * \param die DIE of the type
328 * \param unit DIE of the compilation unit containing the type DIE
329 * \param type the type
331 static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
332 Dwarf_Die * unit, simgrid::mc::Type* type)
336 xbt_assert(type->members.empty());
337 for (res = dwarf_child(die, &child); res == 0;
338 res = dwarf_siblingof(&child, &child)) {
339 int tag = dwarf_tag(&child);
340 if (tag == DW_TAG_member || tag == DW_TAG_inheritance) {
342 // Skip declarations:
343 if (MC_dwarf_attr_flag(&child, DW_AT_declaration, false))
346 // Skip compile time constants:
347 if (dwarf_hasattr(&child, DW_AT_const_value))
350 // TODO, we should use another type (because is is not a type but a member)
351 simgrid::mc::Type member;
355 member.id = dwarf_dieoffset(&child);
357 const char *name = MC_dwarf_attr_integrate_string(&child, DW_AT_name);
361 MC_dwarf_attr_integrate_uint(&child, DW_AT_byte_size, 0);
362 member.element_count = -1;
363 member.type_id = MC_dwarf_at_type(&child);
365 if (dwarf_hasattr(&child, DW_AT_data_bit_offset))
366 xbt_die("Can't groke DW_AT_data_bit_offset.");
368 MC_dwarf_fill_member_location(type, &member, &child);
371 xbt_die("Missing type for member %s of <%" PRIx64 ">%s",
373 (std::uint64_t) type->id, type->name.c_str());
375 type->members.push_back(std::move(member));
380 /** \brief Create a MC type object from a DIE
382 * \param info current object info object
383 * \param DIE (for a given type);
384 * \param unit compilation unit of the current DIE
385 * \return MC representation of the type
387 static simgrid::mc::Type MC_dwarf_die_to_type(
388 simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
389 Dwarf_Die * unit, simgrid::mc::Frame* frame,
392 simgrid::mc::Type type;
393 type.type = dwarf_tag(die);
394 type.name = std::string();
395 type.element_count = -1;
398 type.id = dwarf_dieoffset(die);
400 const char *prefix = "";
402 case DW_TAG_structure_type:
405 case DW_TAG_union_type:
408 case DW_TAG_class_type:
415 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
417 char* full_name = ns ? bprintf("%s%s::%s", prefix, ns, name) :
418 bprintf("%s%s", prefix, name);
419 type.name = std::string(full_name);
423 type.type_id = MC_dwarf_at_type(die);
425 // Some compilers do not emit DW_AT_byte_size for pointer_type,
426 // so we fill this. We currently assume that the model-checked process is in
427 // the same architecture..
428 if (type.type == DW_TAG_pointer_type)
429 type.byte_size = sizeof(void*);
431 // Computation of the byte_size;
432 if (dwarf_hasattr_integrate(die, DW_AT_byte_size))
433 type.byte_size = MC_dwarf_attr_integrate_uint(die, DW_AT_byte_size, 0);
434 else if (type.type == DW_TAG_array_type
435 || type.type == DW_TAG_structure_type
436 || type.type == DW_TAG_class_type) {
438 if (dwarf_aggregate_size(die, &size) == 0)
439 type.byte_size = size;
443 case DW_TAG_array_type:
444 type.element_count = MC_dwarf_array_element_count(die, unit);
445 // TODO, handle DW_byte_stride and (not) DW_bit_stride
448 case DW_TAG_pointer_type:
449 case DW_TAG_reference_type:
450 case DW_TAG_rvalue_reference_type:
451 type.is_pointer_type = 1;
454 case DW_TAG_structure_type:
455 case DW_TAG_union_type:
456 case DW_TAG_class_type:
457 MC_dwarf_add_members(info, die, unit, &type);
458 char *new_ns = ns == NULL ? xbt_strdup(type.name.c_str())
459 : bprintf("%s::%s", ns, name);
460 MC_dwarf_handle_children(info, die, unit, frame, new_ns);
465 return std::move(type);
468 static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
469 Dwarf_Die * unit, simgrid::mc::Frame* frame,
472 simgrid::mc::Type type = MC_dwarf_die_to_type(info, die, unit, frame, ns);
473 auto& t = (info->types[type.id] = std::move(type));
474 if (!t.name.empty() && type.byte_size != 0)
475 info->full_types_by_name[t.name] = &t;
478 static int mc_anonymous_variable_index = 0;
480 static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
481 simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
482 Dwarf_Die * unit, simgrid::mc::Frame* frame,
485 // Skip declarations:
486 if (MC_dwarf_attr_flag(die, DW_AT_declaration, false))
489 // Skip compile time constants:
490 if (dwarf_hasattr(die, DW_AT_const_value))
493 Dwarf_Attribute attr_location;
494 if (dwarf_attr(die, DW_AT_location, &attr_location) == NULL)
495 // No location: do not add it ?
498 std::unique_ptr<simgrid::mc::Variable> variable =
499 std::unique_ptr<simgrid::mc::Variable>(new simgrid::mc::Variable());
500 variable->dwarf_offset = dwarf_dieoffset(die);
501 variable->global = frame == NULL; // Can be override base on DW_AT_location
502 variable->object_info = info;
504 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
506 variable->name = name;
507 variable->type_id = MC_dwarf_at_type(die);
509 int form = dwarf_whatform(&attr_location);
512 DW_FORM_sec_offset ? MC_DW_CLASS_CONSTANT : MC_dwarf_form_get_class(form);
514 case MC_DW_CLASS_EXPRLOC:
515 case MC_DW_CLASS_BLOCK:
516 // Location expression:
520 if (dwarf_getlocation(&attr_location, &expr, &len)) {
522 "Could not read location expression in DW_AT_location "
523 "of variable <%" PRIx64 ">%s",
524 (std::uint64_t) variable->dwarf_offset,
525 variable->name.c_str());
528 if (len == 1 && expr[0].atom == DW_OP_addr) {
529 variable->global = 1;
530 uintptr_t offset = (uintptr_t) expr[0].number;
531 uintptr_t base = (uintptr_t) info->base_address();
532 variable->address = (void *) (base + offset);
534 simgrid::mc::LocationListEntry entry;
535 entry.expression = MC_dwarf_expression(expr, len);
536 variable->location_list = { std::move(entry) };
541 case MC_DW_CLASS_LOCLISTPTR:
542 case MC_DW_CLASS_CONSTANT:
543 // Reference to location list:
544 mc_dwarf_location_list_init_libdw(
545 &variable->location_list, info, die,
549 xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location "
550 "in <%" PRIx64 ">%s",
551 form, form, klass, klass,
552 (std::uint64_t) variable->dwarf_offset,
553 variable->name.c_str());
556 // Handle start_scope:
557 if (dwarf_hasattr(die, DW_AT_start_scope)) {
558 Dwarf_Attribute attr;
559 dwarf_attr(die, DW_AT_start_scope, &attr);
560 int form = dwarf_whatform(&attr);
561 int klass = MC_dwarf_form_get_class(form);
563 case MC_DW_CLASS_CONSTANT:
566 variable->start_scope =
567 dwarf_formudata(&attr, &value) == 0 ? (size_t) value : 0;
570 case MC_DW_CLASS_RANGELISTPTR: // TODO
573 ("Unhandled form 0x%x, class 0x%X for DW_AT_start_scope of variable %s",
574 form, klass, name == NULL ? "?" : name);
578 if (ns && variable->global)
580 std::string(ns) + "::" + variable->name;
582 // The current code needs a variable name,
583 // generate a fake one:
584 if (variable->name.empty())
586 "@anonymous#" + std::to_string(mc_anonymous_variable_index++);
588 return std::move(variable);
591 static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
592 Dwarf_Die * unit, simgrid::mc::Frame* frame,
595 std::unique_ptr<simgrid::mc::Variable> variable =
596 MC_die_to_variable(info, die, unit, frame, ns);
599 // Those arrays are sorted later:
600 else if (variable->global)
601 info->global_variables.push_back(std::move(*variable));
602 else if (frame != nullptr)
603 frame->variables.push_back(std::move(*variable));
605 xbt_die("No frame for this local variable");
608 static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
609 Dwarf_Die * unit, simgrid::mc::Frame* parent_frame,
612 // TODO, handle DW_TAG_type/DW_TAG_location for DW_TAG_with_stmt
613 int tag = dwarf_tag(die);
614 mc_tag_class klass = MC_dwarf_tag_classify(tag);
616 // (Template) Subprogram declaration:
617 if (klass == mc_tag_subprogram
618 && MC_dwarf_attr_flag(die, DW_AT_declaration, false))
621 if (klass == mc_tag_scope)
622 xbt_assert(parent_frame, "No parent scope for this scope");
624 simgrid::mc::Frame frame;
627 frame.id = dwarf_dieoffset(die);
628 frame.object_info = info;
630 if (klass == mc_tag_subprogram) {
631 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
633 frame.name = std::string(ns) + "::" + name;
640 frame.abstract_origin_id =
641 MC_dwarf_attr_dieoffset(die, DW_AT_abstract_origin);
643 // This is the base address for DWARF addresses.
644 // Relocated addresses are offset from this base address.
645 // See DWARF4 spec 7.5
646 void *base = info->base_address();
648 // TODO, support DW_AT_ranges
649 std::uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
650 frame.low_pc = low_pc ? ((char *) base) + low_pc : 0;
653 Dwarf_Attribute attr;
654 if (!dwarf_attr_integrate(die, DW_AT_high_pc, &attr)) {
655 xbt_die("Missing DW_AT_high_pc matching with DW_AT_low_pc");
661 switch (MC_dwarf_form_get_class(dwarf_whatform(&attr))) {
663 // DW_AT_high_pc if an offset from the low_pc:
664 case MC_DW_CLASS_CONSTANT:
666 if (dwarf_formsdata(&attr, &offset) != 0)
667 xbt_die("Could not read constant");
668 frame.high_pc = (void *) ((char *) frame.low_pc + offset);
671 // DW_AT_high_pc is a relocatable address:
672 case MC_DW_CLASS_ADDRESS:
673 if (dwarf_formaddr(&attr, &high_pc) != 0)
674 xbt_die("Could not read address");
675 frame.high_pc = ((char *) base) + high_pc;
679 xbt_die("Unexpected class for DW_AT_high_pc");
684 if (klass == mc_tag_subprogram) {
685 Dwarf_Attribute attr_frame_base;
686 if (dwarf_attr_integrate(die, DW_AT_frame_base, &attr_frame_base))
687 mc_dwarf_location_list_init_libdw(&frame.frame_base, info, die,
692 MC_dwarf_handle_children(info, die, unit, &frame, ns);
694 // Someone needs this to be sorted but who?
695 std::sort(frame.variables.begin(), frame.variables.end(),
696 MC_compare_variable);
699 if (klass == mc_tag_subprogram)
700 info->subprograms[frame.id] = frame;
701 else if (klass == mc_tag_scope)
702 parent_frame->scopes.push_back(std::move(frame));
705 static void mc_dwarf_handle_namespace_die(simgrid::mc::ObjectInformation* info,
706 Dwarf_Die * die, Dwarf_Die * unit,
707 simgrid::mc::Frame* frame,
710 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
712 xbt_die("Unexpected namespace in a subprogram");
713 char *new_ns = ns == NULL ? xbt_strdup(name)
714 : bprintf("%s::%s", ns, name);
715 MC_dwarf_handle_children(info, die, unit, frame, new_ns);
719 static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
720 Dwarf_Die * unit, simgrid::mc::Frame* frame,
723 // For each child DIE:
726 for (res = dwarf_child(die, &child); res == 0;
727 res = dwarf_siblingof(&child, &child)) {
728 MC_dwarf_handle_die(info, &child, unit, frame, ns);
732 static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
733 Dwarf_Die * unit, simgrid::mc::Frame* frame,
736 int tag = dwarf_tag(die);
737 mc_tag_class klass = MC_dwarf_tag_classify(tag);
742 MC_dwarf_handle_type_die(info, die, unit, frame, ns);
745 // Subprogram or scope:
746 case mc_tag_subprogram:
748 MC_dwarf_handle_scope_die(info, die, unit, frame, ns);
752 case mc_tag_variable:
753 MC_dwarf_handle_variable_die(info, die, unit, frame, ns);
756 case mc_tag_namespace:
757 mc_dwarf_handle_namespace_die(info, die, unit, frame, ns);
766 /** \brief Populate the debugging informations of the given ELF object
768 * Read the DWARf information of the EFFL object and populate the
769 * lists of types, variables, functions.
771 void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
773 int fd = open(info->file_name.c_str(), O_RDONLY);
775 xbt_die("Could not open file %s", info->file_name.c_str());
776 Dwarf *dwarf = dwarf_begin(fd, DWARF_C_READ);
778 xbt_die("Missing debugging information in %s\n"
779 "Your program and its dependencies must have debugging information.\n"
780 "You might want to recompile with -g or install the suitable debugging package.\n",
781 info->file_name.c_str());
782 // For each compilation unit:
783 Dwarf_Off offset = 0;
784 Dwarf_Off next_offset = 0;
787 while (dwarf_nextcu(dwarf, offset, &next_offset, &length, NULL, NULL, NULL) ==
790 if (dwarf_offdie(dwarf, offset + length, &unit_die) != NULL)
791 MC_dwarf_handle_children(info, &unit_die, &unit_die, NULL, NULL);
792 offset = next_offset;