Commit Graph

20 Commits

Author SHA1 Message Date
Ingo Weinhold 4ed8088f9a Added new debugger message B_DEBUGGER_MESSAGE_TEAM_EXEC, sent when
exec*() has been called.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27650 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-20 13:59:41 +00:00
Ingo Weinhold 78b13af677 The handling of a full profiling buffer couldn't work for two reasons:
* We can't enable interrupts in an interrupt handler. Instead we use the
  newly introduced callback feature, which notifies the debugger right
  before returning from the interrupt.
* We didn't indicate that the profiling buffer was full and that the
  thread shouldn't be profiled ATM. Therefore it could happen that it
  was profiled while trying to notify the debugger that the profiling
  buffer was full, resulting in a deadlock. Introduce a respective flag
  in the thread debug structure.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27649 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-20 12:44:41 +00:00
Ingo Weinhold 424f833bc9 * Changed the profiling API: Instead of sending all functions that shall
be tracked to the kernel, which then counts the hits, an area is
  passed to kernel in which the hits are recorded. When the area is
  full, the debugger is notified. For some reason that part doesn't work
  yet -- the whole system freezes when waiting for a reply.
* Reorganized the profile tool code a bit. For one with respect to the
  changed API, but also to prepare tracking of image creation/deletion.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27640 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-20 00:34:03 +00:00
Ingo Weinhold 127f6d39ef Decreased minimum profiling sampling interval to 100 us. At least in
VMware this doesn't produce very good results though. In my tests I only
got twice as many hits as with 1 ms, although it should be roughly ten
times as many. Might work better on real hardware.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27572 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-15 15:02:40 +00:00
Ingo Weinhold cbcebd3330 * Extended the debugger API by sampling-based profiling support. This is
still pretty much work in progress.
* Introduced init_thread_debug_info() which is used instead of
  clear_thread_debug_info() when the thread is created. The latter
  requires former initialization.
* user_debug_thread_deleted() is now already invoked in thread_exit(),
  not in the undertaker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27531 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-09-15 13:36:31 +00:00
Ingo Weinhold 34b3b26b3b Merged branch haiku/branches/developer/bonefish/optimization revision
23139 into trunk, with roughly the following changes (for details svn
log the branch):
* The int 99 syscall handler is now fully in assembly.
* Added a sysenter/sysexit handler and use it on Pentiums that support
  it (via commpage).
* Got rid of i386_handle_trap(). A bit of functionality was moved into
  the assembly handler which now uses a jump table to call C functions
  handling the respective interrupt.
* Some optimizations to get user debugger support code out of the
  interrupt handling path.
* Introduced a thread::flags fields which allows to skip handling of
  rare events (signals, user debug enabling/disabling) on the
  common interrupt handling path.
* Got rid of the explicit iframe stack. The iframes can still be
  retrieved by iterating through the stack frames.
* Made the commpage an architecture independent feature. It's used for
  the real time data stuff (instead of creating a separate area).
* The x86 CPU modules can now provide processor optimized versions for
  common functions (currently memcpy() only). They are used in the
  kernel and are provided to the userland via commpage entries.
* Introduced build system feature allowing easy use of C structure
  member offsets in assembly code.

Changes after merging:
* Fixed merge conflict in src/system/kernel/arch/x86/arch_debug.cpp
  (caused by refactoring and introduction of "call" debugger command).



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23370 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-01-11 00:36:44 +00:00
Ingo Weinhold 65a7804abe Set default team debug flags to 0. Threads of a team were
unnecessarily stopped, when another thread crashed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22119 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-30 01:10:46 +00:00
Ingo Weinhold 44b5d72b5a Added new functions to the debugger API:
{set,clear}_debugger_{break,watch}point(), allowing to set/clear break
and watchpoints for the calling team. When a break/watchpoint is hit,
the team enters the debugger. Handy in situations when the program in
question can't really be started in a debugger (or it would be
complicated to do so). The functions work only as long as no debugger is
installed for the team.

We clear the arch specific team and thread debug infos now, when a new
debugger is installed, thus clearing break- and watchpoints.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20396 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-03-20 16:20:13 +00:00
Ingo Weinhold 37a25a6ceb * Fail, if debug_thread() is invoked for the debug nub thread.
* To always be on the safe side, thread_hit_debug_event() now checks
  whether the thread is the debug nub thread.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14655 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-11-03 00:40:36 +00:00
