From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6535 invoked by alias); 11 Oct 2004 03:04:10 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6526 invoked from network); 11 Oct 2004 03:04:08 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (142.179.108.108) by sourceware.org with SMTP; 11 Oct 2004 03:04:08 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id DBB6B47D98; Sun, 10 Oct 2004 20:04:07 -0700 (PDT) Date: Mon, 11 Oct 2004 03:04:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: [RFC/mips] Proposal for inlining heuristic_proc_desc a bit... Message-ID: <20041011030407.GC26446@gnat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2004-10/txt/msg00184.txt.bz2 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