Back to index

cell-binutils  2.17cvs20070401
Defines | Functions
sparc.c File Reference
#include "gprof.h"
#include "search_list.h"
#include "source.h"
#include "symtab.h"
#include "cg_arcs.h"
#include "corefile.h"
#include "hist.h"

Go to the source code of this file.

Defines

#define CALL   (0xc0000000)

Functions

void sparc_find_call (Sym *, bfd_vma, bfd_vma)

Define Documentation

#define CALL   (0xc0000000)

Definition at line 40 of file sparc.c.


Function Documentation

void sparc_find_call ( Sym parent,
bfd_vma  p_lowpc,
bfd_vma  p_highpc 
)

Definition at line 45 of file sparc.c.

{
  bfd_vma pc, dest_pc;
  unsigned int insn;
  Sym *child;

  if (core_text_space == 0)
    {
      return;
    }
  if (p_lowpc < s_lowpc)
    {
      p_lowpc = s_lowpc;
    }
  if (p_highpc > s_highpc)
    {
      p_highpc = s_highpc;
    }
  DBG (CALLDEBUG, printf ("[find_call] %s: 0x%lx to 0x%lx\n",
                       parent->name, (unsigned long) p_lowpc,
                       (unsigned long) p_highpc));
  for (pc = (p_lowpc + 3) & ~(bfd_vma) 3; pc < p_highpc; pc += 4)
    {
      insn = bfd_get_32 (core_bfd, ((unsigned char *) core_text_space
                                + pc - core_text_sect->vma));
      if (insn & CALL)
       {
         DBG (CALLDEBUG,
              printf ("[find_call] 0x%lx: callf", (unsigned long) pc));
         /*
          * Regular pc relative addressing check that this is the
          * address of a function.
          */
         dest_pc = pc + (((bfd_signed_vma) (insn & 0x3fffffff)
                        ^ 0x20000000) - 0x20000000);
         if (dest_pc >= s_lowpc && dest_pc <= s_highpc)
           {
             child = sym_lookup (&symtab, dest_pc);
             DBG (CALLDEBUG,
                 printf ("\tdest_pc=0x%lx, (name=%s, addr=0x%lx)\n",
                        (unsigned long) dest_pc, child->name,
                        (unsigned long) child->addr));
             if (child->addr == dest_pc)
              {
                /* a hit:  */
                arc_add (parent, child, (unsigned long) 0);
                continue;
              }
           }
         /*
          * Something funny going on.
          */
         DBG (CALLDEBUG, printf ("\tbut it's a botch\n"));
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: