2 * Copyright (c) 1983, 1998 Regents of the University of California.
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.
25 static Sym indirect_child
;
27 void mips_find_call
PARAMS ((Sym
*, bfd_vma
, bfd_vma
));
30 mips_find_call (parent
, p_lowpc
, p_highpc
)
39 static bool inited
= FALSE
;
44 sym_init (&indirect_child
);
45 indirect_child
.name
= _("<indirect child>");
46 indirect_child
.cg
.prop
.fract
= 1.0;
47 indirect_child
.cg
.cyc
.head
= &indirect_child
;
54 if (p_lowpc
< s_lowpc
)
58 if (p_highpc
> s_highpc
)
62 DBG (CALLDEBUG
, printf (_("[find_call] %s: 0x%lx to 0x%lx\n"),
63 parent
->name
, (unsigned long) p_lowpc
,
64 (unsigned long) p_highpc
));
65 for (pc
= p_lowpc
; pc
< p_highpc
; pc
+= 4)
67 op
= bfd_get_32 (core_bfd
, &((char *)core_text_space
)[pc
- s_lowpc
]);
68 if ((op
& 0xfc000000) == 0x0c000000)
70 /* This is a "jal" instruction. Check that the destination
71 is the address of a function. */
73 printf (_("[find_call] 0x%lx: jal"), (unsigned long) pc
));
74 offset
= (op
& 0x03ffffff) << 2;
75 dest_pc
= (pc
& ~0xfffffff) | offset
;
76 if (dest_pc
>= s_lowpc
&& dest_pc
<= s_highpc
)
78 child
= sym_lookup (&symtab
, dest_pc
);
80 printf (" 0x%lx\t; name=%s, addr=0x%lx",
81 (unsigned long) dest_pc
, child
->name
,
82 (unsigned long) child
->addr
));
83 if (child
->addr
== dest_pc
)
85 DBG (CALLDEBUG
, printf ("\n"));
87 arc_add (parent
, child
, (unsigned long) 0);
91 /* Something funny going on. */
92 DBG (CALLDEBUG
, printf ("\tbut it's a botch\n"));
94 else if ((op
& 0xfc00f83f) == 0x0000f809)
96 /* This is a "jalr" instruction (indirect call). */
98 printf (_("[find_call] 0x%lx: jalr\n"), (unsigned long) pc
));
99 arc_add (parent
, &indirect_child
, (unsigned long) 0);
This page took 0.033655 seconds and 4 git commands to generate.