* [hpux] Improve sigtramp frame identification
@ 2005-11-19 16:06 Randolph Chung
2005-12-07 1:18 ` Mark Kettenis
0 siblings, 1 reply; 8+ messages in thread
From: Randolph Chung @ 2005-11-19 16:06 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 212 bytes --]
the old code used to be hardcoded to look for a "_sigreturn" function,
but according to the ABI, the signal frame can be identified by a
specific bit in the unwind record. Use that instead.
committed
randolph
[-- Attachment #2: hpux-sig.diff --]
[-- Type: text/x-patch, Size: 1007 bytes --]
2005-11-19 Randolph Chung <tausq@debian.org>
* hppa-hpux-tdep.c (hppa_hpux_sigtramp_unwind_sniffer): Rely on the
unwind record to determine a signal frame, instead of hardcoding
a function name.
Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.43
diff -u -p -r1.43 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 29 Oct 2005 21:31:45 -0000 1.43
+++ hppa-hpux-tdep.c 19 Nov 2005 12:43:47 -0000
@@ -1246,12 +1274,12 @@ static const struct frame_unwind hppa_hp
static const struct frame_unwind *
hppa_hpux_sigtramp_unwind_sniffer (struct frame_info *next_frame)
{
+ struct unwind_table_entry *u;
CORE_ADDR pc = frame_pc_unwind (next_frame);
- char *name;
- find_pc_partial_function (pc, &name, NULL, NULL);
+ u = find_unwind_entry (pc);
- if (name && strcmp(name, "_sigreturn") == 0)
+ if (u && u->HP_UX_interrupt_marker)
return &hppa_hpux_sigtramp_frame_unwind;
return NULL;
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [hpux] Improve sigtramp frame identification
2005-11-19 16:06 [hpux] Improve sigtramp frame identification Randolph Chung
@ 2005-12-07 1:18 ` Mark Kettenis
2005-12-07 17:54 ` Randolph Chung
2005-12-07 19:31 ` Randolph Chung
0 siblings, 2 replies; 8+ messages in thread
From: Mark Kettenis @ 2005-12-07 1:18 UTC (permalink / raw)
To: randolph; +Cc: gdb-patches
> Date: Sat, 19 Nov 2005 20:48:37 +0800
> From: Randolph Chung <randolph@tausq.org>
>
> the old code used to be hardcoded to look for a "_sigreturn" function,
> but according to the ABI, the signal frame can be identified by a
> specific bit in the unwind record. Use that instead.
Bleah, this seems to have broken sigtramp detection on HP-UX 10.20.
Problem is that if we go up one frame from the signal handler we end
up in the export stub for _sigreturn, and not _sigreturn itself. The
export stub doesn't have the HP_UX_interrupt_marker bit set in the
unwind record.
Did you make this change to fix a specific problem? If not I'd like
to add the strcmp() back in...
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [hpux] Improve sigtramp frame identification
2005-12-07 1:18 ` Mark Kettenis
@ 2005-12-07 17:54 ` Randolph Chung
2005-12-13 10:00 ` Mark Kettenis
2005-12-07 19:31 ` Randolph Chung
1 sibling, 1 reply; 8+ messages in thread
From: Randolph Chung @ 2005-12-07 17:54 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
> Bleah, this seems to have broken sigtramp detection on HP-UX 10.20.
> Problem is that if we go up one frame from the signal handler we end
> up in the export stub for _sigreturn, and not _sigreturn itself. The
> export stub doesn't have the HP_UX_interrupt_marker bit set in the
> unwind record.
>
> Did you make this change to fix a specific problem? If not I'd like
> to add the strcmp() back in...
sigh, ok, please add the strcmp back (with a comment).
randolph
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [hpux] Improve sigtramp frame identification
2005-12-07 17:54 ` Randolph Chung
@ 2005-12-13 10:00 ` Mark Kettenis
2005-12-13 10:06 ` Randolph Chung
0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2005-12-13 10:00 UTC (permalink / raw)
To: randolph; +Cc: gdb-patches
> Date: Wed, 07 Dec 2005 07:31:00 +0800
> From: Randolph Chung <randolph@tausq.org>
>
> > Bleah, this seems to have broken sigtramp detection on HP-UX 10.20.
> > Problem is that if we go up one frame from the signal handler we end
> > up in the export stub for _sigreturn, and not _sigreturn itself. The
> > export stub doesn't have the HP_UX_interrupt_marker bit set in the
> > unwind record.
> >
> > Did you make this change to fix a specific problem? If not I'd like
> > to add the strcmp() back in...
>
> sigh, ok, please add the strcmp back (with a comment).
Hmm, here's an alternative approach: if we're in an export stub, look
if the stub leads us to a function that has HP_UX_interrupt_marker set
in its unwind record. This makes us read an instruction from the
inferior, but it should be pretty robust.
ok?
Now that signal trampolines get detected again on HP-UX 10.20, I
noticed another recent change that seems to have broken things. Your
recent overhaul of hppa_hpux_sigtramp_frame_unwind_cache added these
two lines:
info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr =
info->saved_regs[HPPA_RP_REGNUM].addr;
This breaks stuff, since at least on HP-UX 10.20 %pcoqh as read from
the signal state is correct. And I have a hard time believing that
this would be different on HP-UX 11.xx. Can you explain why you added
this?
Mark
Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.45
diff -u -p -r1.45 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 19 Nov 2005 12:55:55 -0000 1.45
+++ hppa-hpux-tdep.c 11 Dec 2005 11:04:03 -0000
@@ -1233,9 +1233,6 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
/* TODO: fp regs */
- info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr =
- info->saved_regs[HPPA_RP_REGNUM].addr;
-
info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
return info;
@@ -1279,6 +1276,21 @@ hppa_hpux_sigtramp_unwind_sniffer (struc
u = find_unwind_entry (pc);
+ /* If this is an export stub, try to get the unwind descriptor for
+ the actual function itself. */
+ if (u && u->stub_unwind.stub_type == EXPORT)
+ {
+ gdb_byte buf[HPPA_INSN_SIZE];
+ unsigned long insn;
+
+ if (!safe_frame_unwind_memory (next_frame, pc, buf, sizeof buf))
+ return NULL;
+
+ insn = extract_unsigned_integer (buf, sizeof buf);
+ if ((insn & 0xffe0e000) == 0xe8400000)
+ u = find_unwind_entry(pc + hppa_extract_17 (insn) + 8);
+ }
+
if (u && u->HP_UX_interrupt_marker)
return &hppa_hpux_sigtramp_frame_unwind;
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [hpux] Improve sigtramp frame identification
2005-12-13 10:00 ` Mark Kettenis
@ 2005-12-13 10:06 ` Randolph Chung
2005-12-13 20:20 ` Mark Kettenis
0 siblings, 1 reply; 8+ messages in thread
From: Randolph Chung @ 2005-12-13 10:06 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
> Hmm, here's an alternative approach: if we're in an export stub, look
> if the stub leads us to a function that has HP_UX_interrupt_marker set
> in its unwind record. This makes us read an instruction from the
> inferior, but it should be pretty robust.
>
> ok?
Hrm, this seems to assume that you are sitting at a specific insn of the
export stub when doing unwinding. We should be able to unwind from any
insn in the export stub, right?
> Now that signal trampolines get detected again on HP-UX 10.20, I
> noticed another recent change that seems to have broken things. Your
> recent overhaul of hppa_hpux_sigtramp_frame_unwind_cache added these
> two lines:
>
> info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr =
> info->saved_regs[HPPA_RP_REGNUM].addr;
>
> This breaks stuff, since at least on HP-UX 10.20 %pcoqh as read from
> the signal state is correct. And I have a hard time believing that
> this would be different on HP-UX 11.xx. Can you explain why you added
> this?
You are right, I shouldn't have added that. I thought this fixed a
problem with signal frame unwinding when I was looking at
hppa64-hp-hpux11.11, but actually I think something else is broken.
Sorry for not testing this more thoroughly before committing. I'll back
out that change tomorrow.
A few gcc bugs were making it a bit difficult for me to get good
testsuite runs, but I think I have a good environment now that I can
test hppa2.0w-hp-hpux11.11 and hppa64-hp-hpux11.11; I'll make sure I run
the testsuite on these targets before I commit any other non-trivial
hpux changes.
thanks for testing things out on hpux10.20... :)
randolph
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [hpux] Improve sigtramp frame identification
2005-12-13 10:06 ` Randolph Chung
@ 2005-12-13 20:20 ` Mark Kettenis
2005-12-13 20:35 ` Randolph Chung
0 siblings, 1 reply; 8+ messages in thread
From: Mark Kettenis @ 2005-12-13 20:20 UTC (permalink / raw)
To: randolph; +Cc: gdb-patches
> Date: Sun, 11 Dec 2005 22:39:12 +0800
> From: Randolph Chung <randolph@tausq.org>
>
> > Hmm, here's an alternative approach: if we're in an export stub, look
> > if the stub leads us to a function that has HP_UX_interrupt_marker set
> > in its unwind record. This makes us read an instruction from the
> > inferior, but it should be pretty robust.
> >
> > ok?
>
> Hrm, this seems to assume that you are sitting at a specific insn of the
> export stub when doing unwinding. We should be able to unwind from any
> insn in the export stub, right?
Uh, yes, you're right. The attached patch works indeed better. That
bit ok now?
> > Now that signal trampolines get detected again on HP-UX 10.20, I
> > noticed another recent change that seems to have broken things. Your
> > recent overhaul of hppa_hpux_sigtramp_frame_unwind_cache added these
> > two lines:
> >
> > info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr =
> > info->saved_regs[HPPA_RP_REGNUM].addr;
> >
> > This breaks stuff, since at least on HP-UX 10.20 %pcoqh as read from
> > the signal state is correct. And I have a hard time believing that
> > this would be different on HP-UX 11.xx. Can you explain why you added
> > this?
>
> You are right, I shouldn't have added that. I thought this fixed a
> problem with signal frame unwinding when I was looking at
> hppa64-hp-hpux11.11, but actually I think something else is broken.
> Sorry for not testing this more thoroughly before committing. I'll back
> out that change tomorrow.
Thanks!
Mark
Index: hppa-hpux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/hppa-hpux-tdep.c,v
retrieving revision 1.45
diff -u -p -r1.45 hppa-hpux-tdep.c
--- hppa-hpux-tdep.c 19 Nov 2005 12:55:55 -0000 1.45
+++ hppa-hpux-tdep.c 11 Dec 2005 19:14:14 -0000
@@ -1233,9 +1233,6 @@ hppa_hpux_sigtramp_frame_unwind_cache (s
/* TODO: fp regs */
- info->saved_regs[HPPA_PCOQ_HEAD_REGNUM].addr =
- info->saved_regs[HPPA_RP_REGNUM].addr;
-
info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
return info;
@@ -1279,6 +1276,22 @@ hppa_hpux_sigtramp_unwind_sniffer (struc
u = find_unwind_entry (pc);
+ /* If this is an export stub, try to get the unwind descriptor for
+ the actual function itself. */
+ if (u && u->stub_unwind.stub_type == EXPORT)
+ {
+ gdb_byte buf[HPPA_INSN_SIZE];
+ unsigned long insn;
+
+ if (!safe_frame_unwind_memory (next_frame, u->region_start,
+ buf, sizeof buf))
+ return NULL;
+
+ insn = extract_unsigned_integer (buf, sizeof buf);
+ if ((insn & 0xffe0e000) == 0xe8400000)
+ u = find_unwind_entry(u->region_start + hppa_extract_17 (insn) + 8);
+ }
+
if (u && u->HP_UX_interrupt_marker)
return &hppa_hpux_sigtramp_frame_unwind;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [hpux] Improve sigtramp frame identification
2005-12-07 1:18 ` Mark Kettenis
2005-12-07 17:54 ` Randolph Chung
@ 2005-12-07 19:31 ` Randolph Chung
1 sibling, 0 replies; 8+ messages in thread
From: Randolph Chung @ 2005-12-07 19:31 UTC (permalink / raw)
To: Mark Kettenis; +Cc: gdb-patches
> Bleah, this seems to have broken sigtramp detection on HP-UX 10.20.
> Problem is that if we go up one frame from the signal handler we end
> up in the export stub for _sigreturn, and not _sigreturn itself. The
> export stub doesn't have the HP_UX_interrupt_marker bit set in the
> unwind record.
>
> Did you make this change to fix a specific problem? If not I'd like
> to add the strcmp() back in...
BTW, you might want to read this thread:
http://sources.redhat.com/ml/gdb-patches/2004-05/msg00594.html
For the export stubs bit, the final message from Dan is here:
http://sources.redhat.com/ml/gdb-patches/2004-05/msg00741.html
I think this "problem" still exists even if you add the strcmp back in.
Suggestions on how to deal with this is welcome.
randolph
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2005-12-11 23:40 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-19 16:06 [hpux] Improve sigtramp frame identification Randolph Chung
2005-12-07 1:18 ` Mark Kettenis
2005-12-07 17:54 ` Randolph Chung
2005-12-13 10:00 ` Mark Kettenis
2005-12-13 10:06 ` Randolph Chung
2005-12-13 20:20 ` Mark Kettenis
2005-12-13 20:35 ` Randolph Chung
2005-12-07 19:31 ` Randolph Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox