Changeset 609 for branches/GNU/src/binutils/gprof/tahoe.c
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/gprof/tahoe.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* 2 * Copyright (c) 1983, 2001 Regents of the University of California.3 * All rights reserved.2 * Copyright (c) 1983, 1993, 2001 3 * The Regents of the University of California. All rights reserved. 4 4 * 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. 18 28 */ 19 29 #include "gprof.h" 30 #include "search_list.h" 31 #include "source.h" 32 #include "symtab.h" 20 33 #include "cg_arcs.h" 21 34 #include "corefile.h" 22 35 #include "hist.h" 23 #include "symtab.h"24 36 25 37 /* … … 45 57 * A symbol to be the child of indirect callf: 46 58 */ 47 Sym indirectchild; 48 49 50 tahoe_operandenum 59 static Sym indirectchild; 60 61 static tahoe_operandenum tahoe_operandmode PARAMS ((unsigned char *)); 62 static char *tahoe_operandname PARAMS ((tahoe_operandenum)); 63 static long tahoe_operandlength PARAMS ((unsigned char *)); 64 static bfd_signed_vma tahoe_offset PARAMS ((unsigned char *)); 65 void tahoe_find_call PARAMS ((Sym *, bfd_vma, bfd_vma)); 66 67 static tahoe_operandenum 51 68 tahoe_operandmode (modep) 52 69 unsigned char *modep; 53 70 { 54 long usesreg = ((long) *modep)& 0xf;55 56 switch (( (long) *modep) >> 4)71 long usesreg = *modep & 0xf; 72 73 switch ((*modep >> 4) & 0xf) 57 74 { 58 75 case 0: … … 90 107 } 91 108 92 char *109 static char * 93 110 tahoe_operandname (mode) 94 111 tahoe_operandenum mode; … … 144 161 } 145 162 146 long163 static long 147 164 tahoe_operandlength (modep) 148 165 unsigned char *modep; … … 182 199 } 183 200 184 bfd_vma185 tahoe_ reladdr(modep)186 char *modep;201 static bfd_signed_vma 202 tahoe_offset (modep) 203 unsigned char *modep; 187 204 { 188 205 tahoe_operandenum mode = tahoe_operandmode (modep); 189 char *cp; 190 short *sp; 191 long *lp; 192 int i; 193 long value = 0; 194 195 cp = modep; 196 ++cp; /* skip over the mode */ 206 207 ++modep; /* skip over the mode */ 197 208 switch (mode) 198 209 { 199 210 default: 200 211 fprintf (stderr, "[reladdr] not relative address\n"); 201 return (bfd_vma) modep;212 return 0; 202 213 case byterel: 203 return (bfd_vma) (cp + sizeof *cp + *cp);214 return 1 + bfd_get_signed_8 (core_bfd, modep); 204 215 case wordrel: 205 for (i = 0; (size_t) i < sizeof *sp; i++) 206 value = (value << 8) + (cp[i] & 0xff); 207 return (bfd_vma) (cp + sizeof *sp + value); 216 return 2 + bfd_get_signed_16 (core_bfd, modep); 208 217 case longrel: 209 for (i = 0; (size_t) i < sizeof *lp; i++) 210 value = (value << 8) + (cp[i] & 0xff); 211 return (bfd_vma) (cp + sizeof *lp + value); 218 return 4 + bfd_get_signed_32 (core_bfd, modep); 212 219 } 213 220 } … … 224 231 tahoe_operandenum mode; 225 232 tahoe_operandenum firstmode; 226 bfd_vma destpc;227 static b oolinited = FALSE;233 bfd_vma pc, destpc; 234 static bfd_boolean inited = FALSE; 228 235 229 236 if (!inited) … … 250 257 parent->name, (unsigned long) p_lowpc, 251 258 (unsigned long) p_highpc)); 252 for (instructp = (unsigned char *) core_text_space + p_lowpc; 253 instructp < (unsigned char *) core_text_space + p_highpc; 254 instructp += length) 259 for (pc = p_lowpc; pc < p_highpc; pc += length) 255 260 { 256 261 length = 1; 257 if (*instructp == CALLF) 262 instructp = ((unsigned char *) core_text_space 263 + pc - core_text_sect->vma); 264 if ((*instructp & 0xff) == CALLF) 258 265 { 259 266 /* … … 262 269 */ 263 270 DBG (CALLDEBUG, printf ("[findcall]\t0x%lx:callf", 264 ((unsigned long) 265 (instructp 266 - (unsigned char *) core_text_space)))); 271 (unsigned long) pc)); 267 272 firstmode = tahoe_operandmode (instructp + length); 268 273 switch (firstmode) … … 308 313 * a function. 309 314 */ 310 destpc = tahoe_reladdr (instructp + length) 311 - (bfd_vma) core_text_space; 315 destpc = pc + tahoe_offset (instructp + length); 312 316 if (destpc >= s_lowpc && destpc <= s_highpc) 313 317 { -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.