* can't single-step on gdb
@ 2008-08-12 1:04 Hideo Saito
2008-08-12 2:22 ` Paul Mundt
2008-08-12 2:48 ` Paul Mundt
0 siblings, 2 replies; 3+ messages in thread
From: Hideo Saito @ 2008-08-12 1:04 UTC (permalink / raw)
To: linux-sh
Hi Paul,
I have a problem as to tracing a program using gdb on my platform(SH7780). I can single-step a program on gdb usually, however, in some conditions, I can not single-step the program because gdb does not change the PC without any failed assertions.
It seems that do_syscall_trace() sets SIGTRAP in exit_code in the task structure before the traced program executes the instruction. I think that do_syscall_trace should ignore single-step because the schedule of the traced process might be delayed.
--- ./arch/sh/kernel/ptrace_32.c.org 2008-04-17 11:49:44.000000000 +0900
+++ ./arch/sh/kernel/ptrace_32.c 2008-08-12 08:53:44.000000000 +0900
@@ -252,18 +252,17 @@ long arch_ptrace(struct task_struct *chi
asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
{
struct task_struct *tsk = current;
if (unlikely(current->audit_context) && entryexit)
audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]),
regs->regs[0]);
- if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
- !test_thread_flag(TIF_SINGLESTEP))
+ if (!test_thread_flag(TIF_SYSCALL_TRACE))
goto out;
if (!(tsk->ptrace & PT_PTRACED))
goto out;
/* the 0x80 provides a way for the tracing parent to distinguish
between a syscall stop and SIGTRAP delivery */
ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
!test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: can't single-step on gdb
2008-08-12 1:04 can't single-step on gdb Hideo Saito
@ 2008-08-12 2:22 ` Paul Mundt
2008-08-12 2:48 ` Paul Mundt
1 sibling, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2008-08-12 2:22 UTC (permalink / raw)
To: linux-sh
On Tue, Aug 12, 2008 at 10:04:34AM +0900, Hideo Saito wrote:
> Hi Paul,
>
> I have a problem as to tracing a program using gdb on my
> platform(SH7780). I can single-step a program on gdb usually, however,
> in some conditions, I can not single-step the program because gdb does
> not change the PC without any failed assertions.
>
> It seems that do_syscall_trace() sets SIGTRAP in exit_code in the task
> structure before the traced program executes the instruction. I think
> that do_syscall_trace should ignore single-step because the schedule of
> the traced process might be delayed.
>
Yes, there were a couple of other single-step related bugs that showed up
as well. All of those fixes went in to 2.6.27-rc2, so you may want to
take a look at that. Please see if you have any outstanding issues with
current git.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: can't single-step on gdb
2008-08-12 1:04 can't single-step on gdb Hideo Saito
2008-08-12 2:22 ` Paul Mundt
@ 2008-08-12 2:48 ` Paul Mundt
1 sibling, 0 replies; 3+ messages in thread
From: Paul Mundt @ 2008-08-12 2:48 UTC (permalink / raw)
To: linux-sh
On Tue, Aug 12, 2008 at 11:22:10AM +0900, Paul Mundt wrote:
> On Tue, Aug 12, 2008 at 10:04:34AM +0900, Hideo Saito wrote:
> > Hi Paul,
> >
> > I have a problem as to tracing a program using gdb on my
> > platform(SH7780). I can single-step a program on gdb usually, however,
> > in some conditions, I can not single-step the program because gdb does
> > not change the PC without any failed assertions.
> >
> > It seems that do_syscall_trace() sets SIGTRAP in exit_code in the task
> > structure before the traced program executes the instruction. I think
> > that do_syscall_trace should ignore single-step because the schedule of
> > the traced process might be delayed.
> >
> Yes, there were a couple of other single-step related bugs that showed up
> as well. All of those fixes went in to 2.6.27-rc2, so you may want to
> take a look at that. Please see if you have any outstanding issues with
> current git.
To elaborate on this, the single-step rework falls in to a couple of
categories:
- general bugs
- hooking in to the general ptrace API more consistently
- tracehook conversion
the first two you can easily backport in to whatever kernel you happen to
be using, while the tracehook bits are obviously only going to be
relevant for recent kernels.
Given that, the commits you want to look at are probably:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hÎc3fd3e2a7cacf37e2bd6d9fa915337245cc563;hpÚf423db3b6afd90ecdd776dbc32c0b57cc78edb
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;hÄ59dbf294b4a3d70490a468a7ca3907fb2c2f57
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h«99c733ae73cce31f2a2434f7099564e5a73d95
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-12 2:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-12 1:04 can't single-step on gdb Hideo Saito
2008-08-12 2:22 ` Paul Mundt
2008-08-12 2:48 ` Paul Mundt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox