History log of /haiku/src/system/kernel/debug/user_debugger.cpp
Revision Date Author Comments
# bfd3d337 29-May-2023 Trung Nguyen <trungnt282910@gmail.com>

strace: Print detailed signal information

- Add support for retrieving the `siginfo_t` structure of a signal
event from the Debugger API.
- Add code to `strace` to display this information every time a
signal event occurs, similar to the Linux `strace` tool.

Change-Id: If4e92bbae049ee0b52efaf9fc911d66511da62f4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6393
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 071f4aad 19-May-2022 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel/user_debugger: Show the thread name in addition to the id

* Helps in debugging early boot issues where you won't have
access to the list of thread id's

Change-Id: Ic06bd0b53ccceccd8c911156724a799ca6a1c28b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5322
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# afc04c50 17-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel/debug: Add initialization to appease -Wmaybe-uninitialized.


# 057fe191 01-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Break thread-related AutoLockers into a separate header.

Including thread.h brings a massive array of things with it from
the kernel thread arch headers, team and thread definitions,
hash tables, linked lists, Referenceable, etc. that the vast majority
of AutoLock.h consumers neither want nor need.

So, put these in a separate header, and adjust all consumers of these
lockers to include the new file.

This change exposes the fact that a lot of files were inadvertently
making use of headers included indirectly through thread.h. Those
will be fixed in the next commit.


# 2d85a564 27-Sep-2019 Kacper Kasper <kacperkasper@gmail.com>

Fix SMAP violation when running profile

* Fixes #15379.

Change-Id: I3d5672ec0ffd4c09a35535f641e433d3d714412a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1890
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 719cfad7 04-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Don't try to cast an integer to a pointer.

Should fix the x86_64 build.


# 24f7b647 04-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Initialize the condition variables.

Should (actually) fix #15223 and #15226. After things settle
down a bit, I'll refactor our ConditionVariable constructors
to detect this at compile time instead of creating obscure
KDLs...


# 5c97129c 07-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/team: Remove team_get_team_struct, add team_geteuid.

Thanks to Axel for the review.


# 6f0aa00c 04-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/user_debugger: Add missing permissions checks.

Part of #14961.


# ee0b0d6d 09-Dec-2018 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Fix typos in documentation.

Spotted by Clang (yes, there is a -Wdocumentation that understands
how to parse Doxygen comments!)


# 467fe4ca 24-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

kernel: Add core dump facility

* Add function core_dump_write_core_file(). It writes a core file for
the current thread's team. The file format is similar to that of
other OSs (i.e. ELF with PT_LOAD segments and a PT_NOTE segment), but
most of the notes are Haiku specific (infos for team, areas, images,
threads). More data will probably need to be added.
* Add team flag TEAM_FLAG_DUMP_CORE, thread flag
THREAD_FLAGS_TRAP_FOR_CORE_DUMP, and Team property coreDumpCondition,
a condition variable available while a core dump is progress. A
thread that finds its flag THREAD_FLAGS_TRAP_FOR_CORE_DUMP set before
exiting the kernel to userland calls core_dump_trap_thread(), which
blocks on the condition variable until the core dump has finished. We
need the team's threads to stop so we can get their CPU state (and
have a generally unchanging team state while writing the core file).
* Add user debugger message B_DEBUG_WRITE_CORE_FILE. It causes
core_dump_write_core_file() to be called for the team.
* Dumping core as an immediate effect of a terminal signal has not been
implemented yet, but that should be fairly straight forward.


# 7a187cd6 09-Apr-2016 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_debug_thread(): Use new signal SIGNAL_DEBUG_THREAD

This resolves a TODO: We used thread_interrupt() to wake up the thread
from an interruptable wait. However, if the thread was already in the
kernel and about to start waiting, that would have no effect and the
thread would wait anyway. Now there's the new non-blockable signal
SIGNAL_DEBUG_THREAD, which is sent to the thread instead, making sure
that thread doesn't start waiting.


# 27dec4bb 29-Jul-2015 Rene Gollent <rene@gollent.com>

user_debugger: Adjust handling of continue request.

- B_DEBUG_MESSAGE_CONTINUE_THREAD now checks if the thread in question
is in a suspended state rather than waiting on the debug nub port, and
if so, handles resuming it automatically. This allows the continue message
to be used on the main thread of a team that was freshly created under
debug control without the API user having to be cognizant of the distinction.


# 8f9d4cad 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

syscalls: Remove get_stack_trace syscall again.

This reverts the other half of b959d46dbd2f9087ae860dbced40440c28596a6e.


# b959d46d 10-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

syscalls: Add get_stack_trace and lookup_symbol syscalls.

The get_stack_trace syscall generates a stack trace using the kernel
debugging facilities and copies the resulting return address array to
the preallocated buffer from userland. It is only possible to get a
stack trace of the current thread.

The lookup_symbol syscall can be used to look up the symbol and image
name corresponding to an address. It can be used to resolve symbols
from a stack trace generated by the get_stack_trace syscall. Only
symbols of the current team can be looked up. Note that this uses
the symbol lookup of the kernel debugger which does not support lookup
of all symbols (static functions are missing for example).

This is meant to be used in situations where more elaborate stack trace
generation, like done in the userland debugging helpers, is not possible
due to constraints.


# e6ea745e 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# 03fb2d88 07-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove gSchedulerLock

* Thread::scheduler_lock protects thread state, priority, etc.
* sThreadCreationLock protects thread creation and removal and list of
threads in team.
* Team::signal_lock and Team::time_lock protect list of threads in team
as well.
* Scheduler uses its own internal locking.


# 8a190335 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented user debugging support for x86_64.

Reused x86 arch_user_debugger.cpp, with a few minor changes to make
the code work for both 32 and 64 bit. Something isn't quite working
right, if a breakpoint is hit the kernel will hang. Other than that
everything appears to work correctly.


# fd04f5cc 08-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix image deletion events.

- Due to (most likely) a copy/paste error, image deletion events were
mistakenly being sent to the userland debugger as creation events.


# 4be4fc6b 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 27a115f6 14-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Revert r39846 and r39847.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39849 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7040b50d 13-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Add support for thread rename and priority change notifications to the
debugger API/message set.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39846 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13b81a3b 30-Oct-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added new thread flag THREAD_FLAGS_SINGLE_STEP, which is set to indicate that
userland single-stepping is enabled for the thread.
* x86_exit_user_debug_at_kernel_entry(): Always store DR6 and DR7 in the CPU
structure, not only when breakpoints are installed.
* x86_handle_debug_exception(): When encountering a syscall single-step, also
set the THREAD_FLAGS_DEBUG_THREAD thread flag. Otherwise the
B_THREAD_DEBUG_STOP would be ignored.
* x86 interrupt handling, DISABLE_BREAKPOINTS():
- Renamed to STOP_USER_DEBUGGING().
- Now it also call x86_exit_user_debug_at_kernel_entry() when
THREAD_FLAGS_SINGLE_STEP is set, so that the debug registers are saved.

Fixes #6751.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39201 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee781704 30-Oct-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

update_thread_user_debug_flag(): Don't set the THREAD_FLAGS_DEBUG_THREAD thread
flag, when B_THREAD_DEBUG_SINGLE_STEP is set. Not sure, if there ever was a
reason to do that, but there isn't now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39200 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f33e728 06-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Handle sigaction[_etc]() return value correctly (it's not an error code).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36056 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8b3d3d8a 25-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Correctly handle cases when a thread single-steps into the kernel as it can
happen on syscalls or "int" instructions. The debug exception handler sets
the thread debug flags B_THREAD_DEBUG_STOP and
B_THREAD_DEBUG_NOTIFY_SINGLE_STEP (new) and lets the thread continue. Before
leaving the kernel the thread is stopped and a single-step notification is
sent. Fixes #3487.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35620 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5662ae45 20-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the team shutdown process a bit:
* The threads beside the main thread are killed earlier now (in the new
team_shutdown_team()), before removing the team from the team hash and from
its process group. This fixes #5296.
* Use a condition variable instead of a semaphore to wait for the non-main
threads to die. We notify the condition right after a thread has left the
team. The semaphore was released by the undertaker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a38f8503 22-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* arch_debug_get_stack_trace():
- Replaced the "userOnly" parameter by a "flags" parameter, that allows to
specify kernel and userland stack traces individually.
- x86, m68k: Don't always skip the first frame as that prevents the caller
from being able to record its own address.
* capture_tracing_stack_trace(): Replaced the "userOnly" parameter by
"kernelOnly", since one is probably always interested in the kernel stack
trace, but might not want the userland stack trace.
* Added stack trace support for VM cache kernel tracing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34742 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0338371f 13-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* All scheduler implementations:
- enqueue_in_run_queue() no longer returns whether rescheduling is supposed
to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU.
- reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need
to let all callers do that.
* thread_unblock[_locked]() no longer return whether rescheduling is supposed
to happen.
* Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really
can't know, when it makes sense to reschedule or not.
* Introduced scheduler_reschedule_if_necessary[_locked]() functions for
checking+invoking the scheduler.
* Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if
they wake up anything with greater priority.
I've also tried to add scheduler invocations in the condition variable and
mutex/rw_lock code, but that actually has a negative impact on performance,
probably because it causes too much ping-ponging between threads when
multiple locking primitives are involved.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e50cf876 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd56fd8a 23-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed the superfluous handOverPort variable I introduced earlier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33748 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c056f9f 22-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* set_port_owner() was the only usable call of the port API, and of course it
was used this way in the debugger. Doing this later should be harmless,
AFAICT, but Ingo will probably know better.
* Beware, though, the debugger currently does not work anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33730 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0b11ecb1 21-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Always include the public arch_debugger.h headers. The structures defined
there are prefixed with the respective architecture name. Useful for remote
debugging a different architecture.
* <x86/arch_debugger.h>: Introduced a structure for the FPU state, so that it
isn't left to the debugger.
* Removed the _kern_get_thread_cpu_state() syscall. Was originally intended for
bdb compatiblity, but isn't really needed.
* Kernel x86 arch_get_debug_cpu_state(): The use of fnsave was broken, since
it reinits the FPU after saving the state. This resulted in weird results
when debugging functions using the FPU. We now use fxsave, if available.
Otherwise fnsave + frstor should be used -- not fully implemented yet.
Same for arch_set_debug_cpu_state().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecece29d 15-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

thread_hit_serious_debug_event(): Incorrect return value. Fixes #4098.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31584 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6a1f462e 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* arch_debug_get_interrupt_pc() does now optionally return whether the iframe
is a syscall iframe.
* User debugger support: Don't to call BreakpointManager::PrepareToContinue(),
if the thread returns from a syscall. We don't want to skip breakpoints in
that case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31223 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0f12d64 23-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added transparent software breakpoint support for user debuggers:
* The bulk of the work -- i.e. juggling the software and hardware breakpoints,
watchpoints, and memory reads/writes -- is done in the new class
BreakpointManager.
* For the architectures a few capability macros have to be defined, one
pointing to the software breakpoint instruction opcode. Done for x86.
* Some more simplifications in the user debugger code, made possible by the
recently introduced debugger_changed_condition attribute.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31214 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ba391bcc 22-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added team_debug_info::debugger_changed_condition to serialize changes to the
installed team debugger and adjusted the code accordingly. It's not needed yet,
but I intend to add support for software breakpoints and those require a bit of
uninitialization that needs to be synchronized with debugger changes and can't
be done with interrupts disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31194 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6dcc2a7e 22-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Made destroy_team_debug_info() static, as it's not used outside the source
file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31190 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bbe9c7b1 16-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Rewrote user_debug_thread_deleted():
* It was broken since the support for debugger handovers. Using
debugger_write() couldn't work, since the thread didn't belong to the
debugged team anymore (but to the kernel) and thus getting the debug info
for team would always fail. This makes B_DEBUGGER_MESSAGE_THREAD_DELETED
notifications work again.
* Allow the thread to block. Locking/writing to the port was non-blocking
before, but there shouldn't be a problem, if the thread has to wait.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 995aa3f0 16-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

broadcast_debugged_thread_message(): Only send the message to threads that are
stopped. Besides that the message won't be interesting to the other threads
anyway, we also risk filling the port and blocking the nub thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31075 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e4b912a7 16-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed comments and removed superfluous code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31074 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 568ade58 13-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

User debugger support:
* Generalized address checks. The debugger can now also read the commpage.
* Added new syscall _kern_get_thread_cpu_state() to get the CPU state of a
not running thread. Introduced arch_get_thread_debug_cpu_state() for that
purpose, which is only implemented for x86 ATM (uses the new
i386_get_thread_user_iframe()).
* Don't allow a debugger to change a thread's "esp" anymore. That's the esp
register in the kernel. "user_esp" can still be changed.
* Generally set RF (resume flag) in eflags in interrupt handlers, not only
after a instruction breakpoint debug exception. This should prevent
breakpoints from being triggered more than once (e.g. when the breakpoint is
on an instruction that can cause a page fault). I still saw those with bdb
in VMware, but that might be a VMware bug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31045 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e1975d33 23-Feb-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* When a team debugger is installed automatically, the thread causing that is
stored now.
* Extended the debugger message for B_DEBUGGER_MESSAGE_HANDED_OVER by the
causing thread.
* Also send B_DEBUGGER_MESSAGE_HANDED_OVER to the debugger to which the team
was handed over. The message will be the very first one the debugger gets
from the team in question.
* Some harmless refactoring (added thread_hit_serious_debug_event()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29302 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f965a969 28-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Extended the profiling API. When using the variable stack trace depth
buffer format, the buffer can now also contain other events than just
stack traces. ATM these are only references to the image events
(created/deleted). Therefore we no longer have to flush the profiling
buffer after such an event, since the debugger can exactly match the
samples. Since we couldn't flush when the profiling timer hit while the
thread was in the kernel, that wasn't working that well anyway.
"profile -f" fails to translate stack trace addresses only very rarely,
now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27775 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a6d671fc 23-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

The variable_stack_depth field in the profiler update message was not
set correctly. Could cause "profile" to crash.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27716 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5181b35b 23-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduced a separate flag for indicating that disable_debugger() had
been called for a team, and fail installing the default debugger if it
is set. This makes disable_debugger() actually work. Fixes bug #2763.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27713 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0135e2e3 22-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Increased the maximum profiling caller stack depth significantly.
* Extended the profiling API by an option to record a variable number of
samples per tick. The stack depth is used as a maximum.
* Added new option "-f" to the "profile" tool. When specified it
increments the hit counts of all symbols in the full available caller
stack. I.e. the resulting hit counts will approximate the total time
spent in each function or any function directly or indirectly called
by it. Thus "_start" and "main" will usually get 100% and leaf
functions only what time has actually been spent in them.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7326b92c 21-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

user_debug_update_new_thread_flags() was setting some of the thread
flags on the wrong thread (the current one instead of the newly created
one). This would cause the thread not to be debugged as it should, e.g.
profiling wouldn't work correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecfad924 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Solution for the potential deadlock when needing to flush the profiling
buffer during a timer event that interrupted a kernel function: We do
now flush the buffer as soon as it is 70% full, *if* we didn't interrupt
a kernel function. When the buffer runs full and we still haven't hit a
user function, we drop the tick. The number of dropped ticks is recorded
and sent to the debugger with the next update message.
Reverted the previous partial solution (the temporary disabling of
profiling while in debugger support code).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27658 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eba9a4c3 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a per-team counter that is incremented whenever an image
is created or deleted (or exec*() has been invoked). The counter is
sent with several debugger messages.
* Track the image event counter that is used when samples are added to
the profiling buffer. If the current team counter differs, we flush
the buffer first (sending an update message to the debugger), so that
the debugger has a chance to match the addresses to the correct images.
* Disable profiling for a thread while it runs in the debugger support
code. This fixes potential deadlocks which could occur when a
profiling timer event occurred that would require the buffer to be
flushed while the thread was just sending something to the debugger or
waiting for a command. As it turns out, this is not sufficient either,
since we should never try to flush the buffer when the timer event
occurred in the kernel, since the thread might hold a lock that the
debugger thread could try to acquire. Will implement a more general
solution later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4ed8088f 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 78b13af6 19-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 424f833b 19-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 4eba6974 17-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

When quitting the debug nub thread very early (i.e. right after its
creation), we didn't release the team debug info spinlock and reenabled
interrupts.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27602 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cbcebd33 15-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 15374c5d 02-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed thread_spinlock and team_spinlock to gThreadSpinlock and
gTeamSpinlock.
* Renamed the static global variables in smp.c to match our style guide.
* Minor other cleanup.
* Removed superfluous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26730 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8f9741c 04-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Removed -Wno-unused from all KernelMergeObjects in kernel Jamfiles.
* Fixed most of the warnings resulting from that by removing actually not used
variables or moving declaration into the #IF. Left unused functions there
though, as I wouldn't know if they are supposed to be used again.
* Fixed two statements with no effect (clamping to MAX_ANCILLARY_DATA_LEN in
socket.cpp and unsetting fCounterSem in MessagingService.cpp).
* Some style cleanups.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1c8de858 01-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added optional spinlock contention measurement feature. Enabled when
B_DEBUG_SPINLOCK_CONTENTION is defined to 1. It typedefs spinlock to a
structure (thus breaking BeOS binary compatibility), containing a
counter which is incremented whenever a thread has to wait for the
spinlock.
* Added macros for spinlock initialization and access and changed
code using spinlocks accordingly. This breaks compilation for BeOS --
the macros should be defined in the respective compatibility wrappers.
* Added generic syscall to get the spinlock counters for the thread and
the team spinlocks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25752 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b95f6d47 22-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a set of functions (thread_prepare_to_block(),
thread_block(), thread_unblock(),...) that allow a thread to wait for
something without needing a semaphore or condition variable. It can
simply block and another thread can unblock it. Supports timeouts and
interrupting. Both semaphores and condition variables use this
common mechanism, now.
* Semaphores:
- Some simplifications due to the thread blocking mechanism.
- Changed locking order to sem -> thread. It was the other way around
before and when introducing the wait_for_objects() support I had
also introduced a situation where the locking was reverse, which
could potentially cause a dead lock on SMP systems.
- Instead of queueing thread structures, a semaphore queues
queued_thread entries now, which are created on the stack. The
thread::sem structure could thus be removed.
- Added sem_entry::net_count, which is sem_entry::count plus the
acquisition count of all waiting threads. This number is needed in
remove_thread_from_sem() and instead of computing it there we
maintain it.
- Fixed remove_thread_from_sem(). It would not unblock threads, if
the sem count was <= 0.
- Made sem::last_acquirer unconditional. It is actually needed for
sem_info::latest_holder. Fixed fill_sem_info() accordingly.
- Added some optional tracing output, though only via ktrace_printf().
* Condition variables:
- Could be simplified significantly through the use of the thread
blocking mechanism. Removed a good deal of unnecessary code.
- Moved the ConditionVariableEntry "flags" parameter from Wait() to
Add(), and adjusted all places where condition variables are used
accordingly.
* snooze() uses thread_block_with_timeout() instead of a semaphore.
* Simplified thread interrupting in the signal and user debugger code.
Instead of separate functions for threads waiting on a semaphore or
condititon variable, we only have a single thread_interrupt(), now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25099 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6761f5a6 25-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Move the handling of still running threads into scheduler_enqueue_in_run_queue().
This should be in line with all uses of scheduler_enqueue_in_run_queue() and
simplifies a few places where it is used.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23738 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 34b3b26b 10-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# e7555d34 29-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Also interrupt condition variables in _user_debug_thread().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22120 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 44b5d72b 20-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# e68c6184 28-Feb-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

user_debug_exception_occurred() now checks whether a non-default signal
action has been set for the signal. If so, it doesn't try to install a
debugger, but simply lets the caller deliver the signal.
Fixes bug #237 (VLC entering the debugger when checking for processor
extensions).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16556 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c7229dd 07-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed some GCC4 only warnings

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 37a25a6c 02-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 6cd505ce 25-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Changed the boot procedure a bit.
Extracted scheduler_init() from start_scheduler() (which is now called scheduler_start()).
Moved scheduler related function prototypes from thread.h to the new scheduler.h.
Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14518 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3bdf71e 16-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

The debug nub port of a debugged team is owned by the debugger. Hence we
need to transfer the ownership, when handing over the team to another
debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13696 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f9c6739 14-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a new debugger message B_DEBUGGER_MESSAGE_HANDED_OVER, which
is sent to a debugger when the debugged team has been successfully handed
over to another debugger.
* Fixed handling of B_DEBUG_MESSAGE_PREPARE_HANDOVER. We don't send a reply.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13683 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 07b6630b 28-Jun-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Made reading and writing memory overflow safe.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13306 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 047ab3f9 27-Jun-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Be on the safe side when checking the size of data to be written to an area (overflow).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13299 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2d690920 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed system/core to system/kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12360 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 27dec4bb1e8eb4cf067a33d278757bf66c204f1d 29-Jul-2015 Rene Gollent <rene@gollent.com>

user_debugger: Adjust handling of continue request.

- B_DEBUG_MESSAGE_CONTINUE_THREAD now checks if the thread in question
is in a suspended state rather than waiting on the debug nub port, and
if so, handles resuming it automatically. This allows the continue message
to be used on the main thread of a team that was freshly created under
debug control without the API user having to be cognizant of the distinction.


# 8f9d4cad459baf5e64271aeb92f451c5aba270a5 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

syscalls: Remove get_stack_trace syscall again.

This reverts the other half of b959d46dbd2f9087ae860dbced40440c28596a6e.


# b959d46dbd2f9087ae860dbced40440c28596a6e 10-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

syscalls: Add get_stack_trace and lookup_symbol syscalls.

The get_stack_trace syscall generates a stack trace using the kernel
debugging facilities and copies the resulting return address array to
the preallocated buffer from userland. It is only possible to get a
stack trace of the current thread.

The lookup_symbol syscall can be used to look up the symbol and image
name corresponding to an address. It can be used to resolve symbols
from a stack trace generated by the get_stack_trace syscall. Only
symbols of the current team can be looked up. Note that this uses
the symbol lookup of the kernel debugger which does not support lookup
of all symbols (static functions are missing for example).

This is meant to be used in situations where more elaborate stack trace
generation, like done in the userland debugging helpers, is not possible
due to constraints.


# e6ea745e8114d5fa05ab0ccab92c070e2dcdcfb7 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# 03fb2d886830e4dd4b344c56725db59f96733216 07-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Remove gSchedulerLock

* Thread::scheduler_lock protects thread state, priority, etc.
* sThreadCreationLock protects thread creation and removal and list of
threads in team.
* Team::signal_lock and Team::time_lock protect list of threads in team
as well.
* Scheduler uses its own internal locking.


# 8a1903353eedd95266c7241aada3a314c5d35a55 07-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented user debugging support for x86_64.

Reused x86 arch_user_debugger.cpp, with a few minor changes to make
the code work for both 32 and 64 bit. Something isn't quite working
right, if a breakpoint is hit the kernel will hang. Other than that
everything appears to work correctly.


# fd04f5cc265e20901cad75b29ca22b211f13ff8b 08-Jul-2012 Rene Gollent <anevilyak@gmail.com>

Fix image deletion events.

- Due to (most likely) a copy/paste error, image deletion events were
mistakenly being sent to the userland debugger as creation events.


# 4be4fc6b1faddbd037146214a0011d320842b4f3 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 27a115f6685cc7821dd2ab6d528d6f3abe70158d 14-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Revert r39846 and r39847.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39849 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7040b50df5e1483f3e982d5b7ef7c7f79a898b93 13-Dec-2010 Rene Gollent <anevilyak@gmail.com>

Add support for thread rename and priority change notifications to the
debugger API/message set.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39846 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13b81a3b8eed9750171419427cf6be4a8822c25c 30-Oct-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added new thread flag THREAD_FLAGS_SINGLE_STEP, which is set to indicate that
userland single-stepping is enabled for the thread.
* x86_exit_user_debug_at_kernel_entry(): Always store DR6 and DR7 in the CPU
structure, not only when breakpoints are installed.
* x86_handle_debug_exception(): When encountering a syscall single-step, also
set the THREAD_FLAGS_DEBUG_THREAD thread flag. Otherwise the
B_THREAD_DEBUG_STOP would be ignored.
* x86 interrupt handling, DISABLE_BREAKPOINTS():
- Renamed to STOP_USER_DEBUGGING().
- Now it also call x86_exit_user_debug_at_kernel_entry() when
THREAD_FLAGS_SINGLE_STEP is set, so that the debug registers are saved.

Fixes #6751.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39201 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ee7817042b9ef97443db5ec5652bf8e6f6dd15b1 30-Oct-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

update_thread_user_debug_flag(): Don't set the THREAD_FLAGS_DEBUG_THREAD thread
flag, when B_THREAD_DEBUG_SINGLE_STEP is set. Not sure, if there ever was a
reason to do that, but there isn't now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39200 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6f33e7286f0f1e9c8af24913cd1e00dce6223d72 06-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Handle sigaction[_etc]() return value correctly (it's not an error code).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36056 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8b3d3d8a1574eed1d59d052651fefa9af6b1fa6d 25-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Correctly handle cases when a thread single-steps into the kernel as it can
happen on syscalls or "int" instructions. The debug exception handler sets
the thread debug flags B_THREAD_DEBUG_STOP and
B_THREAD_DEBUG_NOTIFY_SINGLE_STEP (new) and lets the thread continue. Before
leaving the kernel the thread is stopped and a single-step notification is
sent. Fixes #3487.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35620 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5662ae45852e028a196015a0309d04a46ad657f3 20-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Changed the team shutdown process a bit:
* The threads beside the main thread are killed earlier now (in the new
team_shutdown_team()), before removing the team from the team hash and from
its process group. This fixes #5296.
* Use a condition variable instead of a semaphore to wait for the non-main
threads to die. We notify the condition right after a thread has left the
team. The semaphore was released by the undertaker.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a38f85036021b7ccaffa47fd8584afff473acf3d 22-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* arch_debug_get_stack_trace():
- Replaced the "userOnly" parameter by a "flags" parameter, that allows to
specify kernel and userland stack traces individually.
- x86, m68k: Don't always skip the first frame as that prevents the caller
from being able to record its own address.
* capture_tracing_stack_trace(): Replaced the "userOnly" parameter by
"kernelOnly", since one is probably always interested in the kernel stack
trace, but might not want the userland stack trace.
* Added stack trace support for VM cache kernel tracing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34742 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0338371f26864c2a248b1ea53b9fe78c884af7f2 13-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* All scheduler implementations:
- enqueue_in_run_queue() no longer returns whether rescheduling is supposed
to happen. Instead is sets cpu_ent::invoke_scheduler on the current CPU.
- reschedule() does now handle cpu_ent::invoke_scheduler_if_idle(). No need
to let all callers do that.
* thread_unblock[_locked]() no longer return whether rescheduling is supposed
to happen.
* Got rid of the B_INVOKE_SCHEDULER handling. The interrupt hooks really
can't know, when it makes sense to reschedule or not.
* Introduced scheduler_reschedule_if_necessary[_locked]() functions for
checking+invoking the scheduler.
* Some semaphore functions (e.g. delete_sem()) invoke the scheduler now, if
they wake up anything with greater priority.
I've also tried to add scheduler invocations in the condition variable and
mutex/rw_lock code, but that actually has a negative impact on performance,
probably because it causes too much ping-ponging between threads when
multiple locking primitives are involved.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34657 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e50cf8765be50a7454c9488db38b638cf90805af 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd56fd8a4c741b9cb77f0168abdc9a347ad61ed2 23-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Removed the superfluous handOverPort variable I introduced earlier.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33748 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5c056f9f10a01a9349678a7da4377118d3bb5c44 22-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* set_port_owner() was the only usable call of the port API, and of course it
was used this way in the debugger. Doing this later should be harmless,
AFAICT, but Ingo will probably know better.
* Beware, though, the debugger currently does not work anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33730 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0b11ecb18c9afe14114fac959f698a2bfa5b7230 21-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Always include the public arch_debugger.h headers. The structures defined
there are prefixed with the respective architecture name. Useful for remote
debugging a different architecture.
* <x86/arch_debugger.h>: Introduced a structure for the FPU state, so that it
isn't left to the debugger.
* Removed the _kern_get_thread_cpu_state() syscall. Was originally intended for
bdb compatiblity, but isn't really needed.
* Kernel x86 arch_get_debug_cpu_state(): The use of fnsave was broken, since
it reinits the FPU after saving the state. This resulted in weird results
when debugging functions using the FPU. We now use fxsave, if available.
Otherwise fnsave + frstor should be used -- not fully implemented yet.
Same for arch_set_debug_cpu_state().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31682 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecece29dd8688f2c91f2f15ae718963f59b375b0 15-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

thread_hit_serious_debug_event(): Incorrect return value. Fixes #4098.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31584 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6a1f462e722992471836c74232c6eb8c8125751b 24-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* arch_debug_get_interrupt_pc() does now optionally return whether the iframe
is a syscall iframe.
* User debugger support: Don't to call BreakpointManager::PrepareToContinue(),
if the thread returns from a syscall. We don't want to skip breakpoints in
that case.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31223 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0f12d64f42dc8f5bbabf4cbcdf25178b3eb3749 23-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added transparent software breakpoint support for user debuggers:
* The bulk of the work -- i.e. juggling the software and hardware breakpoints,
watchpoints, and memory reads/writes -- is done in the new class
BreakpointManager.
* For the architectures a few capability macros have to be defined, one
pointing to the software breakpoint instruction opcode. Done for x86.
* Some more simplifications in the user debugger code, made possible by the
recently introduced debugger_changed_condition attribute.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31214 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ba391bcc56771ed5e881a4478d3c6a7273a29f1c 22-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added team_debug_info::debugger_changed_condition to serialize changes to the
installed team debugger and adjusted the code accordingly. It's not needed yet,
but I intend to add support for software breakpoints and those require a bit of
uninitialization that needs to be synchronized with debugger changes and can't
be done with interrupts disabled.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31194 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6dcc2a7e00e5e1ae23d3c99b962e61e99a49dfce 22-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Made destroy_team_debug_info() static, as it's not used outside the source
file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31190 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bbe9c7b15eea3db937ae74dfcfa0cd04bb3fe470 16-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Rewrote user_debug_thread_deleted():
* It was broken since the support for debugger handovers. Using
debugger_write() couldn't work, since the thread didn't belong to the
debugged team anymore (but to the kernel) and thus getting the debug info
for team would always fail. This makes B_DEBUGGER_MESSAGE_THREAD_DELETED
notifications work again.
* Allow the thread to block. Locking/writing to the port was non-blocking
before, but there shouldn't be a problem, if the thread has to wait.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31076 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 995aa3f06a7242685b1e31f467fc573b00d4b475 16-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

broadcast_debugged_thread_message(): Only send the message to threads that are
stopped. Besides that the message won't be interesting to the other threads
anyway, we also risk filling the port and blocking the nub thread.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31075 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e4b912a7f4c64c369d0fd7561f579b0ea233534b 16-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed comments and removed superfluous code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31074 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 568ade58d054e27ce4cd9da0d4e73ecb79563b96 13-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

User debugger support:
* Generalized address checks. The debugger can now also read the commpage.
* Added new syscall _kern_get_thread_cpu_state() to get the CPU state of a
not running thread. Introduced arch_get_thread_debug_cpu_state() for that
purpose, which is only implemented for x86 ATM (uses the new
i386_get_thread_user_iframe()).
* Don't allow a debugger to change a thread's "esp" anymore. That's the esp
register in the kernel. "user_esp" can still be changed.
* Generally set RF (resume flag) in eflags in interrupt handlers, not only
after a instruction breakpoint debug exception. This should prevent
breakpoints from being triggered more than once (e.g. when the breakpoint is
on an instruction that can cause a page fault). I still saw those with bdb
in VMware, but that might be a VMware bug.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31045 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e1975d335369d3bec6473cc1323c65a00e8dc25c 23-Feb-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* When a team debugger is installed automatically, the thread causing that is
stored now.
* Extended the debugger message for B_DEBUGGER_MESSAGE_HANDED_OVER by the
causing thread.
* Also send B_DEBUGGER_MESSAGE_HANDED_OVER to the debugger to which the team
was handed over. The message will be the very first one the debugger gets
from the team in question.
* Some harmless refactoring (added thread_hit_serious_debug_event()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29302 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f965a969b17376e47d9d2948ba4a5cfce2a785d0 28-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Extended the profiling API. When using the variable stack trace depth
buffer format, the buffer can now also contain other events than just
stack traces. ATM these are only references to the image events
(created/deleted). Therefore we no longer have to flush the profiling
buffer after such an event, since the debugger can exactly match the
samples. Since we couldn't flush when the profiling timer hit while the
thread was in the kernel, that wasn't working that well anyway.
"profile -f" fails to translate stack trace addresses only very rarely,
now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27775 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a6d671fc8e78d055a33f98a16b04181b79f5da67 23-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

The variable_stack_depth field in the profiler update message was not
set correctly. Could cause "profile" to crash.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27716 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5181b35beebed8380025b8de02756bb0137f9721 23-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduced a separate flag for indicating that disable_debugger() had
been called for a team, and fail installing the default debugger if it
is set. This makes disable_debugger() actually work. Fixes bug #2763.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27713 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0135e2e3242021dd407037b1974bb7e221d5255b 22-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Increased the maximum profiling caller stack depth significantly.
* Extended the profiling API by an option to record a variable number of
samples per tick. The stack depth is used as a maximum.
* Added new option "-f" to the "profile" tool. When specified it
increments the hit counts of all symbols in the full available caller
stack. I.e. the resulting hit counts will approximate the total time
spent in each function or any function directly or indirectly called
by it. Thus "_start" and "main" will usually get 100% and leaf
functions only what time has actually been spent in them.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27699 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7326b92ce0a0f2a0229d73eba223f68271d96bdd 21-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

user_debug_update_new_thread_flags() was setting some of the thread
flags on the wrong thread (the current one instead of the newly created
one). This would cause the thread not to be debugged as it should, e.g.
profiling wouldn't work correctly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27671 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ecfad924e044a187d0ac9fc4561b45b285e7f8c5 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Solution for the potential deadlock when needing to flush the profiling
buffer during a timer event that interrupted a kernel function: We do
now flush the buffer as soon as it is 70% full, *if* we didn't interrupt
a kernel function. When the buffer runs full and we still haven't hit a
user function, we drop the tick. The number of dropped ticks is recorded
and sent to the debugger with the next update message.
Reverted the previous partial solution (the temporary disabling of
profiling while in debugger support code).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27658 a95241bf-73f2-0310-859d-f6bbb57e9c96


# eba9a4c3ee6e7cb89df681a845fb1eaf581fe38e 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a per-team counter that is incremented whenever an image
is created or deleted (or exec*() has been invoked). The counter is
sent with several debugger messages.
* Track the image event counter that is used when samples are added to
the profiling buffer. If the current team counter differs, we flush
the buffer first (sending an update message to the debugger), so that
the debugger has a chance to match the addresses to the correct images.
* Disable profiling for a thread while it runs in the debugger support
code. This fixes potential deadlocks which could occur when a
profiling timer event occurred that would require the buffer to be
flushed while the thread was just sending something to the debugger or
waiting for a command. As it turns out, this is not sufficient either,
since we should never try to flush the buffer when the timer event
occurred in the kernel, since the thread might hold a lock that the
debugger thread could try to acquire. Will implement a more general
solution later.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4ed8088f9a98fa69526c08721087a942becc7545 20-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 78b13af677aac2046c677efbcd454ab91a59e5b5 19-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# 424f833bc9646c8d5a317485c96f4371fa3a7636 19-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 4eba6974b5585b8ce8a66fa4dfbec35c759d17c5 17-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

When quitting the debug nub thread very early (i.e. right after its
creation), we didn't release the team debug info spinlock and reenabled
interrupts.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27602 a95241bf-73f2-0310-859d-f6bbb57e9c96


# cbcebd3330d8701dd854e5958a28bf7e1af50df4 15-Sep-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 15374c5dbdb2c6b700bb2191887cadad7ef9eb73 02-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed thread_spinlock and team_spinlock to gThreadSpinlock and
gTeamSpinlock.
* Renamed the static global variables in smp.c to match our style guide.
* Minor other cleanup.
* Removed superfluous white space.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26730 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8f9741c8c2815234e87b78167738057b976b537 04-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Removed -Wno-unused from all KernelMergeObjects in kernel Jamfiles.
* Fixed most of the warnings resulting from that by removing actually not used
variables or moving declaration into the #IF. Left unused functions there
though, as I wouldn't know if they are supposed to be used again.
* Fixed two statements with no effect (clamping to MAX_ANCILLARY_DATA_LEN in
socket.cpp and unsetting fCounterSem in MessagingService.cpp).
* Some style cleanups.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26253 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1c8de8581b66c14ea94bccd7ddcea99291955796 01-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added optional spinlock contention measurement feature. Enabled when
B_DEBUG_SPINLOCK_CONTENTION is defined to 1. It typedefs spinlock to a
structure (thus breaking BeOS binary compatibility), containing a
counter which is incremented whenever a thread has to wait for the
spinlock.
* Added macros for spinlock initialization and access and changed
code using spinlocks accordingly. This breaks compilation for BeOS --
the macros should be defined in the respective compatibility wrappers.
* Added generic syscall to get the spinlock counters for the thread and
the team spinlocks.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25752 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b95f6d4710855a27bec41b6fae2b064347780173 22-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a set of functions (thread_prepare_to_block(),
thread_block(), thread_unblock(),...) that allow a thread to wait for
something without needing a semaphore or condition variable. It can
simply block and another thread can unblock it. Supports timeouts and
interrupting. Both semaphores and condition variables use this
common mechanism, now.
* Semaphores:
- Some simplifications due to the thread blocking mechanism.
- Changed locking order to sem -> thread. It was the other way around
before and when introducing the wait_for_objects() support I had
also introduced a situation where the locking was reverse, which
could potentially cause a dead lock on SMP systems.
- Instead of queueing thread structures, a semaphore queues
queued_thread entries now, which are created on the stack. The
thread::sem structure could thus be removed.
- Added sem_entry::net_count, which is sem_entry::count plus the
acquisition count of all waiting threads. This number is needed in
remove_thread_from_sem() and instead of computing it there we
maintain it.
- Fixed remove_thread_from_sem(). It would not unblock threads, if
the sem count was <= 0.
- Made sem::last_acquirer unconditional. It is actually needed for
sem_info::latest_holder. Fixed fill_sem_info() accordingly.
- Added some optional tracing output, though only via ktrace_printf().
* Condition variables:
- Could be simplified significantly through the use of the thread
blocking mechanism. Removed a good deal of unnecessary code.
- Moved the ConditionVariableEntry "flags" parameter from Wait() to
Add(), and adjusted all places where condition variables are used
accordingly.
* snooze() uses thread_block_with_timeout() instead of a semaphore.
* Simplified thread interrupting in the signal and user debugger code.
Instead of separate functions for threads waiting on a semaphore or
condititon variable, we only have a single thread_interrupt(), now.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25099 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6761f5a660bcba247e0967e09ac58f2f4488bd55 25-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Move the handling of still running threads into scheduler_enqueue_in_run_queue().
This should be in line with all uses of scheduler_enqueue_in_run_queue() and
simplifies a few places where it is used.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23738 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 34b3b26b3b8c46ba46ddde037b10dd173f4936d6 10-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# e7555d345caa2cbbcf2714568b435c7f77422e51 29-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Also interrupt condition variables in _user_debug_thread().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22120 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 44b5d72b5aeb8bba2c348c27022e7cfe1c96f456 20-Mar-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

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


# e68c6184ca33c6c6eb50887b3107b1409f884a9b 28-Feb-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

user_debug_exception_occurred() now checks whether a non-default signal
action has been set for the signal. If so, it doesn't try to install a
debugger, but simply lets the caller deliver the signal.
Fixes bug #237 (VLC entering the debugger when checking for processor
extensions).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16556 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8c7229ddbec08e62a544d0645a17af4308b82c0c 07-Jan-2006 Axel Dörfler <axeld@pinc-software.de>

Fixed some GCC4 only warnings

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15865 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 37a25a6ceb750024cbc7ba8241099c2efcc9050c 02-Nov-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* 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


# 6cd505cee71447d8c4829e79c2fee9c6d92badc7 25-Oct-2005 Axel Dörfler <axeld@pinc-software.de>

Changed the boot procedure a bit.
Extracted scheduler_init() from start_scheduler() (which is now called scheduler_start()).
Moved scheduler related function prototypes from thread.h to the new scheduler.h.
Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14518 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d3bdf71ea628df3acce7ca919e66161bb0492157 16-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

The debug nub port of a debugged team is owned by the debugger. Hence we
need to transfer the ownership, when handing over the team to another
debugger.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13696 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f9c6739815508d8473701fc51add7550c816d1d 14-Jul-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced a new debugger message B_DEBUGGER_MESSAGE_HANDED_OVER, which
is sent to a debugger when the debugged team has been successfully handed
over to another debugger.
* Fixed handling of B_DEBUG_MESSAGE_PREPARE_HANDOVER. We don't send a reply.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13683 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 07b6630b860adb9d975b77d60037b515429f262b 28-Jun-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Made reading and writing memory overflow safe.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13306 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 047ab3f95526cc4f12d416278c3ac9c12f721416 27-Jun-2005 Ingo Weinhold <ingo_weinhold@gmx.de>

Be on the safe side when checking the size of data to be written to an area (overflow).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13299 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2d690920ac4d0cd27eb3c118fb2b0862615869e0 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed system/core to system/kernel.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12360 a95241bf-73f2-0310-859d-f6bbb57e9c96