* Removed most of the special-casing for kernel breakpoints in the kernel
enter/exit code. There's no real reason not to keep kernel breakpoints enabled when in userland (unless there are breakpoints installed for the team, of course). * Enabled kernel breakpoints by default (check your kernel_debug_config.h, if you have overridden it!), since they don't really add any overhead anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30206 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
// benaphore-style.
|
||||
#define KDEBUG KDEBUG_LEVEL_2
|
||||
|
||||
// Enable this to get support for kernel breakpoints.
|
||||
#define KERNEL_BREAKPOINTS 0
|
||||
// Set to 0 to disable support for kernel breakpoints.
|
||||
#define KERNEL_BREAKPOINTS 1
|
||||
|
||||
|
||||
// block/file cache
|
||||
|
||||
@@ -98,16 +98,11 @@
|
||||
original eax/edx values */ \
|
||||
iret
|
||||
|
||||
#if KERNEL_BREAKPOINTS
|
||||
# define DISABLE_BREAKPOINTS() \
|
||||
call x86_exit_user_debug_at_kernel_entry;
|
||||
#else
|
||||
#define DISABLE_BREAKPOINTS() \
|
||||
testl $THREAD_FLAGS_BREAKPOINTS_INSTALLED, THREAD_flags(%edi); \
|
||||
jz 1f; \
|
||||
call x86_exit_user_debug_at_kernel_entry; \
|
||||
1:
|
||||
#endif // KERNEL_BREAKPOINTS
|
||||
|
||||
#define COPY_SYSCALL_PARAMETERS() \
|
||||
/* make room for the syscall params */ \
|
||||
@@ -311,14 +306,10 @@ STATIC_FUNCTION(int_bottom_user):
|
||||
cmp $USER_CODE_SEG, IFRAME_cs(%ebp)
|
||||
jne 1f
|
||||
|
||||
#if KERNEL_BREAKPOINTS
|
||||
jmp kernel_exit_work
|
||||
#else
|
||||
testl $(THREAD_FLAGS_DEBUGGER_INSTALLED | THREAD_FLAGS_SIGNALS_PENDING \
|
||||
| THREAD_FLAGS_DEBUG_THREAD | THREAD_FLAGS_BREAKPOINTS_DEFINED) \
|
||||
, THREAD_flags(%edi)
|
||||
jnz kernel_exit_work
|
||||
#endif
|
||||
1:
|
||||
|
||||
cli // disable interrupts
|
||||
@@ -422,16 +413,12 @@ STATIC_FUNCTION(handle_syscall):
|
||||
|
||||
TRACE_POST_SYSCALL()
|
||||
|
||||
#if KERNEL_BREAKPOINTS
|
||||
jmp post_syscall_work
|
||||
#else
|
||||
testl $(THREAD_FLAGS_DEBUGGER_INSTALLED | THREAD_FLAGS_SIGNALS_PENDING \
|
||||
| THREAD_FLAGS_DEBUG_THREAD | THREAD_FLAGS_BREAKPOINTS_DEFINED \
|
||||
| THREAD_FLAGS_64_BIT_SYSCALL_RETURN \
|
||||
| THREAD_FLAGS_RESTART_SYSCALL | THREAD_FLAGS_SYSCALL_RESTARTED) \
|
||||
, THREAD_flags(%edi)
|
||||
jnz post_syscall_work
|
||||
#endif
|
||||
|
||||
cli // disable interrupts
|
||||
|
||||
@@ -507,10 +494,8 @@ FUNCTION_END(handle_syscall)
|
||||
1:
|
||||
|
||||
// install breakpoints, if defined
|
||||
#if !KERNEL_BREAKPOINTS
|
||||
testl $THREAD_FLAGS_BREAKPOINTS_DEFINED, THREAD_flags(%edi)
|
||||
jz 1f
|
||||
#endif
|
||||
push %ebp
|
||||
call x86_init_user_debug_at_kernel_exit
|
||||
1:
|
||||
|
||||
@@ -710,17 +710,18 @@ x86_init_user_debug_at_kernel_exit(struct iframe *frame)
|
||||
{
|
||||
struct thread *thread = thread_get_current_thread();
|
||||
|
||||
#if !KERNEL_BREAKPOINTS
|
||||
if (!(thread->flags & THREAD_FLAGS_BREAKPOINTS_DEFINED))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// disable kernel breakpoints
|
||||
disable_breakpoints();
|
||||
|
||||
GRAB_THREAD_LOCK();
|
||||
GRAB_TEAM_DEBUG_INFO_LOCK(thread->team->debug_info);
|
||||
|
||||
arch_team_debug_info &teamInfo = thread->team->debug_info.arch_info;
|
||||
|
||||
// install the breakpoints
|
||||
// install the user breakpoints
|
||||
install_breakpoints(teamInfo);
|
||||
|
||||
atomic_or(&thread->flags, THREAD_FLAGS_BREAKPOINTS_INSTALLED);
|
||||
@@ -738,22 +739,19 @@ x86_exit_user_debug_at_kernel_entry()
|
||||
{
|
||||
struct thread *thread = thread_get_current_thread();
|
||||
|
||||
#if !KERNEL_BREAKPOINTS
|
||||
if (!(thread->flags & THREAD_FLAGS_BREAKPOINTS_INSTALLED))
|
||||
return;
|
||||
#endif
|
||||
|
||||
GRAB_THREAD_LOCK();
|
||||
|
||||
// disable breakpoints
|
||||
// disable user breakpoints
|
||||
disable_breakpoints();
|
||||
|
||||
#if KERNEL_BREAKPOINTS
|
||||
// install kernel breakpoints
|
||||
struct team* kernelTeam = team_get_kernel_team();
|
||||
GRAB_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info);
|
||||
install_breakpoints(kernelTeam->debug_info.arch_info);
|
||||
RELEASE_TEAM_DEBUG_INFO_LOCK(kernelTeam->debug_info);
|
||||
#endif
|
||||
|
||||
atomic_and(&thread->flags, ~THREAD_FLAGS_BREAKPOINTS_INSTALLED);
|
||||
|
||||
@@ -762,7 +760,7 @@ x86_exit_user_debug_at_kernel_entry()
|
||||
|
||||
|
||||
/**
|
||||
* Interrupts are disabled and will be enabled by the function.
|
||||
* Interrupts are disabled and will possibly be enabled by the function.
|
||||
*/
|
||||
void
|
||||
x86_handle_debug_exception(struct iframe *frame)
|
||||
@@ -839,7 +837,7 @@ x86_handle_debug_exception(struct iframe *frame)
|
||||
|
||||
|
||||
/**
|
||||
* Interrupts are disabled and will be enabled by the function.
|
||||
* Interrupts are disabled and will possibly be enabled by the function.
|
||||
*/
|
||||
void
|
||||
x86_handle_breakpoint_exception(struct iframe *frame)
|
||||
|
||||
Reference in New Issue
Block a user