From b75f444e2a4a54436bea2fa21f022225b5d782e0 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 15 Jun 2010 22:24:19 -0700 Subject: Fix error diagnosis for dwarf_formref on DW_FORM_ref_sig8. --- libdw/ChangeLog | 5 +++++ libdw/dwarf_formref.c | 3 ++- libdw/dwarf_formref_die.c | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index d6ea6c67..edb7cbff 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,10 @@ 2010-06-15 Roland McGrath + * dwarf_formref.c (__libdw_formref): Diagnose DW_FORM_ref_sig8 like + DW_FORM_ref_addr. + * dwarf_formref_die.c (dwarf_formref_die): Diagnose it the same way + here, since we don't support it yet. + * dwarf_next_cfi.c: Handle version 4 format. * dwarf_getsrclines.c: Handle version 4 format. diff --git a/libdw/dwarf_formref.c b/libdw/dwarf_formref.c index b8463b70..e4d35ae8 100644 --- a/libdw/dwarf_formref.c +++ b/libdw/dwarf_formref.c @@ -1,5 +1,5 @@ /* Return reference offset represented by attribute. - Copyright (C) 2003, 2005, 2007, 2008 Red Hat, Inc. + Copyright (C) 2003-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper , 2003. @@ -92,6 +92,7 @@ __libdw_formref (attr, return_offset) break; case DW_FORM_ref_addr: + case DW_FORM_ref_sig8: __libdw_seterrno (DWARF_E_INVALID_REFERENCE); return -1; diff --git a/libdw/dwarf_formref_die.c b/libdw/dwarf_formref_die.c index a004a0fd..3ab2cb38 100644 --- a/libdw/dwarf_formref_die.c +++ b/libdw/dwarf_formref_die.c @@ -1,5 +1,5 @@ /* Look up the DIE in a reference-form attribute. - Copyright (C) 2005, 2007 Red Hat, Inc. + Copyright (C) 2005-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Red Hat elfutils is free software; you can redistribute it and/or modify @@ -76,6 +76,23 @@ dwarf_formref_die (attr, die_mem) ref_size, &offset, IDX_debug_info, 0)) return NULL; } + else if (attr->form == DW_FORM_ref_sig8) + { + /* This doesn't have an offset, but instead a value we + have to match in the .debug_types type unit headers. */ + + uint64_t sig = read_8ubyte_unaligned (attr->cu->dbg, attr->valp); + + /* XXX We don't actually support this yet. We need to parse + .debug_types and keep a table keyed on signature. */ +#if 0 + return INTUSE(dwarf_typeunit) (attr->cu->dbg, sig, die_mem); +#else + sig = sig; + __libdw_seterrno (DWARF_E_INVALID_REFERENCE); +#endif + return NULL; + } else { /* Other forms produce an offset from the CU. */ -- cgit v1.2.3