/* Routines related to .debug_info.
- Copyright (C) 2009, 2010 Red Hat, Inc.
+ Copyright (C) 2009, 2010, 2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
&& ver->form_class (form, attribute) == cl_indirect)
{
uint64_t value;
- if (!read_sc_value (&value, form->width (cu), ctx, &where))
+ if (!read_sc_value (&value, form->width (cu->head),
+ ctx, &where))
return -1;
form_name = value;
form = check_debug_abbrev::check_form
cl_rangelistptr);
if (cls != max_dw_class && ref_classes.test (cls))
- if (form->width (cu) == fw_8
+ if (form->width (cu->head) == fw_8
&& cu->head->offset_size == 4)
wr_error (where)
<< "reference attribute with form \""
read_ctx block;
storage_class_t storclass = form->storage_class ();
- if (!read_generic_value (ctx, form->width (cu), storclass,
+ if (!read_generic_value (ctx, form->width (cu->head), storclass,
&where, &value, &block))
{
// Note that for fw_uleb and fw_sleb we report the
if (attribute != NULL)
{
- form_width_t width = form->width (cu);
+ form_width_t width = form->width (cu->head);
relocate_one (&file, reloc, rel, width, &value, &where,
reloc_target (form, attribute), symbolp);
}
/* Routines related to .debug_loc and .debug_range.
- Copyright (C) 2009, 2010 Red Hat, Inc.
+ Copyright (C) 2009, 2010, 2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
storage_class_t storclass = form->storage_class ();
assert (storclass != sc_string);
- if (!read_generic_value (ctx, form->width (cu), storclass,
+ if (!read_generic_value (ctx, form->width (cu->head), storclass,
where, valuep, NULL))
{
wr_error (*where)
/* Pedantic checking of DWARF files
- Copyright (C) 2009,2010 Red Hat, Inc.
+ Copyright (C) 2009,2010,2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
// version. Apart from standardized DWARF formats, e.g. DWARF3+GNU is
// a version of its own.
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include "dwarf_version.hh"
#include "dwarf_2.hh"
#include "dwarf_3.hh"
}
form_width_t
-form::width (cu const *cu) const
+form::width (cu_head const *cu_head) const
{
- if (_m_width == fw_offset)
- return static_cast<form_width_t> (cu->head->offset_size);
- else if (_m_width == fw_address)
- return static_cast<form_width_t> (cu->head->address_size);
- else
- return static_cast<form_width_t> (_m_width);
+ switch (_m_width)
+ {
+ case fw_offset:
+ case fw_address:
+ if (unlikely (cu_head == NULL))
+ return fw_unknown;
+ if (_m_width == fw_offset)
+ return static_cast<form_width_t> (cu_head->offset_size);
+ else
+ return static_cast<form_width_t> (cu_head->address_size);
+
+ default:
+ return static_cast<form_width_t> (_m_width);
+ }
}
std::ostream &
/* Dwarf version tables.
- Copyright (C) 2009, 2010 Red Hat, Inc.
+ Copyright (C) 2009, 2010, 2011 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
///
/// Return value is never fw_offset or fw_address. These get
/// resolved to fw_4 or fw_8 depending on corresponding value in
- /// CU->head.
- form_width_t width (cu const *cu) const;
+ /// CU_HEAD.
+ form_width_t width (cu_head const *cu_head) const;
/// Return storage class of given form. Closely related to width.
storage_class_t