diff options
-rw-r--r-- | arch/ia64/kernel/ptrace.c | 96 | ||||
-rw-r--r-- | include/asm-ia64/ptrace.h | 7 |
2 files changed, 36 insertions, 67 deletions
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 1dfff5a8f365..f10c8b40dd3f 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c | |||
@@ -1454,6 +1454,35 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr) | |||
1454 | return ret; | 1454 | return ret; |
1455 | } | 1455 | } |
1456 | 1456 | ||
1457 | void | ||
1458 | user_enable_single_step (struct task_struct *child) | ||
1459 | { | ||
1460 | struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child)); | ||
1461 | |||
1462 | set_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
1463 | child_psr->ss = 1; | ||
1464 | } | ||
1465 | |||
1466 | void | ||
1467 | user_enable_block_step (struct task_struct *child) | ||
1468 | { | ||
1469 | struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child)); | ||
1470 | |||
1471 | set_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
1472 | child_psr->tb = 1; | ||
1473 | } | ||
1474 | |||
1475 | void | ||
1476 | user_disable_single_step (struct task_struct *child) | ||
1477 | { | ||
1478 | struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child)); | ||
1479 | |||
1480 | /* make sure the single step/taken-branch trap bits are not set: */ | ||
1481 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
1482 | child_psr->ss = 0; | ||
1483 | child_psr->tb = 0; | ||
1484 | } | ||
1485 | |||
1457 | /* | 1486 | /* |
1458 | * Called by kernel/ptrace.c when detaching.. | 1487 | * Called by kernel/ptrace.c when detaching.. |
1459 | * | 1488 | * |
@@ -1528,73 +1557,6 @@ arch_ptrace (struct task_struct *child, long request, long addr, long data) | |||
1528 | ret = ptrace_request(child, PTRACE_SETSIGINFO, addr, data); | 1557 | ret = ptrace_request(child, PTRACE_SETSIGINFO, addr, data); |
1529 | goto out_tsk; | 1558 | goto out_tsk; |
1530 | 1559 | ||
1531 | case PTRACE_SYSCALL: | ||
1532 | /* continue and stop at next (return from) syscall */ | ||
1533 | case PTRACE_CONT: | ||
1534 | /* restart after signal. */ | ||
1535 | ret = -EIO; | ||
1536 | if (!valid_signal(data)) | ||
1537 | goto out_tsk; | ||
1538 | if (request == PTRACE_SYSCALL) | ||
1539 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
1540 | else | ||
1541 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
1542 | child->exit_code = data; | ||
1543 | |||
1544 | /* | ||
1545 | * Make sure the single step/taken-branch trap bits | ||
1546 | * are not set: | ||
1547 | */ | ||
1548 | clear_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
1549 | ia64_psr(pt)->ss = 0; | ||
1550 | ia64_psr(pt)->tb = 0; | ||
1551 | |||
1552 | wake_up_process(child); | ||
1553 | ret = 0; | ||
1554 | goto out_tsk; | ||
1555 | |||
1556 | case PTRACE_KILL: | ||
1557 | /* | ||
1558 | * Make the child exit. Best I can do is send it a | ||
1559 | * sigkill. Perhaps it should be put in the status | ||
1560 | * that it wants to exit. | ||
1561 | */ | ||
1562 | if (child->exit_state == EXIT_ZOMBIE) | ||
1563 | /* already dead */ | ||
1564 | return 0; | ||
1565 | child->exit_code = SIGKILL; | ||
1566 | |||
1567 | ptrace_disable(child); | ||
1568 | wake_up_process(child); | ||
1569 | ret = 0; | ||
1570 | goto out_tsk; | ||
1571 | |||
1572 | case PTRACE_SINGLESTEP: | ||
1573 | /* let child execute for one instruction */ | ||
1574 | case PTRACE_SINGLEBLOCK: | ||
1575 | ret = -EIO; | ||
1576 | if (!valid_signal(data)) | ||
1577 | goto out_tsk; | ||
1578 | |||
1579 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | ||
1580 | set_tsk_thread_flag(child, TIF_SINGLESTEP); | ||
1581 | if (request == PTRACE_SINGLESTEP) { | ||
1582 | ia64_psr(pt)->ss = 1; | ||
1583 | } else { | ||
1584 | ia64_psr(pt)->tb = 1; | ||
1585 | } | ||
1586 | child->exit_code = data; | ||
1587 | |||
1588 | /* give it a chance to run. */ | ||
1589 | wake_up_process(child); | ||
1590 | ret = 0; | ||
1591 | goto out_tsk; | ||
1592 | |||
1593 | case PTRACE_DETACH: | ||
1594 | /* detach a process that was attached. */ | ||
1595 | ret = ptrace_detach(child, data); | ||
1596 | goto out_tsk; | ||
1597 | |||
1598 | case PTRACE_GETREGS: | 1560 | case PTRACE_GETREGS: |
1599 | ret = ptrace_getregs(child, | 1561 | ret = ptrace_getregs(child, |
1600 | (struct pt_all_user_regs __user *) data); | 1562 | (struct pt_all_user_regs __user *) data); |
diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index 5b5234098783..4b2a8d40ebc5 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h | |||
@@ -312,6 +312,13 @@ struct switch_stack { | |||
312 | #define arch_ptrace_attach(child) \ | 312 | #define arch_ptrace_attach(child) \ |
313 | ptrace_attach_sync_user_rbs(child) | 313 | ptrace_attach_sync_user_rbs(child) |
314 | 314 | ||
315 | #define arch_has_single_step() (1) | ||
316 | extern void user_enable_single_step(struct task_struct *); | ||
317 | extern void user_disable_single_step(struct task_struct *); | ||
318 | |||
319 | #define arch_has_block_step() (1) | ||
320 | extern void user_enable_block_step(struct task_struct *); | ||
321 | |||
315 | #endif /* !__KERNEL__ */ | 322 | #endif /* !__KERNEL__ */ |
316 | 323 | ||
317 | /* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ | 324 | /* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */ |