* [RFC/mips] Proposal for inlining heuristic_proc_desc a bit...
@ 2004-10-11 3:04 Joel Brobecker
2004-10-11 4:10 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: Joel Brobecker @ 2004-10-11 3:04 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC/mips] Proposal for inlining heuristic_proc_desc a bit...
2004-10-11 3:04 [RFC/mips] Proposal for inlining heuristic_proc_desc a bit Joel Brobecker
@ 2004-10-11 4:10 ` Andrew Cagney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2004-10-11 4:10 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
> 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.
Yes. One block of code with all the heuristics.
> . Should the scanning limit (200 bytes) be checked in the caller,
> or inside scan_prologue. Again, I chose the latter.
Yes (although I think that limit is bogus :-).
> This is mostly to avoid duplicating this code. What do you think?
Consider them pre approved.
> 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.
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-11 4:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 3:04 [RFC/mips] Proposal for inlining heuristic_proc_desc a bit Joel Brobecker
2004-10-11 4:10 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox