Back to index

glibc  2.9
Classes | Functions
find_exidx.c File Reference
#include <link.h>
#include <unwind.h>

Go to the source code of this file.

Classes

struct  unw_eh_callback_data

Functions

static int find_exidx_callback (struct dl_phdr_info *info, size_t size, void *ptr)
_Unwind_Ptr __gnu_Unwind_Find_exidx (_Unwind_Ptr pc, int *pcount)

Class Documentation

struct unw_eh_callback_data

Definition at line 22 of file find_exidx.c.

Class Members
void * dbase
int exidx_len
_Unwind_Ptr exidx_start
void * func
_Unwind_Ptr pc
fde * ret
void * tbase

Function Documentation

_Unwind_Ptr __gnu_Unwind_Find_exidx ( _Unwind_Ptr  pc,
int pcount 
)

Definition at line 69 of file find_exidx.c.

{
  struct unw_eh_callback_data data;

  data.pc = pc;
  data.exidx_start = 0;
  if (__dl_iterate_phdr (find_exidx_callback, &data) <= 0)
    return 0;

  *pcount = data.exidx_len / 8;
  return data.exidx_start;
}

Here is the call graph for this function:

static int find_exidx_callback ( struct dl_phdr_info *  info,
size_t  size,
void *  ptr 
) [static]

Definition at line 34 of file find_exidx.c.

{
  struct unw_eh_callback_data * data;
  const ElfW(Phdr) *phdr;
  int i;
  int match;
  _Unwind_Ptr load_base;

  data = (struct unw_eh_callback_data *) ptr;
  load_base = info->dlpi_addr;
  phdr = info->dlpi_phdr;

  match = 0;
  for (i = info->dlpi_phnum; i > 0; i--, phdr++)
    {
      if (phdr->p_type == PT_LOAD)
        {
          _Unwind_Ptr vaddr = phdr->p_vaddr + load_base;
          if (data->pc >= vaddr && data->pc < vaddr + phdr->p_memsz)
            match = 1;
        }
      else if (phdr->p_type == PT_ARM_EXIDX)
       {
         data->exidx_start = (_Unwind_Ptr) (phdr->p_vaddr + load_base);
         data->exidx_len = phdr->p_memsz;
       }
    }

  return match;
}

Here is the caller graph for this function: