Branch data Line data Source code
1 : : /* Get Dwarf Frame state from modules present in DWFL. 2 : : Copyright (C) 2013 Red Hat, Inc. 3 : : This file is part of elfutils. 4 : : 5 : : This file is free software; you can redistribute it and/or modify 6 : : it under the terms of either 7 : : 8 : : * the GNU Lesser General Public License as published by the Free 9 : : Software Foundation; either version 3 of the License, or (at 10 : : your option) any later version 11 : : 12 : : or 13 : : 14 : : * the GNU General Public License as published by the Free 15 : : Software Foundation; either version 2 of the License, or (at 16 : : your option) any later version 17 : : 18 : : or both in parallel, as here. 19 : : 20 : : elfutils is distributed in the hope that it will be useful, but 21 : : WITHOUT ANY WARRANTY; without even the implied warranty of 22 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 : : General Public License for more details. 24 : : 25 : : You should have received copies of the GNU General Public License and 26 : : the GNU Lesser General Public License along with this program. If 27 : : not, see <http://www.gnu.org/licenses/>. */ 28 : : 29 : : #ifdef HAVE_CONFIG_H 30 : : # include <config.h> 31 : : #endif 32 : : 33 : : #include "libdwflP.h" 34 : : 35 : : bool 36 : 1606 : dwfl_thread_state_registers (Dwfl_Thread *thread, int firstreg, 37 : : unsigned nregs, const Dwarf_Word *regs) 38 : : { 39 : 1606 : Dwfl_Frame *state = thread->unwound; 40 [ + - - + ]: 1606 : assert (state && state->unwound == NULL); 41 [ - + ]: 1606 : assert (state->initial_frame); 42 : : 43 [ - + ]: 1606 : if (firstreg == -2 && nregs == 1) { 44 : 0 : thread->aarch64.pauth_insn_mask = regs[0]; 45 : 0 : return true; 46 : : } 47 : : 48 [ + + ]: 3356 : for (unsigned regno = firstreg; regno < firstreg + nregs; regno++) 49 [ + + ]: 1766 : if (! __libdwfl_frame_reg_set (state, regno, regs[regno - firstreg])) 50 : : { 51 : 16 : __libdwfl_seterrno (DWFL_E_INVALID_REGISTER); 52 : 16 : return false; 53 : : } 54 : : return true; 55 : : } 56 : : INTDEF(dwfl_thread_state_registers) 57 : : 58 : : void 59 : 30 : dwfl_thread_state_register_pc (Dwfl_Thread *thread, Dwarf_Word pc) 60 : : { 61 : 30 : Dwfl_Frame *state = thread->unwound; 62 [ + - - + ]: 30 : assert (state && state->unwound == NULL); 63 [ - + ]: 30 : assert (state->initial_frame); 64 : 30 : state->pc = pc; 65 : 30 : state->pc_state = DWFL_FRAME_STATE_PC_SET; 66 : 30 : } 67 : : INTDEF(dwfl_thread_state_register_pc) 68 : : 69 : : int 70 : 6108 : dwfl_frame_reg (Dwfl_Frame *state, unsigned regno, Dwarf_Word *val) 71 : : { 72 : 6108 : int res = __libdwfl_frame_reg_get (state, regno, val); 73 [ - + ]: 6108 : if (res == -1) 74 : 0 : __libdwfl_seterrno (DWFL_E_INVALID_REGISTER); 75 [ + + ]: 6108 : else if (res == 1) 76 : 1916 : __libdwfl_seterrno (DWFL_E_REGISTER_VAL_UNKNOWN); 77 : 6108 : return res; 78 : : } 79 : : INTDEF(dwfl_frame_reg)