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. */
18 #include "mc/Frame.hpp"
19 #include "mc/ObjectInformation.hpp"
20 #include "mc/Variable.hpp"
22 #include "mc/mc_dwarf.hpp"
23 #include "mc/mc_libdw.hpp"
25 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_libdw, mc, "DWARF processing");
27 /** \brief Get the name of the tag of a given DIE
30 * \return name of the tag of this DIE
32 static inline const char *MC_dwarf_die_tagname(Dwarf_Die * die)
34 return MC_dwarf_tagname(dwarf_tag(die));
38 simgrid::mc::DwarfExpression MC_dwarf_expression(Dwarf_Op* ops, std::size_t len)
40 simgrid::mc::DwarfExpression expression(len);
41 for (std::size_t i = 0; i != len; ++i) {
42 expression[i].atom = ops[i].atom;
43 expression[i].number = ops[i].number;
44 expression[i].number2 = ops[i].number2;
45 expression[i].offset = ops[i].offset;
47 return std::move(expression);
50 static void mc_dwarf_location_list_init_libdw(
51 simgrid::mc::LocationList* list, simgrid::mc::ObjectInformation* info,
52 Dwarf_Die * die, Dwarf_Attribute * attr)
57 Dwarf_Addr base, start, end;
63 offset = dwarf_getlocations(attr, offset, &base, &start, &end, &ops, &len);
66 else if (offset == -1)
67 xbt_die("Error while loading location list");
69 simgrid::mc::LocationListEntry entry;
70 entry.expression = MC_dwarf_expression(ops, len);
72 void *base = info->base_address();
73 // If start == 0, this is not a location list:
74 entry.lowpc = start == 0 ? NULL : (char *) base + start;
75 entry.highpc = start == 0 ? NULL : (char *) base + end;
77 list->push_back(std::move(entry));
84 /** \brief Get an attribute of a given DIE as a string
87 * \param attribute attribute
88 * \return value of the given attribute of the given DIE
90 static const char *MC_dwarf_attr_integrate_string(Dwarf_Die * die,
94 if (!dwarf_attr_integrate(die, attribute, &attr)) {
97 return dwarf_formstring(&attr);
101 /** \brief Get the linkage name of a DIE.
103 * Use either DW_AT_linkage_name or DW_AT_MIPS_linkage_name.
104 * DW_AT_linkage_name is standardized since DWARF 4.
105 * Before this version of DWARF, the MIPS extensions
106 * DW_AT_MIPS_linkage_name is used (at least by GCC).
109 * \return linkage name of the given DIE (or NULL)
111 static const char *MC_dwarf_at_linkage_name(Dwarf_Die * die)
113 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_linkage_name);
115 name = MC_dwarf_attr_integrate_string(die, DW_AT_MIPS_linkage_name);
119 static Dwarf_Off MC_dwarf_attr_dieoffset(Dwarf_Die * die, int attribute)
121 Dwarf_Attribute attr;
122 if (dwarf_hasattr_integrate(die, attribute) == 0)
124 dwarf_attr_integrate(die, attribute, &attr);
125 Dwarf_Die subtype_die;
126 if (dwarf_formref_die(&attr, &subtype_die) == NULL)
127 xbt_die("Could not find DIE");
128 return dwarf_dieoffset(&subtype_die);
131 static Dwarf_Off MC_dwarf_attr_integrate_dieoffset(Dwarf_Die * die,
134 Dwarf_Attribute attr;
135 if (dwarf_hasattr_integrate(die, attribute) == 0)
137 dwarf_attr_integrate(die, DW_AT_type, &attr);
138 Dwarf_Die subtype_die;
139 if (dwarf_formref_die(&attr, &subtype_die) == NULL)
140 xbt_die("Could not find DIE");
141 return dwarf_dieoffset(&subtype_die);
144 /** \brief Find the type/subtype (DW_AT_type) for a DIE
147 * \return DW_AT_type reference as a global offset in hexadecimal (or NULL)
150 std::uint64_t MC_dwarf_at_type(Dwarf_Die * die)
152 return MC_dwarf_attr_integrate_dieoffset(die, DW_AT_type);
155 static std::uint64_t MC_dwarf_attr_integrate_addr(Dwarf_Die * die, int attribute)
157 Dwarf_Attribute attr;
158 if (dwarf_attr_integrate(die, attribute, &attr) == NULL)
161 if (dwarf_formaddr(&attr, &value) == 0)
162 return (std::uint64_t) value;
167 static std::uint64_t MC_dwarf_attr_integrate_uint(Dwarf_Die * die, int attribute,
168 std::uint64_t default_value)
170 Dwarf_Attribute attr;
171 if (dwarf_attr_integrate(die, attribute, &attr) == NULL)
172 return default_value;
174 return dwarf_formudata(dwarf_attr_integrate(die, attribute, &attr),
175 &value) == 0 ? (std::uint64_t) value : default_value;
178 static bool MC_dwarf_attr_flag(Dwarf_Die * die, int attribute, bool integrate)
180 Dwarf_Attribute attr;
181 if ((integrate ? dwarf_attr_integrate(die, attribute, &attr)
182 : dwarf_attr(die, attribute, &attr)) == 0)
186 if (dwarf_formflag(&attr, &result))
187 xbt_die("Unexpected form for attribute %s", MC_dwarf_attrname(attribute));
191 /** \brief Finds the number of elements in a DW_TAG_subrange_type or DW_TAG_enumeration_type DIE
194 * \param unit DIE of the compilation unit
195 * \return number of elements in the range
197 static std::uint64_t MC_dwarf_subrange_element_count(Dwarf_Die * die,
200 xbt_assert(dwarf_tag(die) == DW_TAG_enumeration_type
201 || dwarf_tag(die) == DW_TAG_subrange_type,
202 "MC_dwarf_subrange_element_count called with DIE of type %s",
203 MC_dwarf_die_tagname(die));
205 // Use DW_TAG_count if present:
206 if (dwarf_hasattr_integrate(die, DW_AT_count))
207 return MC_dwarf_attr_integrate_uint(die, DW_AT_count, 0);
208 // Otherwise compute DW_TAG_upper_bound-DW_TAG_lower_bound + 1:
210 if (!dwarf_hasattr_integrate(die, DW_AT_upper_bound))
211 // This is not really 0, but the code expects this (we do not know):
214 std::uint64_t upper_bound =
215 MC_dwarf_attr_integrate_uint(die, DW_AT_upper_bound, -1);
217 std::uint64_t lower_bound = 0;
218 if (dwarf_hasattr_integrate(die, DW_AT_lower_bound))
219 lower_bound = MC_dwarf_attr_integrate_uint(die, DW_AT_lower_bound, -1);
221 lower_bound = MC_dwarf_default_lower_bound(dwarf_srclang(unit));
222 return upper_bound - lower_bound + 1;
225 /** \brief Finds the number of elements in a array type (DW_TAG_array_type)
227 * The compilation unit might be needed because the default lower
228 * bound depends on the language of the compilation unit.
230 * \param die the DIE of the DW_TAG_array_type
231 * \param unit the DIE of the compilation unit
232 * \return number of elements in this array type
235 std::uint64_t MC_dwarf_array_element_count(Dwarf_Die * die, Dwarf_Die * unit)
237 xbt_assert(dwarf_tag(die) == DW_TAG_array_type,
238 "MC_dwarf_array_element_count called with DIE of type %s",
239 MC_dwarf_die_tagname(die));
244 for (res = dwarf_child(die, &child); res == 0;
245 res = dwarf_siblingof(&child, &child)) {
246 int child_tag = dwarf_tag(&child);
247 if (child_tag == DW_TAG_subrange_type
248 || child_tag == DW_TAG_enumeration_type)
249 result *= MC_dwarf_subrange_element_count(&child, unit);
254 // ***** simgrid::mc::Type*
256 /** \brief Initialize the location of a member of a type
257 * (DW_AT_data_member_location of a DW_TAG_member).
259 * \param type a type (struct, class)
260 * \param member the member of the type
261 * \param child DIE of the member (DW_TAG_member)
263 static void MC_dwarf_fill_member_location(simgrid::mc::Type* type, simgrid::mc::Type* member,
266 if (dwarf_hasattr(child, DW_AT_data_bit_offset))
267 xbt_die("Can't groke DW_AT_data_bit_offset.");
269 if (!dwarf_hasattr_integrate(child, DW_AT_data_member_location)) {
270 if (type->type == DW_TAG_union_type)
273 ("Missing DW_AT_data_member_location field in DW_TAG_member %s of type <%"
274 PRIx64 ">%s", member->name.c_str(),
275 (std::uint64_t) type->id, type->name.c_str());
278 Dwarf_Attribute attr;
279 dwarf_attr_integrate(child, DW_AT_data_member_location, &attr);
280 int form = dwarf_whatform(&attr);
281 int klass = MC_dwarf_form_get_class(form);
283 case MC_DW_CLASS_EXPRLOC:
284 case MC_DW_CLASS_BLOCK:
285 // Location expression:
289 if (dwarf_getlocation(&attr, &expr, &len))
291 ("Could not read location expression DW_AT_data_member_location in DW_TAG_member %s of type <%"
292 PRIx64 ">%s", MC_dwarf_attr_integrate_string(child, DW_AT_name),
293 (std::uint64_t) type->id, type->name.c_str());
294 member->location_expression = MC_dwarf_expression(expr, len);
297 case MC_DW_CLASS_CONSTANT:
298 // Offset from the base address of the object:
301 if (!dwarf_formudata(&attr, &offset))
302 member->offset(offset);
304 xbt_die("Cannot get %s location <%" PRIx64 ">%s",
305 MC_dwarf_attr_integrate_string(child, DW_AT_name),
306 (std::uint64_t) type->id, type->name.c_str());
309 case MC_DW_CLASS_LOCLISTPTR:
310 // Reference to a location list:
312 case MC_DW_CLASS_REFERENCE:
313 // It's supposed to be possible in DWARF2 but I couldn't find its semantic
316 xbt_die("Can't handle form class (%i) / form 0x%x as DW_AT_member_location",
322 /** \brief Populate the list of members of a type
324 * \param info ELF object containing the type DIE
325 * \param die DIE of the type
326 * \param unit DIE of the compilation unit containing the type DIE
327 * \param type the type
329 static void MC_dwarf_add_members(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
330 Dwarf_Die * unit, simgrid::mc::Type* type)
334 xbt_assert(type->members.empty());
335 for (res = dwarf_child(die, &child); res == 0;
336 res = dwarf_siblingof(&child, &child)) {
337 int tag = dwarf_tag(&child);
338 if (tag == DW_TAG_member || tag == DW_TAG_inheritance) {
340 // Skip declarations:
341 if (MC_dwarf_attr_flag(&child, DW_AT_declaration, false))
344 // Skip compile time constants:
345 if (dwarf_hasattr(&child, DW_AT_const_value))
348 // TODO, we should use another type (because is is not a type but a member)
349 simgrid::mc::Type member;
353 member.id = dwarf_dieoffset(&child);
355 const char *name = MC_dwarf_attr_integrate_string(&child, DW_AT_name);
359 MC_dwarf_attr_integrate_uint(&child, DW_AT_byte_size, 0);
360 member.element_count = -1;
361 member.type_id = MC_dwarf_at_type(&child);
363 if (dwarf_hasattr(&child, DW_AT_data_bit_offset))
364 xbt_die("Can't groke DW_AT_data_bit_offset.");
366 MC_dwarf_fill_member_location(type, &member, &child);
369 xbt_die("Missing type for member %s of <%" PRIx64 ">%s",
371 (std::uint64_t) type->id, type->name.c_str());
373 type->members.push_back(std::move(member));
378 /** \brief Create a MC type object from a DIE
380 * \param info current object info object
381 * \param DIE (for a given type);
382 * \param unit compilation unit of the current DIE
383 * \return MC representation of the type
385 static simgrid::mc::Type MC_dwarf_die_to_type(
386 simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
387 Dwarf_Die * unit, simgrid::mc::Frame* frame,
390 simgrid::mc::Type type;
391 type.type = dwarf_tag(die);
392 type.name = std::string();
393 type.element_count = -1;
396 type.id = dwarf_dieoffset(die);
398 const char *prefix = "";
400 case DW_TAG_structure_type:
403 case DW_TAG_union_type:
406 case DW_TAG_class_type:
413 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
415 char* full_name = ns ? bprintf("%s%s::%s", prefix, ns, name) :
416 bprintf("%s%s", prefix, name);
417 type.name = std::string(full_name);
421 type.type_id = MC_dwarf_at_type(die);
423 // Some compilers do not emit DW_AT_byte_size for pointer_type,
424 // so we fill this. We currently assume that the model-checked process is in
425 // the same architecture..
426 if (type.type == DW_TAG_pointer_type)
427 type.byte_size = sizeof(void*);
429 // Computation of the byte_size;
430 if (dwarf_hasattr_integrate(die, DW_AT_byte_size))
431 type.byte_size = MC_dwarf_attr_integrate_uint(die, DW_AT_byte_size, 0);
432 else if (type.type == DW_TAG_array_type
433 || type.type == DW_TAG_structure_type
434 || type.type == DW_TAG_class_type) {
436 if (dwarf_aggregate_size(die, &size) == 0)
437 type.byte_size = size;
441 case DW_TAG_array_type:
442 type.element_count = MC_dwarf_array_element_count(die, unit);
443 // TODO, handle DW_byte_stride and (not) DW_bit_stride
446 case DW_TAG_pointer_type:
447 case DW_TAG_reference_type:
448 case DW_TAG_rvalue_reference_type:
449 type.is_pointer_type = 1;
452 case DW_TAG_structure_type:
453 case DW_TAG_union_type:
454 case DW_TAG_class_type:
455 MC_dwarf_add_members(info, die, unit, &type);
456 char *new_ns = ns == NULL ? xbt_strdup(type.name.c_str())
457 : bprintf("%s::%s", ns, name);
458 MC_dwarf_handle_children(info, die, unit, frame, new_ns);
463 return std::move(type);
466 static void MC_dwarf_handle_type_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
467 Dwarf_Die * unit, simgrid::mc::Frame* frame,
470 simgrid::mc::Type type = MC_dwarf_die_to_type(info, die, unit, frame, ns);
471 auto& t = (info->types[type.id] = std::move(type));
472 if (!t.name.empty() && type.byte_size != 0)
473 info->full_types_by_name[t.name] = &t;
476 static int mc_anonymous_variable_index = 0;
478 static std::unique_ptr<simgrid::mc::Variable> MC_die_to_variable(
479 simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
480 Dwarf_Die * unit, simgrid::mc::Frame* frame,
483 // Skip declarations:
484 if (MC_dwarf_attr_flag(die, DW_AT_declaration, false))
487 // Skip compile time constants:
488 if (dwarf_hasattr(die, DW_AT_const_value))
491 Dwarf_Attribute attr_location;
492 if (dwarf_attr(die, DW_AT_location, &attr_location) == NULL)
493 // No location: do not add it ?
496 std::unique_ptr<simgrid::mc::Variable> variable =
497 std::unique_ptr<simgrid::mc::Variable>(new simgrid::mc::Variable());
498 variable->dwarf_offset = dwarf_dieoffset(die);
499 variable->global = frame == NULL; // Can be override base on DW_AT_location
500 variable->object_info = info;
502 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
504 variable->name = name;
505 variable->type_id = MC_dwarf_at_type(die);
507 int form = dwarf_whatform(&attr_location);
510 DW_FORM_sec_offset ? MC_DW_CLASS_CONSTANT : MC_dwarf_form_get_class(form);
512 case MC_DW_CLASS_EXPRLOC:
513 case MC_DW_CLASS_BLOCK:
514 // Location expression:
518 if (dwarf_getlocation(&attr_location, &expr, &len)) {
520 "Could not read location expression in DW_AT_location "
521 "of variable <%" PRIx64 ">%s",
522 (std::uint64_t) variable->dwarf_offset,
523 variable->name.c_str());
526 if (len == 1 && expr[0].atom == DW_OP_addr) {
527 variable->global = 1;
528 uintptr_t offset = (uintptr_t) expr[0].number;
529 uintptr_t base = (uintptr_t) info->base_address();
530 variable->address = (void *) (base + offset);
532 simgrid::mc::LocationListEntry entry;
533 entry.expression = MC_dwarf_expression(expr, len);
534 variable->location_list = { std::move(entry) };
539 case MC_DW_CLASS_LOCLISTPTR:
540 case MC_DW_CLASS_CONSTANT:
541 // Reference to location list:
542 mc_dwarf_location_list_init_libdw(
543 &variable->location_list, info, die,
547 xbt_die("Unexpected form 0x%x (%i), class 0x%x (%i) list for location "
548 "in <%" PRIx64 ">%s",
549 form, form, klass, klass,
550 (std::uint64_t) variable->dwarf_offset,
551 variable->name.c_str());
554 // Handle start_scope:
555 if (dwarf_hasattr(die, DW_AT_start_scope)) {
556 Dwarf_Attribute attr;
557 dwarf_attr(die, DW_AT_start_scope, &attr);
558 int form = dwarf_whatform(&attr);
559 int klass = MC_dwarf_form_get_class(form);
561 case MC_DW_CLASS_CONSTANT:
564 variable->start_scope =
565 dwarf_formudata(&attr, &value) == 0 ? (size_t) value : 0;
568 case MC_DW_CLASS_RANGELISTPTR: // TODO
571 ("Unhandled form 0x%x, class 0x%X for DW_AT_start_scope of variable %s",
572 form, klass, name == NULL ? "?" : name);
576 if (ns && variable->global)
578 std::string(ns) + "::" + variable->name;
580 // The current code needs a variable name,
581 // generate a fake one:
582 if (variable->name.empty())
584 "@anonymous#" + std::to_string(mc_anonymous_variable_index++);
586 return std::move(variable);
589 static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
590 Dwarf_Die * unit, simgrid::mc::Frame* frame,
593 std::unique_ptr<simgrid::mc::Variable> variable =
594 MC_die_to_variable(info, die, unit, frame, ns);
597 // Those arrays are sorted later:
598 else if (variable->global)
599 info->global_variables.push_back(std::move(*variable));
600 else if (frame != nullptr)
601 frame->variables.push_back(std::move(*variable));
603 xbt_die("No frame for this local variable");
606 static void MC_dwarf_handle_scope_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
607 Dwarf_Die * unit, simgrid::mc::Frame* parent_frame,
610 // TODO, handle DW_TAG_type/DW_TAG_location for DW_TAG_with_stmt
611 int tag = dwarf_tag(die);
612 mc_tag_class klass = MC_dwarf_tag_classify(tag);
614 // (Template) Subprogram declaration:
615 if (klass == mc_tag_subprogram
616 && MC_dwarf_attr_flag(die, DW_AT_declaration, false))
619 if (klass == mc_tag_scope)
620 xbt_assert(parent_frame, "No parent scope for this scope");
622 simgrid::mc::Frame frame;
625 frame.id = dwarf_dieoffset(die);
626 frame.object_info = info;
628 if (klass == mc_tag_subprogram) {
629 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
631 frame.name = std::string(ns) + "::" + name;
638 frame.abstract_origin_id =
639 MC_dwarf_attr_dieoffset(die, DW_AT_abstract_origin);
641 // This is the base address for DWARF addresses.
642 // Relocated addresses are offset from this base address.
643 // See DWARF4 spec 7.5
644 void *base = info->base_address();
646 // TODO, support DW_AT_ranges
647 std::uint64_t low_pc = MC_dwarf_attr_integrate_addr(die, DW_AT_low_pc);
648 frame.low_pc = low_pc ? ((char *) base) + low_pc : 0;
651 Dwarf_Attribute attr;
652 if (!dwarf_attr_integrate(die, DW_AT_high_pc, &attr)) {
653 xbt_die("Missing DW_AT_high_pc matching with DW_AT_low_pc");
659 switch (MC_dwarf_form_get_class(dwarf_whatform(&attr))) {
661 // DW_AT_high_pc if an offset from the low_pc:
662 case MC_DW_CLASS_CONSTANT:
664 if (dwarf_formsdata(&attr, &offset) != 0)
665 xbt_die("Could not read constant");
666 frame.high_pc = (void *) ((char *) frame.low_pc + offset);
669 // DW_AT_high_pc is a relocatable address:
670 case MC_DW_CLASS_ADDRESS:
671 if (dwarf_formaddr(&attr, &high_pc) != 0)
672 xbt_die("Could not read address");
673 frame.high_pc = ((char *) base) + high_pc;
677 xbt_die("Unexpected class for DW_AT_high_pc");
682 if (klass == mc_tag_subprogram) {
683 Dwarf_Attribute attr_frame_base;
684 if (dwarf_attr_integrate(die, DW_AT_frame_base, &attr_frame_base))
685 mc_dwarf_location_list_init_libdw(&frame.frame_base, info, die,
690 MC_dwarf_handle_children(info, die, unit, &frame, ns);
692 // Someone needs this to be sorted but who?
693 std::sort(frame.variables.begin(), frame.variables.end(),
694 MC_compare_variable);
697 if (klass == mc_tag_subprogram)
698 info->subprograms[frame.id] = frame;
699 else if (klass == mc_tag_scope)
700 parent_frame->scopes.push_back(std::move(frame));
703 static void mc_dwarf_handle_namespace_die(simgrid::mc::ObjectInformation* info,
704 Dwarf_Die * die, Dwarf_Die * unit,
705 simgrid::mc::Frame* frame,
708 const char *name = MC_dwarf_attr_integrate_string(die, DW_AT_name);
710 xbt_die("Unexpected namespace in a subprogram");
711 char *new_ns = ns == NULL ? xbt_strdup(name)
712 : bprintf("%s::%s", ns, name);
713 MC_dwarf_handle_children(info, die, unit, frame, new_ns);
717 static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
718 Dwarf_Die * unit, simgrid::mc::Frame* frame,
721 // For each child DIE:
724 for (res = dwarf_child(die, &child); res == 0;
725 res = dwarf_siblingof(&child, &child)) {
726 MC_dwarf_handle_die(info, &child, unit, frame, ns);
730 static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
731 Dwarf_Die * unit, simgrid::mc::Frame* frame,
734 int tag = dwarf_tag(die);
735 mc_tag_class klass = MC_dwarf_tag_classify(tag);
740 MC_dwarf_handle_type_die(info, die, unit, frame, ns);
743 // Subprogram or scope:
744 case mc_tag_subprogram:
746 MC_dwarf_handle_scope_die(info, die, unit, frame, ns);
750 case mc_tag_variable:
751 MC_dwarf_handle_variable_die(info, die, unit, frame, ns);
754 case mc_tag_namespace:
755 mc_dwarf_handle_namespace_die(info, die, unit, frame, ns);
764 /** \brief Populate the debugging informations of the given ELF object
766 * Read the DWARf information of the EFFL object and populate the
767 * lists of types, variables, functions.
769 void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
771 int fd = open(info->file_name.c_str(), O_RDONLY);
773 xbt_die("Could not open file %s", info->file_name.c_str());
774 Dwarf *dwarf = dwarf_begin(fd, DWARF_C_READ);
776 xbt_die("Missing debugging information in %s\n"
777 "Your program and its dependencies must have debugging information.\n"
778 "You might want to recompile with -g or install the suitable debugging package.\n",
779 info->file_name.c_str());
780 // For each compilation unit:
781 Dwarf_Off offset = 0;
782 Dwarf_Off next_offset = 0;
785 while (dwarf_nextcu(dwarf, offset, &next_offset, &length, NULL, NULL, NULL) ==
788 if (dwarf_offdie(dwarf, offset + length, &unit_die) != NULL)
789 MC_dwarf_handle_children(info, &unit_die, &unit_die, NULL, NULL);
790 offset = next_offset;