Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
b2a0d36f
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b2a0d36f
编写于
3月 04, 2007
作者:
R
Russell King
提交者:
Russell King
4月 21, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ARM] ptrace: clean up single stepping support
Signed-off-by:
N
Russell King
<
rmk+kernel@arm.linux.org.uk
>
上级
0f0a00be
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
28 deletion
+48
-28
arch/arm/kernel/ptrace.c
arch/arm/kernel/ptrace.c
+4
-11
arch/arm/kernel/ptrace.h
arch/arm/kernel/ptrace.h
+39
-0
arch/arm/kernel/signal.c
arch/arm/kernel/signal.c
+5
-17
未找到文件。
arch/arm/kernel/ptrace.c
浏览文件 @
b2a0d36f
...
...
@@ -457,13 +457,10 @@ void ptrace_cancel_bpt(struct task_struct *child)
/*
* Called by kernel/ptrace.c when detaching..
*
* Make sure the single step bit is not set.
*/
void
ptrace_disable
(
struct
task_struct
*
child
)
{
child
->
ptrace
&=
~
PT_SINGLESTEP
;
ptrace_cancel_bpt
(
child
);
single_step_disable
(
child
);
}
/*
...
...
@@ -712,9 +709,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
else
clear_tsk_thread_flag
(
child
,
TIF_SYSCALL_TRACE
);
child
->
exit_code
=
data
;
/* make sure single-step breakpoint is gone. */
child
->
ptrace
&=
~
PT_SINGLESTEP
;
ptrace_cancel_bpt
(
child
);
single_step_disable
(
child
);
wake_up_process
(
child
);
ret
=
0
;
break
;
...
...
@@ -725,9 +720,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
* exit.
*/
case
PTRACE_KILL
:
/* make sure single-step breakpoint is gone. */
child
->
ptrace
&=
~
PT_SINGLESTEP
;
ptrace_cancel_bpt
(
child
);
single_step_disable
(
child
);
if
(
child
->
exit_state
!=
EXIT_ZOMBIE
)
{
child
->
exit_code
=
SIGKILL
;
wake_up_process
(
child
);
...
...
@@ -742,7 +735,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
ret
=
-
EIO
;
if
(
!
valid_signal
(
data
))
break
;
child
->
ptrace
|=
PT_SINGLESTEP
;
single_step_enable
(
child
)
;
clear_tsk_thread_flag
(
child
,
TIF_SYSCALL_TRACE
);
child
->
exit_code
=
data
;
/* give it a chance to run. */
...
...
arch/arm/kernel/ptrace.h
浏览文件 @
b2a0d36f
...
...
@@ -7,6 +7,45 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/ptrace.h>
extern
void
ptrace_cancel_bpt
(
struct
task_struct
*
);
extern
void
ptrace_set_bpt
(
struct
task_struct
*
);
extern
void
ptrace_break
(
struct
task_struct
*
,
struct
pt_regs
*
);
/*
* make sure single-step breakpoint is gone.
*/
static
inline
void
single_step_disable
(
struct
task_struct
*
task
)
{
task
->
ptrace
&=
~
PT_SINGLESTEP
;
ptrace_cancel_bpt
(
task
);
}
static
inline
void
single_step_enable
(
struct
task_struct
*
task
)
{
task
->
ptrace
|=
PT_SINGLESTEP
;
}
/*
* Send SIGTRAP if we're single-stepping
*/
static
inline
void
single_step_trap
(
struct
task_struct
*
task
)
{
if
(
task
->
ptrace
&
PT_SINGLESTEP
)
{
ptrace_cancel_bpt
(
task
);
send_sig
(
SIGTRAP
,
task
,
1
);
}
}
static
inline
void
single_step_clear
(
struct
task_struct
*
task
)
{
if
(
task
->
ptrace
&
PT_SINGLESTEP
)
ptrace_cancel_bpt
(
task
);
}
static
inline
void
single_step_set
(
struct
task_struct
*
task
)
{
if
(
task
->
ptrace
&
PT_SINGLESTEP
)
ptrace_set_bpt
(
task
);
}
arch/arm/kernel/signal.c
浏览文件 @
b2a0d36f
...
...
@@ -9,7 +9,6 @@
*/
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/ptrace.h>
#include <linux/personality.h>
#include <linux/freezer.h>
...
...
@@ -285,11 +284,7 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
if
(
restore_sigframe
(
regs
,
frame
))
goto
badframe
;
/* Send SIGTRAP if we're single-stepping */
if
(
current
->
ptrace
&
PT_SINGLESTEP
)
{
ptrace_cancel_bpt
(
current
);
send_sig
(
SIGTRAP
,
current
,
1
);
}
single_step_trap
(
current
);
return
regs
->
ARM_r0
;
...
...
@@ -324,11 +319,7 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
if
(
do_sigaltstack
(
&
frame
->
sig
.
uc
.
uc_stack
,
NULL
,
regs
->
ARM_sp
)
==
-
EFAULT
)
goto
badframe
;
/* Send SIGTRAP if we're single-stepping */
if
(
current
->
ptrace
&
PT_SINGLESTEP
)
{
ptrace_cancel_bpt
(
current
);
send_sig
(
SIGTRAP
,
current
,
1
);
}
single_step_trap
(
current
);
return
regs
->
ARM_r0
;
...
...
@@ -644,14 +635,12 @@ static int do_signal(sigset_t *oldset, struct pt_regs *regs, int syscall)
if
(
try_to_freeze
())
goto
no_signal
;
if
(
current
->
ptrace
&
PT_SINGLESTEP
)
ptrace_cancel_bpt
(
current
);
single_step_clear
(
current
);
signr
=
get_signal_to_deliver
(
&
info
,
&
ka
,
regs
,
NULL
);
if
(
signr
>
0
)
{
handle_signal
(
signr
,
&
ka
,
&
info
,
oldset
,
regs
,
syscall
);
if
(
current
->
ptrace
&
PT_SINGLESTEP
)
ptrace_set_bpt
(
current
);
single_step_set
(
current
);
return
1
;
}
...
...
@@ -705,8 +694,7 @@ static int do_signal(sigset_t *oldset, struct pt_regs *regs, int syscall)
restart_syscall
(
regs
);
}
}
if
(
current
->
ptrace
&
PT_SINGLESTEP
)
ptrace_set_bpt
(
current
);
single_step_set
(
current
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录