Axel Dörfler 50374cbdca Changed the signal handling code so that handle_signals() can be called without
having the thread lock held and interrupts disabled.
Cleaned up the signal handling code, and fixed some minor bugs with blockable
vs. non-blockable signals.
thread_debug_info was using uint64 for signals sets instead of sigset_t.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14457 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-10-20 16:56:04 +00:00
Ingo Weinhold 3eae1fea40 * Added support for debugging through exec*().
* Added initialization function. Currently only need to init the
  single step hack for qemu.
* Fixed a deadlock when the nub thread destroyed the debug info. It was
  waiting for itself.
* Moved the filling in the origin info of the debug messages into
  thread_hit_debug_event_internal(). No need for code duplication.
* Writing to user memory can now be partial. We also change the area
  protection, if it wasn't writable. Necessary for setting software
  breakpoints.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11996 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-25 18:40:07 +00:00
Ingo Weinhold 823f4c5bf4 * Various modifications needed due to the changes in <debugger.h>.
* user_debug_break_or_watchpoint_hit() into separate functions for
  break- and watchpoints. The one for breakpoints gets another parameter
  which indicates whether the breakpoint was a soft- or hardware
  breakpoint. This info is also sent to the debugger.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11714 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-13 23:57:34 +00:00
Ingo Weinhold 293a59b0e9 * The debug_thread_info records now, which signals the debugger wishes
not to be notified.
* Added debugger commands for setting/getting of thread signal ignore
  masks and signal handlers.
* Renamed user_debug_fault_occurred() to a more correct
  user_debug_exception_occurred(). It no longer sends a `stopped' message,
  but the new one dedicated to exceptions. Additionally the number of the
  signal is supplied that will be sent, when the thread continues (without
  indicating to ignore the event).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11703 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-12 21:43:35 +00:00
Ingo Weinhold 2eece8633c * Added support for debugger handover.
* Implemented _user_wait_for_debugger().
* Reworked a few bits to ensure that after a remove_team_debugger() or
  after requesting a debugger handover the debugger doesn't get any more
  messages.
* When the debugger is removed or dies, the debugged threads should now
  cleanup their debug info and continue, instead of waiting at their
  debug port forever.
All the new features are not tested. Will happen, when gdb will be
debugged.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11664 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-10 22:04:27 +00:00
Ingo Weinhold 6bbfd2627b New syscall _kern_wait_for_debugger().
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11635 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-09 22:46:31 +00:00
Ingo Weinhold 2562e5185c Command B_DEBUG_MESSAGE_GET_WHY_STOPPED supports a reply port now.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11633 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-09 22:05:43 +00:00
Ingo Weinhold ae7c619aae * Added architecture specific structure to thread_debug_info.
* Added event callbacks for break- and watchpoints and single stepping.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11520 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-03-01 23:47:59 +00:00
Ingo Weinhold a7ad39fe09 * New locking strategy for the team debug info. It's no longer protected
by the team lock, but by a lock in the structure. This is necessary
  since we can't acquire the team lock while thread switching, for then the
  thread lock is already held.
* Added support for single stepping and break-/watchpoints.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11503 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-28 00:34:06 +00:00
Ingo Weinhold e988d66022 * Added B_TEAM_DEBUG_DEFAULT_FLAGS and B_THREAD_DEBUG_DEFAULT_FLAGS for
convenience.
* Added/implemented callbacks for almost all missing debug events (team,
  thread, image creation/deletion, exceptions/faults, signals).
* The debugger can now specify how to deal with the event that stopped an
  event (ignore or handle signals, exceptions/faults).
* Implemented B_DEBUGGED_THREAD_GET_WHY_STOPPED debugger message.
* The cpu_state is now passed to the debugger with
  B_DEBUGGER_MESSAGE_THREAD_STOPPED notifications.
* Completed _user_debugger() implementation.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11474 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-24 16:07:19 +00:00
Ingo Weinhold bc797a9ee5 The beginnings of userland debugger support. Currently basically only what is needed for strace is implemented.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11308 a95241bf-73f2-0310-859d-f6bbb57e9c96
2005-02-10 02:47:46 +00:00