DW_FORM_line_strp strings come from a separate .debug_line_str section.
Make error messages more distinct (no .debug_str, no .debug_line_str or
not a string form).
Signed-off-by: Mark Wielaard <mark@klomp.org>
+2018-04-24 Mark Wielaard <mark@klomp.org>
+
+ * dwarf_begin_elf.c (dwarf_scnnames): Add ".debug_line_str".
+ * dwarf_error.c (errmsgs): Add DWARF_E_NO_DEBUG_STR and
+ DWARF_E_NO_DEBUG_LINE_STR.
+ * dwarf_formstring.c (dwarf_formstring): Handle DW_FORM_line_strp.
+ Get data from either .debug_str or .debug_line_str.
+ * libdwP.h: Add IDX_debug_line_str, DWARF_E_NO_DEBUG_STR and
+ DWARF_E_NO_DEBUG_LINE_STR.
+
2018-04-03 Mark Wielaard <mark@klomp.org>
* dwarf_formudata.c (__libdw_formptr): Take and return const
[IDX_debug_addr] = ".debug_addr",
[IDX_debug_aranges] = ".debug_aranges",
[IDX_debug_line] = ".debug_line",
+ [IDX_debug_line_str] = ".debug_line_str",
[IDX_debug_frame] = ".debug_frame",
[IDX_debug_loc] = ".debug_loc",
[IDX_debug_pubnames] = ".debug_pubnames",
/* Retrieve ELF descriptor used for DWARF access.
- Copyright (C) 2002, 2003, 2004, 2005, 2009, 2014, 2015 Red Hat, Inc.
+ Copyright (C) 2002-2005, 2009, 2014, 2015, 2017, 2018 Red Hat, Inc.
This file is part of elfutils.
- Written by Ulrich Drepper <drepper@redhat.com>, 2002.
This file is free software; you can redistribute it and/or modify
it under the terms of either
[DWARF_E_NO_ENTRY] = N_("no entries found"),
[DWARF_E_INVALID_DWARF] = N_("invalid DWARF"),
[DWARF_E_NO_STRING] = N_("no string data"),
+ [DWARF_E_NO_DEBUG_STR] = N_(".debug_str section missing"),
+ [DWARF_E_NO_DEBUG_LINE_STR] = N_(".debug_line_str section missing"),
[DWARF_E_NO_STR_OFFSETS] = N_(".debug_str_offsets section missing"),
[DWARF_E_NO_ADDR] = N_("no address value"),
[DWARF_E_NO_CONSTANT] = N_("no constant value"),
return NULL;
}
- if (dbg_ret->sectiondata[IDX_debug_str] == NULL)
+ Elf_Data *data = ((attrp->form == DW_FORM_line_strp)
+ ? dbg_ret->sectiondata[IDX_debug_line_str]
+ : dbg_ret->sectiondata[IDX_debug_str]);
+ if (data == NULL)
{
- __libdw_seterrno (DWARF_E_NO_STRING);
+ __libdw_seterrno ((attrp->form == DW_FORM_line_strp)
+ ? DWARF_E_NO_DEBUG_LINE_STR
+ : DWARF_E_NO_DEBUG_STR);
return NULL;
}
IDX_debug_str, 1))
return NULL;
}
+ else if (attrp->form == DW_FORM_line_strp)
+ {
+ if (__libdw_read_offset (dbg, dbg_ret, cu_sec_idx (cu),
+ attrp->valp, cu->offset_size, &off,
+ IDX_debug_line_str, 1))
+ return NULL;
+ }
else
{
Dwarf_Word idx;
goto invalid_offset;
}
- return (const char *) dbg_ret->sectiondata[IDX_debug_str]->d_buf + off;
+ return (const char *) data->d_buf + off;
}
INTDEF(dwarf_formstring)
IDX_debug_aranges,
IDX_debug_addr,
IDX_debug_line,
+ IDX_debug_line_str,
IDX_debug_frame,
IDX_debug_loc,
IDX_debug_pubnames,
DWARF_E_NO_ENTRY,
DWARF_E_INVALID_DWARF,
DWARF_E_NO_STRING,
+ DWARF_E_NO_DEBUG_STR,
+ DWARF_E_NO_DEBUG_LINE_STR,
DWARF_E_NO_STR_OFFSETS,
DWARF_E_NO_ADDR,
DWARF_E_NO_CONSTANT,