#include <dwarf.h>
#include <elfutils/libdw.h>
#include <assert.h>
+#include "loc2c.h"
#define _(x) x
Dwarf_Addr dwbias __attribute__ ((unused)),
Dwarf_Die *typedie, struct location **input)
{
+ assert (dwarf_tag (typedie) == DW_TAG_pointer_type);
+
++indent;
obstack_printf (pool, "%*s{ ", (indent + 2) * 2, "");
static Dwarf_Word
base_byte_size (Dwarf_Die *typedie)
{
+ assert (dwarf_tag (typedie) == DW_TAG_base_type);
+
Dwarf_Attribute attr_mem;
Dwarf_Word size;
if (dwarf_attr_integrate (typedie, DW_AT_byte_size, &attr_mem) != NULL
void
c_translate_fetch (struct obstack *pool, int indent,
Dwarf_Addr dwbias __attribute__ ((unused)),
- Dwarf_Die *die, Dwarf_Attribute *typeattr,
+ Dwarf_Die *die, Dwarf_Die *typedie,
struct location **input, const char *target)
{
++indent;
Dwarf_Word byte_size;
if (dwarf_attr_integrate (die, DW_AT_byte_size, &size_attr) == NULL
|| dwarf_formudata (&size_attr, &byte_size) != 0)
- {
- Dwarf_Die basedie;
- if (dwarf_formref_die (typeattr, &basedie) == NULL)
- error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1));
- byte_size = base_byte_size (&basedie);
- }
+ byte_size = base_byte_size (typedie);
bool deref = false;
if (dwarf_hasattr_integrate (die, DW_AT_bit_offset))
void
c_translate_store (struct obstack *pool, int indent,
Dwarf_Addr dwbias __attribute__ ((unused)),
- Dwarf_Die *die, Dwarf_Attribute *typeattr,
+ Dwarf_Die *die, Dwarf_Die *typedie,
struct location **input, const char *rvalue)
{
++indent;
Dwarf_Word byte_size;
if (dwarf_attr_integrate (die, DW_AT_byte_size, &size_attr) == NULL
|| dwarf_formudata (&size_attr, &byte_size) != 0)
- {
- Dwarf_Die basedie;
- if (dwarf_formref_die (typeattr, &basedie) == NULL)
- error (2, 0, _("cannot get type of field: %s"), dwarf_errmsg (-1));
- byte_size = base_byte_size (&basedie);
- }
+ byte_size = base_byte_size (typedie);
bool deref = false;
if (dwarf_hasattr_integrate (die, DW_AT_bit_offset))
Dwarf_Die *typedie, struct location **input,
const char *idx, Dwarf_Word const_idx)
{
+ assert (dwarf_tag (typedie) == DW_TAG_array_type);
+
++indent;
Dwarf_Word stride = array_stride (typedie);