/*-
* Copyright (c) 2010 Kai Wang
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
int
_dwarf_pro_callback(Dwarf_P_Debug dbg, char *name, int size,
Dwarf_Unsigned type, Dwarf_Unsigned flags, Dwarf_Unsigned link,
Dwarf_Unsigned info, Dwarf_Unsigned *symndx, int *error)
{
int e, ret, isymndx;
int
_dwarf_generate_sections(Dwarf_P_Debug dbg, Dwarf_Error *error)
{
int ret;
/* Produce .debug_info section. */
if ((ret = _dwarf_info_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_abbrev section. */
if ((ret = _dwarf_abbrev_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_line section. */
if ((ret = _dwarf_lineno_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_frame section. */
if ((ret = _dwarf_frame_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_aranges section. */
if ((ret = _dwarf_arange_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_macinfo section. */
if ((ret = _dwarf_macinfo_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_pubnames section. */
if ((ret = _dwarf_nametbl_gen(dbg, ".debug_pubnames", dbg->dbgp_pubs,
error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_weaknames section. */
if ((ret = _dwarf_nametbl_gen(dbg, ".debug_weaknames", dbg->dbgp_weaks,
error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_funcnames section. */
if ((ret = _dwarf_nametbl_gen(dbg, ".debug_funcnames", dbg->dbgp_funcs,
error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_typenames section. */
if ((ret = _dwarf_nametbl_gen(dbg, ".debug_typenames", dbg->dbgp_types,
error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_varnames section. */
if ((ret = _dwarf_nametbl_gen(dbg, ".debug_varnames", dbg->dbgp_vars,
error)) != DW_DLE_NONE)
return (ret);
/* Produce .debug_str section. */
if ((ret = _dwarf_strtab_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Finally, update and generate all relocation sections. */
if ((ret = _dwarf_reloc_gen(dbg, error)) != DW_DLE_NONE)
return (ret);
/* Set section/relocation iterator to the first element. */
dbg->dbgp_secpos = STAILQ_FIRST(&dbg->dbgp_seclist);
dbg->dbgp_drspos = STAILQ_FIRST(&dbg->dbgp_drslist);