2 * Copyright (c) 1983 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.
27 DEFUN (i386_iscall
, (ip
), unsigned char *ip
)
36 i386_find_call (parent
, p_lowpc
, p_highpc
)
41 unsigned char *instructp
;
43 bfd_vma destpc
, delta
;
45 if (core_text_space
== 0)
49 if (p_lowpc
< s_lowpc
)
53 if (p_highpc
> s_highpc
)
57 DBG (CALLDEBUG
, printf ("[findcall] %s: 0x%lx to 0x%lx\n",
58 parent
->name
, p_lowpc
, p_highpc
));
60 delta
= (bfd_vma
) core_text_space
- core_text_sect
->vma
;
62 for (instructp
= (unsigned char *) (p_lowpc
+ delta
);
63 instructp
< (unsigned char *) (p_highpc
+ delta
);
66 if (i386_iscall (instructp
))
69 printf ("[findcall]\t0x%x:call",
70 instructp
- (unsigned char *) delta
));
72 * regular pc relative addressing
73 * check that this is the address of
77 destpc
= ((bfd_vma
) bfd_get_32 (core_bfd
, instructp
+ 1)
78 + (bfd_vma
) instructp
- (bfd_vma
) delta
+ 5);
79 if (destpc
>= s_lowpc
&& destpc
<= s_highpc
)
81 child
= sym_lookup (&symtab
, destpc
);
82 if (child
&& child
->addr
== destpc
)
88 printf ("\tdestpc 0x%lx (%s)\n", destpc
, child
->name
));
89 arc_add (parent
, child
, (unsigned long) 0);
90 instructp
+= 4; /* call is a 5 byte instruction */
96 * it looked like a callf, but it:
97 * a) wasn't actually a callf, or
98 * b) didn't point to a known function in the symtab, or
99 * c) something funny is going on.
101 DBG (CALLDEBUG
, printf ("\tbut it's a botch\n"));
This page took 0.030743 seconds and 4 git commands to generate.