* [patch/rfa] Some fixes for hppa fallback unwinder
@ 2004-05-22 6:34 Randolph Chung
2004-05-25 18:12 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Randolph Chung @ 2004-05-22 6:34 UTC (permalink / raw)
To: gdb-patches
This fixes some failures from signull.exp and more properly handles
stack adjustments when this unwinder is being used. It allows us to do
unwinding much better from assembly code.
i'll submit a separate patch to enable the gdb.asm tests for hppa.
ok to checkin?
randolph
2004-05-21 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_fallback_frame_cache): Handle stack adjustment,
unwinding from pc == 0, and multiple stack unwinds.
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.161
diff -u -p -r1.161 hppa-tdep.c
--- hppa-tdep.c 19 May 2004 02:38:28 -0000 1.161
+++ hppa-tdep.c 22 May 2004 05:22:22 -0000
@@ -1892,6 +1921,7 @@ static struct hppa_frame_cache *
hppa_fallback_frame_cache (struct frame_info *next_frame, void **this_cache)
{
struct hppa_frame_cache *cache;
+ unsigned int frame_size;
CORE_ADDR pc, start_pc, end_pc, cur_pc;
cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache);
@@ -1900,40 +1930,41 @@ hppa_fallback_frame_cache (struct frame_
pc = frame_func_unwind (next_frame);
cur_pc = frame_pc_unwind (next_frame);
+ frame_size = 0;
- find_pc_partial_function (pc, NULL, &start_pc, &end_pc);
-
- if (start_pc == 0 || end_pc == 0)
+ if (pc != 0)
{
- error ("Cannot find bounds of current function (@0x%s), unwinding will "
+ find_pc_partial_function (pc, NULL, &start_pc, &end_pc);
+
+ if (start_pc == 0 || end_pc == 0)
+ {
+ error ("Cannot find bounds of current function (@0x%s), unwinding will "
"fail.", paddr_nz (pc));
- return cache;
- }
+ return cache;
+ }
- if (end_pc > cur_pc)
- end_pc = cur_pc;
+ if (end_pc > cur_pc)
+ end_pc = cur_pc;
- for (pc = start_pc; pc < end_pc; pc += 4)
- {
- unsigned int insn;
+ for (pc = start_pc; pc < end_pc; pc += 4)
+ {
+ unsigned int insn;
- insn = read_memory_unsigned_integer (pc, 4);
+ insn = read_memory_unsigned_integer (pc, 4);
- /* There are limited ways to store the return pointer into the
- stack. */
- if (insn == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */
- {
- cache->saved_regs[HPPA_RP_REGNUM].addr = -20;
- break;
- }
- else if (insn == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */
- {
- cache->saved_regs[HPPA_RP_REGNUM].addr = -16;
- break;
- }
+ frame_size += prologue_inst_adjust_sp (insn);
+
+ /* There are limited ways to store the return pointer into the
+ stack. */
+ if (insn == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */
+ cache->saved_regs[HPPA_RP_REGNUM].addr = -20;
+ else if (insn == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */
+ cache->saved_regs[HPPA_RP_REGNUM].addr = -16;
+ }
}
- cache->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ cache->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM) - frame_size;
+ trad_frame_set_value (cache->saved_regs, HPPA_SP_REGNUM, cache->base);
if (trad_frame_addr_p (cache->saved_regs, HPPA_RP_REGNUM))
{
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [patch/rfa] Some fixes for hppa fallback unwinder
2004-05-22 6:34 [patch/rfa] Some fixes for hppa fallback unwinder Randolph Chung
@ 2004-05-25 18:12 ` Andrew Cagney
2004-05-25 18:35 ` Randolph Chung
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-05-25 18:12 UTC (permalink / raw)
To: Randolph Chung; +Cc: gdb-patches
- find_pc_partial_function (pc, NULL, &start_pc, &end_pc);
-
- if (start_pc == 0 || end_pc == 0)
+ if (pc != 0)
Would this case be better handled by the stub unwinder?
The other cases for unwinding in assembler are ok.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch/rfa] Some fixes for hppa fallback unwinder
2004-05-25 18:12 ` Andrew Cagney
@ 2004-05-25 18:35 ` Randolph Chung
2004-05-25 21:16 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Randolph Chung @ 2004-05-25 18:35 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
> >- if (start_pc == 0 || end_pc == 0)
> >+ if (pc != 0)
>
> Would this case be better handled by the stub unwinder?
i guess that works too. should i move it there?
randolph
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch/rfa] Some fixes for hppa fallback unwinder
2004-05-25 18:35 ` Randolph Chung
@ 2004-05-25 21:16 ` Andrew Cagney
2004-05-26 4:02 ` Randolph Chung
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-05-25 21:16 UTC (permalink / raw)
To: Randolph Chung; +Cc: gdb-patches
- if (start_pc == 0 || end_pc == 0)
>+ if (pc != 0)
Would this case be better handled by the stub unwinder?
i guess that works too. should i move it there?
Yes, feel free to commit that.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch/rfa] Some fixes for hppa fallback unwinder
2004-05-25 21:16 ` Andrew Cagney
@ 2004-05-26 4:02 ` Randolph Chung
0 siblings, 0 replies; 5+ messages in thread
From: Randolph Chung @ 2004-05-26 4:02 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
> >i guess that works too. should i move it there?
>
> Yes, feel free to commit that.
thanks. committed.
2004-05-25 Randolph Chung <tausq@debian.org>
* hppa-tdep.c (hppa_fallback_frame_cache): Handle stack adjustment,
and multiple stack unwinds.
(hppa_stub_unwind_sniffer): Handle unwind from pc == 0.
Index: hppa-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
retrieving revision 1.164
diff -u -p -r1.164 hppa-tdep.c
--- hppa-tdep.c 25 May 2004 03:55:23 -0000 1.164
+++ hppa-tdep.c 26 May 2004 03:56:38 -0000
@@ -1887,6 +1887,7 @@ static struct hppa_frame_cache *
hppa_fallback_frame_cache (struct frame_info *next_frame, void **this_cache)
{
struct hppa_frame_cache *cache;
+ unsigned int frame_size;
CORE_ADDR pc, start_pc, end_pc, cur_pc;
cache = FRAME_OBSTACK_ZALLOC (struct hppa_frame_cache);
@@ -1895,6 +1896,7 @@ hppa_fallback_frame_cache (struct frame_
pc = frame_func_unwind (next_frame);
cur_pc = frame_pc_unwind (next_frame);
+ frame_size = 0;
find_pc_partial_function (pc, NULL, &start_pc, &end_pc);
@@ -1914,21 +1916,18 @@ hppa_fallback_frame_cache (struct frame_
insn = read_memory_unsigned_integer (pc, 4);
+ frame_size += prologue_inst_adjust_sp (insn);
+
/* There are limited ways to store the return pointer into the
stack. */
if (insn == 0x6bc23fd9) /* stw rp,-0x14(sr0,sp) */
- {
- cache->saved_regs[HPPA_RP_REGNUM].addr = -20;
- break;
- }
+ cache->saved_regs[HPPA_RP_REGNUM].addr = -20;
else if (insn == 0x0fc212c1) /* std rp,-0x10(sr0,sp) */
- {
- cache->saved_regs[HPPA_RP_REGNUM].addr = -16;
- break;
- }
+ cache->saved_regs[HPPA_RP_REGNUM].addr = -16;
}
- cache->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
+ cache->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM) - frame_size;
+ trad_frame_set_value (cache->saved_regs, HPPA_SP_REGNUM, cache->base);
if (trad_frame_addr_p (cache->saved_regs, HPPA_RP_REGNUM))
{
@@ -2080,7 +2079,8 @@ hppa_stub_unwind_sniffer (struct frame_i
{
CORE_ADDR pc = frame_pc_unwind (next_frame);
- if (IN_SOLIB_CALL_TRAMPOLINE (pc, NULL)
+ if (pc == 0
+ || IN_SOLIB_CALL_TRAMPOLINE (pc, NULL)
|| IN_SOLIB_RETURN_TRAMPOLINE (pc, NULL))
return &hppa_stub_frame_unwind;
return NULL;
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-05-26 4:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-22 6:34 [patch/rfa] Some fixes for hppa fallback unwinder Randolph Chung
2004-05-25 18:12 ` Andrew Cagney
2004-05-25 18:35 ` Randolph Chung
2004-05-25 21:16 ` Andrew Cagney
2004-05-26 4:02 ` Randolph Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox