Home | History | Annotate | Download | only in libdwfl
      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 #include "libdwflP.h"
     30 
     31 bool
     32 dwfl_thread_state_registers (Dwfl_Thread *thread, int firstreg,
     33 			     unsigned nregs, const Dwarf_Word *regs)
     34 {
     35   Dwfl_Frame *state = thread->unwound;
     36   assert (state && state->unwound == NULL);
     37   assert (state->initial_frame);
     38   for (unsigned regno = firstreg; regno < firstreg + nregs; regno++)
     39     if (! __libdwfl_frame_reg_set (state, regno, regs[regno - firstreg]))
     40       {
     41 	__libdwfl_seterrno (DWFL_E_INVALID_REGISTER);
     42 	return false;
     43       }
     44   return true;
     45 }
     46 INTDEF(dwfl_thread_state_registers)
     47 
     48 void
     49 dwfl_thread_state_register_pc (Dwfl_Thread *thread, Dwarf_Word pc)
     50 {
     51   Dwfl_Frame *state = thread->unwound;
     52   assert (state && state->unwound == NULL);
     53   assert (state->initial_frame);
     54   state->pc = pc;
     55   state->pc_state = DWFL_FRAME_STATE_PC_SET;
     56 }
     57 INTDEF(dwfl_thread_state_register_pc)
     58