Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@gnat.com>
To: gdb-patches@sources.redhat.com
Subject: [RFC/mips] Proposal for inlining heuristic_proc_desc a bit...
Date: Mon, 11 Oct 2004 03:04:00 -0000	[thread overview]
Message-ID: <20041011030407.GC26446@gnat.com> (raw)

Hello Andrew,

what would you think of something like this. It's just a concept,
it hasn't been compiled nor tested, but the idea is to remove the
call to heuristic_proc_desc() in mips_insn32_frame_cache() by a
a direct call to mips32_scan_prologue(). The same would be applied
to mips16.

The two things that are not obvious are:

  . Where should the SP be computed: in the caller ofo scan_prologue,
    or inside scan_prologue. I chose the latter.

  . Should the scanning limit (200 bytes) be checked in the caller,
    or inside scan_prologue. Again, I chose the latter.

This is mostly to avoid duplicating this code. What do you think?

You know, heuristic_proc_desc() is in grave danger of dying :-).
I have have a couple of things I'd like to work on first, but then
it should be ripe for removal.


Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.331
diff -u -p -r1.331 mips-tdep.c
--- mips-tdep.c	11 Oct 2004 02:27:13 -0000	1.331
+++ mips-tdep.c	11 Oct 2004 02:59:40 -0000
@@ -1841,7 +1841,7 @@ mips_insn32_frame_cache (struct frame_in
     if (start_addr == 0)
       return cache;
 
-    heuristic_proc_desc (start_addr, pc, next_frame, *this_cache);
+    mips32_scan_prologue (start_addr, pc, next_frame, *this_cache);
   }
   
   /* SP_REGNUM, contains the value and not the address.  */
@@ -2422,15 +2422,26 @@ reset_saved_regs (struct mips_frame_cach
    the associated FRAME_CACHE if not null.  */
 
 static void
-mips32_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc, CORE_ADDR sp,
+mips32_scan_prologue (CORE_ADDR start_pc, CORE_ADDR limit_pc,
                       struct frame_info *next_frame,
                       struct mips_frame_cache *this_cache)
 {
   CORE_ADDR cur_pc;
   CORE_ADDR frame_addr = 0; /* Value of $r30. Used by gcc for frame-pointer */
+  CORE_ADDR sp;
   long frame_offset;
   int  frame_reg = MIPS_SP_REGNUM;
 
+  /* Can be called when there's no process, and hence when there's no
+     NEXT_FRAME.  */
+  if (next_frame != NULL)
+    sp = read_next_frame_reg (next_frame, NUM_REGS + MIPS_SP_REGNUM);
+  else
+    sp = 0;
+
+  if (limit_pc > start_pc + 200)
+    limit_pc = start_pc + 200;
+
 restart:
 
   frame_offset = 0;
@@ -2569,7 +2580,7 @@ heuristic_proc_desc (CORE_ADDR start_pc,
   if (pc_is_mips16 (start_pc))
     mips16_scan_prologue (start_pc, limit_pc, sp, next_frame, this_cache);
   else
-    mips32_scan_prologue (start_pc, limit_pc, sp, next_frame, this_cache);
+    mips32_scan_prologue (start_pc, limit_pc, next_frame, this_cache);
   return &temp_proc_desc;
 }
 

-- 
Joel


             reply	other threads:[~2004-10-11  3:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-11  3:04 Joel Brobecker [this message]
2004-10-11  4:10 ` Andrew Cagney

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=20041011030407.GC26446@gnat.com \
    --to=brobecker@gnat.com \
    --cc=gdb-patches@sources.redhat.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