diff options
Diffstat (limited to 'libebl')
-rw-r--r-- | libebl/Makefile.am | 2 | ||||
-rw-r--r-- | libebl/ebl-hooks.h | 4 | ||||
-rw-r--r-- | libebl/ebldwarftoregno.c | 41 | ||||
-rw-r--r-- | libebl/libebl.h | 10 |
4 files changed, 55 insertions, 2 deletions
diff --git a/libebl/Makefile.am b/libebl/Makefile.am index 1fb3da31..6c03af86 100644 --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@ -54,7 +54,7 @@ gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \ eblreginfo.c eblnonerelocp.c eblrelativerelocp.c \ eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \ ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \ - eblstother.c eblinitreg.c eblgetsymbol.c + eblstother.c eblinitreg.c eblgetsymbol.c ebldwarftoregno.c libebl_a_SOURCES = $(gen_SOURCES) diff --git a/libebl/ebl-hooks.h b/libebl/ebl-hooks.h index 7204514b..fdb97f71 100644 --- a/libebl/ebl-hooks.h +++ b/libebl/ebl-hooks.h @@ -171,5 +171,9 @@ bool EBLHOOK(init_symbols) (Ebl *ebl, size_t syments, GElf_Addr main_bias, const char *EBLHOOK(get_symbol) (Ebl *ebl, size_t ndx, GElf_Sym *symp, GElf_Word *shndxp); +/* Convert *REGNO as is in DWARF to a lower range suitable for + Dwarf_Frame->REGS indexing. */ +bool EBLHOOK(dwarf_to_regno) (Ebl *ebl, unsigned *regno); + /* Destructor for ELF backend handle. */ void EBLHOOK(destr) (struct ebl *); diff --git a/libebl/ebldwarftoregno.c b/libebl/ebldwarftoregno.c new file mode 100644 index 00000000..8fb85401 --- /dev/null +++ b/libebl/ebldwarftoregno.c @@ -0,0 +1,41 @@ +/* Convert *REGNO as is in DWARF to a lower range. + Copyright (C) 2013 Red Hat, Inc. + This file is part of elfutils. + + This file is free software; you can redistribute it and/or modify + it under the terms of either + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at + your option) any later version + + or + + * the GNU General Public License as published by the Free + Software Foundation; either version 2 of the License, or (at + your option) any later version + + or both in parallel, as here. + + elfutils is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received copies of the GNU General Public License and + the GNU Lesser General Public License along with this program. If + not, see <http://www.gnu.org/licenses/>. */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <libeblP.h> + +bool +ebl_dwarf_to_regno (Ebl *ebl, unsigned *regno) +{ + if (ebl == NULL) + return false; + return ebl->dwarf_to_regno == NULL ? true : ebl->dwarf_to_regno (ebl, regno); +} diff --git a/libebl/libebl.h b/libebl/libebl.h index d8171532..e561ff33 100644 --- a/libebl/libebl.h +++ b/libebl/libebl.h @@ -368,6 +368,7 @@ typedef struct Elf_Type type; char format; bool thread_identifier; + bool pc_register; } Ebl_Core_Item; /* Describe the format of a core file note with the given header and NAME. @@ -383,7 +384,9 @@ extern int ebl_auxv_info (Ebl *ebl, GElf_Xword a_type, const char **name, const char **format) __nonnull_attribute__ (1, 3, 4); -/* Callback type for ebl_set_initial_registers_tid. */ +/* Callback type for ebl_set_initial_registers_tid. + Register -1 is mapped to PC (if arch PC has no DWARF number). + If FIRSTREG is -1 then NREGS has to be 1. */ typedef bool (ebl_tid_registers_t) (int firstreg, unsigned nregs, const Dwarf_Word *regs, void *arg) __nonnull_attribute__ (3); @@ -430,6 +433,11 @@ extern const char *ebl_get_symbol (Ebl *ebl, size_t ndx, GElf_Sym *symp, GElf_Word *shndxp) __nonnull_attribute__ (1, 3); +/* Convert *REGNO as is in DWARF to a lower range suitable for + Dwarf_Frame->REGS indexing. */ +extern bool ebl_dwarf_to_regno (Ebl *ebl, unsigned *regno) + __nonnull_attribute__ (1, 2); + #ifdef __cplusplus } #endif |