public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: binutils@sources.redhat.com
Cc: Jason R Thorpe <thorpej@wasabisystems.com>
Subject: Re: [RFA] gprof static call support for MIPS
Date: Sun, 20 Jan 2002 15:59:00 -0000	[thread overview]
Message-ID: <20020120182605.A17367@nevyn.them.org> (raw)
In-Reply-To: <20020120150822.Q8364@dr-evil.shagadelic.org>

On Sun, Jan 20, 2002 at 03:08:22PM -0800, Jason R Thorpe wrote:
> The following adds support for the gprof -c option (static call
> graph by hueristic) on the MIPS.  It was derived from similar code
> for the Alpha.
> 
> OK to commit?
> 
> 	* mips.c: New file.
> 	* Makefile.am (sources): Add mips.c.
> 	(mips.o): New rule.
> 	* Makefile.in: Regenerate.
> 	* corefile.c: Update copyright years.
> 	(find_call): Call mips_find_call for bfd_arch_mips.
> 
> -- 
>         -- Jason R. Thorpe <thorpej@wasabisystems.com>

> +   for (pc = p_lowpc; pc < p_highpc; pc += 4)
> +     {
> +       op = bfd_get_32 (core_bfd, &((char *)core_text_space)[pc - s_lowpc]);
> +       if ((op & 0xfc000000) == 0x0c000000)
> + 	{
> + 	  /* This is a "jal" instruction.  Check that the destination
> + 	     is the address of a function.  */
> + 	  DBG (CALLDEBUG,
> + 	       printf (_("[find_call] 0x%lx: jal"), (unsigned long) pc));
> +           offset = (op & 0x03ffffff) << 2;
> + 	  dest_pc = (pc & ~0xfffffff) | offset;
> + 	  if (dest_pc >= s_lowpc && dest_pc <= s_highpc)
> + 	    {
> + 	      child = sym_lookup (&symtab, dest_pc);
> + 	      DBG (CALLDEBUG,
> + 		   printf (" 0x%lx\t; name=%s, addr=0x%lx",
> + 			   (unsigned long) dest_pc, child->name,
> + 			   (unsigned long) child->addr));
> + 	      if (child->addr == dest_pc)
> + 		{
> + 		  DBG (CALLDEBUG, printf ("\n"));
> + 		  /* a hit:  */
> + 		  arc_add (parent, child, (unsigned long) 0);
> + 		  continue;
> + 		}
> + 	    }
> + 	  /* Something funny going on.  */
> + 	  DBG (CALLDEBUG, printf ("\tbut it's a botch\n"));
> + 	}
> +       else if ((op & 0xfc00f83f) == 0x0000f809)
> + 	{
> + 	  /* This is a "jalr" instruction (indirect call).  */
> + 	  DBG (CALLDEBUG,
> + 	       printf (_("[find_call] 0x%lx: jalr\n"), (unsigned long) pc));
> + 	  arc_add (parent, &indirect_child, (unsigned long) 0);
> + 	}
> +     }
> + }

Is this going to do any good for NetBSD?  I thought I remembered you
saying that NetBSD/MIPS used -mabicalls, when you posted the profiling
patch.  In that case all interesting calls are indirect!

Then again I don't see abicalls set for netbsd in the community GCC
tree.
-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

  reply	other threads:[~2002-01-20 23:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-20 15:54 Jason R Thorpe
2002-01-20 15:59 ` Daniel Jacobowitz [this message]
2002-01-20 16:12   ` Jason R Thorpe
2002-01-20 16:22     ` Daniel Jacobowitz
2002-01-25  9:03       ` Jason R Thorpe
2002-01-25 11:59         ` Daniel Jacobowitz
2002-01-26  2:28 ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020120182605.A17367@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=binutils@sources.redhat.com \
    --cc=thorpej@wasabisystems.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).