Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/gprof/alpha.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/*
    2  * Copyright (c) 1983, 1998 Regents of the University of California.
    3  * All rights reserved.
     2 * Copyright (c) 1983, 1993, 1998
     3 *      The Regents of the University of California.  All rights reserved.
    44 *
    5  * Redistribution and use in source and binary forms are permitted
    6  * provided that: (1) source distributions retain this entire copyright
    7  * notice and comment, and (2) distributions including binaries display
    8  * the following acknowledgement:  ``This product includes software
    9  * developed by the University of California, Berkeley and its contributors''
    10  * in the documentation or other materials provided with the distribution
    11  * and in all advertising materials mentioning features or use of this
    12  * software. Neither the name of the University nor the names of its
    13  * contributors may be used to endorse or promote products derived
    14  * from this software without specific prior written permission.
    15  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
    16  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
    17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 * 1. Redistributions of source code must retain the above copyright
     9 *    notice, this list of conditions and the following disclaimer.
     10 * 2. Redistributions in binary form must reproduce the above copyright
     11 *    notice, this list of conditions and the following disclaimer in the
     12 *    documentation and/or other materials provided with the distribution.
     13 * 3. Neither the name of the University nor the names of its contributors
     14 *    may be used to endorse or promote products derived from this software
     15 *    without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     20 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     27 * SUCH DAMAGE.
    1828 */
    1929#include "gprof.h"
     30#include "search_list.h"
     31#include "source.h"
     32#include "symtab.h"
    2033#include "cg_arcs.h"
    2134#include "corefile.h"
    2235#include "hist.h"
    23 #include "symtab.h"
    2436
    2537/*
     
    3446#define Jxx_FUNC_JSR_COROUTINE  3
    3547
     48#if 0
     49/* Here to document only.  We can't use this when cross compiling as
     50   the bitfield layout might not be the same as native.  */
    3651typedef union
    3752  {
     
    6075  }
    6176alpha_Instruction;
     77#endif
    6278
    6379static Sym indirect_child;
    6480
     81void alpha_find_call PARAMS ((Sym *, bfd_vma, bfd_vma));
    6582
    6683/*
     
    7794     bfd_vma p_highpc;
    7895{
    79   static bfd_vma delta = 0;
    80   bfd_vma dest_pc;
    81   alpha_Instruction *pc;
     96  bfd_vma pc, dest_pc;
     97  unsigned int insn;
    8298  Sym *child;
    8399
    84   if (!delta)
     100  if (indirect_child.name == NULL)
    85101    {
    86       delta = (bfd_vma) core_text_space - core_text_sect->vma;
    87 
    88102      sym_init (&indirect_child);
    89103      indirect_child.name = _("<indirect child>");
     
    107121                          parent->name, (unsigned long) p_lowpc,
    108122                          (unsigned long) p_highpc));
    109   for (pc = (alpha_Instruction *) (p_lowpc + delta);
    110        pc < (alpha_Instruction *) (p_highpc + delta);
    111        ++pc)
     123  for (pc = (p_lowpc + 3) & ~(bfd_vma) 3; pc < p_highpc; pc += 4)
    112124    {
    113       switch (pc->a.op_code)
     125      insn = bfd_get_32 (core_bfd, ((unsigned char *) core_text_space
     126                                    + pc - core_text_sect->vma));
     127      switch (insn & (0x3f << 26))
    114128        {
    115         case OP_Jxx:
     129        case OP_Jxx << 26:
    116130          /*
    117131           * There is no simple and reliable way to determine the
     
    122136           * to see that there are other calls as well.
    123137           */
    124           if (pc->j.func == Jxx_FUNC_JSR
    125               || pc->j.func == Jxx_FUNC_JSR_COROUTINE)
     138          if ((insn & (3 << 14)) == Jxx_FUNC_JSR << 14
     139              || (insn & (3 << 14)) == Jxx_FUNC_JSR_COROUTINE << 14)
    126140            {
    127141              DBG (CALLDEBUG,
    128142                   printf (_("[find_call] 0x%lx: jsr%s <indirect_child>\n"),
    129                            (unsigned long) pc - delta,
    130                            pc->j.func == Jxx_FUNC_JSR ? "" : "_coroutine"));
     143                           (unsigned long) pc,
     144                           ((insn & (3 << 14)) == Jxx_FUNC_JSR << 14
     145                            ? "" : "_coroutine")));
    131146              arc_add (parent, &indirect_child, (unsigned long) 0);
    132147            }
    133148          break;
    134149
    135         case OP_BSR:
     150        case OP_BSR << 26:
    136151          DBG (CALLDEBUG,
    137                printf (_("[find_call] 0x%lx: bsr"),
    138                        (unsigned long) pc - delta));
     152               printf (_("[find_call] 0x%lx: bsr"), (unsigned long) pc));
    139153          /*
    140154           * Regular PC relative addressing.  Check that this is the
    141155           * address of a function.  The linker sometimes redirects
    142156           * the entry point by 8 bytes to skip loading the global
    143            * pointer, so we all for either address:
     157           * pointer, so we allow for either address:
    144158           */
    145           dest_pc = ((bfd_vma) (pc + 1 + pc->b.disp)) - delta;
     159          dest_pc = pc + 4 + (((bfd_signed_vma) (insn & 0x1fffff)
     160                               ^ 0x100000) - 0x100000);
    146161          if (dest_pc >= s_lowpc && dest_pc <= s_highpc)
    147162            {
Note: See TracChangeset for help on using the changeset viewer.