History log of /haiku/src/system/kernel/debug/debug.cpp
Revision Date Author Comments
# d0c34f93 23-Sep-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel/debug: Invoke cpu_pause in trap_cpu_in_kdl.

This is the loop that runs on all CPUs besides the one
actually running the kernel debugger. It's functionally
a spin-loop around a few different variables, and so it
should be safe to use cpu_pause() here, just as real
spinlocks do.

(cpu_pause() just runs a "pause" or equivalent instruction,
it doesn't use the CPU-idle modules, which indeed may be
unsafe to use in KDL.)

A glance at FreeBSD seems to indicate they also do this
when their kernel debugger is active.

Seriously improves power consumption while KDL is active:
even running in a VM with only a few cores, there would be
obvious fan spin-up when entering KDL. After this change,
there's barely any at all (while overall CPU usage % remains
basically identical.)


# f65d24df 12-Jan-2023 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel/debug: Fix newlines on serial output

* kputs uses the string printing functions per arch
which includes logic to detect \ n and add a \ r before it on
serial devices.
* kputchar uses the individual character printing arch code
which doesn't include this check. This results in a floating
prompt on serial kernel debugger sessions:
kdebug>
kdebug> help
Prints a command...
* Since kputchar is lower level and most would expect it to print
"a single untampered character", just convert these newline calls
to use kputs which includes the \ r check serial devices use.

Change-Id: I8389899e7670859597aeddbb6f58e9b7f7942230
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5992
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 580f28da 11-May-2022 PulkoMandy <pulkomandy@pulkomandy.tk>

kernel debug: rewrite dump_block to use a single dprintf call

In the syslog, each dprintf call is prefixed with a KERN: prefix,
rendering the dump unreadable. Bufferize things to print each line with
a single call.

Change-Id: I27c1b1f74434fbc6e554acb0a716f0700821bc8d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5305
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# ea7b7a54 18-Oct-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel/debug: Set sDebuggerOnCPU as soon as possible.

This variable is what debug_debugger_running() checks to determine
if the debugger is in fact running. Before this commit, it was not
set until *after* calling debugger module hooks; now it is called
before them.

This fixes #17302. The problem there was that the USB stack gained
an ASSERT(debug_debugger_running()) in code that is called in the
USB keyboard debug module initialization, which before this commit
would trip, and then enter an infinite loop as panic() does not work
during debugger startup. Now the assert is true and everything works
as it did before.


# a812e3ca 17-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel/debug: Only create an area for the debug syslog if reusing one.

If the debug_output pointer is just a kernel_args_malloc'd structure,
then it is already mapped and we should not be re-mapping it; we only
need to do that if we are using a fixed-map ring.


# 31caaec0 16-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Print <DROP> at the beginning and not the end of dropped regions.

This way there is a better indication of where the drop occurred.


# 7cde1252 16-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Write parts of truncated messages to the log.

In case any one message (or, more likely, importing the bootloader's
syslog buffer) is too large for our buffer, do not discard it, but
keep as much as we can, and print <TRUNC> at the beginning of it,
to distinguish from <DROP>. (Documentation already notes <TRUNC> as
a possible thing to find in the syslog.)


# 7fd1fb87 16-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

kernel: Correct bootloader syslog buffer handoff logic.

If keep_debug_output_buffer is true, then we reused the syslog buffer
the bootloader allocated (and which has just been re-mapped above),
so we do not need to write the buffer in again (and moreover doing so
is incorrect, as it contains a raw ring_buffer header, and will be
larger than the buffer.)

This fixes "<DROP>" appearing at the beginning of all syslogs (or at least,
ones that began with handoffs from the bootloader) spuriously when
the whole buffer was really present anyway.


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

kernel: Remove some unused macros.

Spotted by Clang. (I double-checked they weren't used within
some #ifdef'd-out code, too.)


# dd1454bd 20-Nov-2017 François Revol <revol@free.fr>

Defer calling arch_debug_console_init_settings

when we can actually read driver settings :-)


# d8548e00 07-Nov-2015 Jonathan Schleifer <js@webkeks.org>

Fix some more type mismatches with std::{min,max}


# 4bf862e3 21-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

syslog_daemon: Converted to BServer.

* Instead of letting the kernel search for the syslog port, the
daemon now registers itself with the kernel (which even solves
a TODO).
* A port is created for the actual log messages from the launch_daemon,
and used on start.
* However, the SyslogTest does not yet work, due to the BMessage <->
KMessage communication problems.


# 8540ec24 19-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Save previous session's debug syslog during boot

Add boot loader debug menu option "Save syslog from previous session
during boot". If enabled (defaults to true), the previous session's
debug syslog data is copy to a separate buffer and passed to the
kernel, which writes it back to the file /var/log/previous_syslog.
As long as Haiku still boots, this should now be the most convenient way
to retrieve the output from a kernel crash.


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

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# 7db89e8d 25-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Rework cpuidle module

* Create new interface for cpuidle modules (similar to the cpufreq
interface)
* Generic cpuidle module is no longer needed
* Fix and update Intel C-State module


# 73ad2473 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

Remove remaining unnecessary 'volatile' qualifiers


# b1c3379c 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_debug_output(): Fix for long strings

The wrong length was passed to debug_puts().


# 5261923e 20-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add dvprintf()


# 45e0e08a 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Made panic() safe to use before the current thread has been set.


# 69a8b954 23-Jun-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

FixedWidthPointer: Fix ==/!= operators, remove OtherType casts

* FixedWidthPointer:
- operators ==/!=: Change second operand type from void* to const
Type*. Also add non-const version to resolve ambiguity warning when
comparing with non-const pointer.
- Add Pointer() getter.
- Remove templatized cast operators. They are nice for casting the
pointer directly to another pointer type, but result in ambiguity.
* Make preloaded_image::debug_string_table non-const. Avoids clashes of
the const and non-coast FixedWidthPointer comparison operators. A
cleaner (but more verbose) solution would be to spezialize
FixedWidthPointer for const types.


# 62d36f98 22-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Removed the addr_t conversion operators from FixedWidthPointer which makes comparison against NULL work properly.


# d8efc6ca 21-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changes to kernel_args to make it identical for x86 and x86_64.

* Added a FixedWidthPointer template class which uses 64-bit storage to hold
a pointer. This is used in place of raw pointers in kernel_args.
* Added __attribute__((packed)) to kernel_args and all structures contained
within it. This is necessary due to different alignment behaviour for
32-bit and 64-bit compilation with GCC.
* With these changes, kernel_args will now come out the same size for both
the x86_64 kernel and the loader, excluding the preloaded_image structure
which has not yet been changed.
* Tested both an x86 GCC2 and GCC4 build, no problems caused by these changes.


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

More 64-bit compilation/safety fixes.


# 14c345e1 25-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

* Revert r42319 as it introduces a race condition when entering the kernel
debugger. As sInDebugger is already > 0 when the first CPU enters KDL, code
from other CPUs might see debug_debugger_running() == true already before they
enter the debugger.
* Instead, move the sDebuggerOnCPU setting out of the debugger loop and hold the
value until after calling exit_kernel_debugger() so that the exit hooks still
see debug_debugger_running() == true.
* Also avoid calling exit_kernel_debugger() when we've been called recursively
(previousCPU != -1). Previously the exit hooks would've been called and the
debugger state reset erroneously. To balance the missing decrement of
sInDebugger in that case we decrement sInDebugger in enter_kernel_debugger()
also when detecting the recursion case.


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


# 32147100 25-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

Use sInDebugger instead of sDebuggerOnCPU to determine if the debugger is
running. The former has a broader scope and lasts until the debugger exit is
actually done whereas the latter is already reset when the inner loop is exited.
This fixes the issue Ingo saw where the USB physical memory manager wasn't able
to free resources used for the debug transfer. It has reserved debug memory that
it uses depending on debug_debugger_running() and was therefore confused when
it returned false when called from the kernel debugger module exit hook.


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


# 8bcc50c3 12-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added arch_debug_blue_screen_try_getchar() and arch_debug_serial_try_getchar()
which don't wait for a character, but return -1 when no character is
available ATM. Implemented correctly for x86 only.
* Changed the semantics of the debugger_module_info::debugger_getchar() hook.
It is supposed to return immediately now.
* Adjusted usb_keyboard accordingly. Hacked UHCI's debug_process_transfer() to
achieve that. It does now start, check, or cancel a transfer. Split
UHCI::ProcessDebugTransfer() into StartDebugTransfer(), and
CheckDebugTransfer() accordingly, and also added a CancelDebugTransfer().
The latter seems to have issues. Michael, please have a look. I have no clue
what I'm doing. :-)
* Adjusted kgetc() to poll all possible inputs using the new
functions/semantics. This allows to use any input (USB, PS/2, serial) in KDL.
* Removed the no longer needed "serial_input" command.
* read_line(): Also support 0x7f as backspace code. That's what xterm sends.


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


# 6250297a 08-May-2011 Oliver Tappe <zooey@hirschkaefer.de>

Switch haiku-revision from uint32 to string, as that's going to be required soon, no matter if we switch to Git or Mercurial
* increase _SYS_NAMELEN defined in sys/utsname.h to 128 to allow long(ish) revisions
* sHaikuRevision is now a static character array (in both libroot and kernel)
* adjust build tool set_haiku_revision to write the revision as string


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41389 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


# 40982d1e 03-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Check user_strlcpy() return value (CID 4053).


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


# 45849022 18-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

syslog_sender():
* After an unsuccessful find_port() wait a while before trying again.
find_port() is quite expensive and particularly during the boot process it
was called quite busily. Essentially a find_port() per written syslog
message was performed.
* Added TODOs regarding using a semaphore and using find_port().


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


# 45bd7bb3 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


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


# 07e1164e 08-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

syslog_init(): Bail out, if kernel_args::debug_output is NULL. Would crash on
platforms that are ignorant of the debug syslog feature.


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


# 8c8fcd77 05-May-2010 Axel Dörfler <axeld@pinc-software.de>

* Moved the addition of the basic debugger commands directly after the VM init.
* Separated the other stuff previously done in debug_init_post_vm() to the new
debug_init_post_settings().
* Removed superfluous status_t return codes - they are ignored, anyway, and if
there really is a show stopper in the init process, panicking would be the
thing one should do.


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


# 73f4184b 29-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Unset sSyslogBuffer in all error cases in which we disable syslog output.
Spotted by Axel.


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


# 7b8344c6 29-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

syslog_init_post_vm(): If the syslog is disabled, clear sSyslogBuffer. It is
already initialized in syslog_init(), if the debug syslog feature is enabled.
Since the area would never be created, the pointer becomes invalid, however,
and could cause a double fault on entering KDL.


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


# 22984248 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* kernel_debugger_loop(): Don't access sSyslogBuffer without checking whether
it is non-NULL first.
* syslog_init_post_vm(): Make sure the area for the debug syslog could actually
be created and fail otherwise.
* syslog_init_post_threads(): Fixed the cleanup on error. In case of a debug
syslog we need to delete the respective area instead of free()ing the
memory.


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


# c3676b54 13-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added vm_debug_copy_page_memory() which copies memory from a potentially not
mapped page.
* debug_{mem,strl}cpy():
- Added "team" parameter for specifying the address space the address are
to be interpreted in.
- When the standard memcpy() (with fault handler) fails, fall back to
vm_debug_copy_page_memory().
* Added debug_is_debugged_team(): Predicate returning true, if the supplied
team_id refers to the same team debug_get_debugged_thread() belongs to.
* Added DebuggedThreadSetter class for scope-based debug_set_debugged_thread().
Made use of it in several debugger functions.
* print_demangled_call() (x86): Fixed unsafe memory access.

Allows KDL stack traces to work correctly again, even if the page daemon has
already unmapped the concerned pages.


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


# 345730da 27-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed gcc 2 build.


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


# c81e68b2 27-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

"syslog" debugger command: By default it now ignores the output added to the
syslog in the current KDL session. Added option "-k" for the former behavior.


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


# a3691986 19-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

kernel_debugger_loop(): We need to use a dedicated jmp_buf for the call of
arch_debug_stack_trace() through debug_call_with_fault_handler(), since the
one in the CPU structure can only be used for debug_{strl,mem}cpy(), which do
not potentially have nested debug_call_with_fault_handler() calls.


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


# cfefeee3 18-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed arch_debug_save_registers() to take an arch-specific structure
arch_debug_registers instead.
* Call arch_debug_save_registers() on all CPUs when entering the kernel
debugger.
* Added debug_get_debug_registers() to return a specified CPU's saved
registers.
* x86:
- Replaced the previous arch_debug_save_registers() implementation. Disabled
getting the registers via the gdb interface for the time being.
- Fixed the "sc", "call", and "calling" commands to also work for threads
running on another CPU.


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


# 2d2b6b1f 18-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Unconditionally print a stack trace when we entered KDL via panic().
* Print the initial stack trace safely, i.e. in a setjmp() + fault handler
environment.
* Disable pagination while executing the executing the panic() commands. This
way even when it is not possible to use the keyboard we get the full output.
* Added "panic_commands" kernel debugger command, to execute the panic()
commands again (with pagination enabled).


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


# 64c15cfc 17-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* sCurrentKernelDebuggerMessageArgs is no longer used directly. Whenever it
is passed to some v*printf(), we clone it first. This way we can use it
repeatedly. It worked only on certain architectures correctly before.
* Changed the panic() semantics a bit: When the format contains the
(hopefully unusual enough) string "@!" only the part before it is
considered to belong to the panic message. The part after it is interpreted
as a command line to be executed directly after entering KDL. This way it
is possible to provide helpful command invocations only developers somewhat
familiar with the subsystem might come up with. E.g.:
panic("dec_vnode_ref_count: called on busy vnode %p"
"@! vnode -p %p; mount _mount", vnode, vnode);


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


# 3fded334 16-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Write kernel debugger output to the syslog as well. This should make life
for people who cannot capture serial output easier.
* The syslog sender thread waits with timeout now, so output added to the
syslog buffer without explicit notification is still written after a few
seconds at the latest.


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


# 28a2172c 11-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

kernel:
* The kernel syslog ring buffer is no longer emptied by the syslog sender
thread. Instead we only drop the oldest data from the buffer when we're
writing to it and there's not enough free space in it.
Advantages: We drop old data rather than the most recent data when the buffer
is full. The "syslog" KDL command has more data available now. So the odds
are that kernel syslog messages not written to disk yet are at least still
in the kernel buffer.
* Changed dprintf_no_syslog() semantics: Now it writes to the syslog, but
doesn't notify the syslog sender thread.

boot loader:
* Added the ring_buffer implementation and a dummy user_memcpy().
* bios_x86: Moved the syslog stuff from serial.{cpp,h} to debug.{cpp.h}.
* Moved the debug options from the "Select safe mode options" menu to a new
"Select debug options" menu.
* Added option "Enable debug syslog" to the new menu (ATM available on x86
only). It allocates a 1 MB in-memory buffer for the syslog for this session
in such a way that it can be accessed by the boot loader after a reset.
* Added item "Display syslog from previous session" to the new menu, doing
what its name suggests.


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


# cd4e9467 27-Feb-2010 Alexandre Deckner <alex@zappotek.com>

* Add a serial_input command to the kernel debugger, allows using serial input even when on-screen kdebug is enabled. Usefull for remote debugging. Please review/adjust.


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


# 8b64284b 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Handle va_list copying correctly. Fixes PPC build.


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


# 0ea0681f 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the "message" command work correctly again. Broke it with my recent
changes.


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


# 98d2fc4b 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Worked around "uninitialized variable" compiler warnings.


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


# 9e4ad079 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Pass the panic() format and args through to kernel_debugger_loop(), so that
the message doesn't get truncated.
* No longer print the "PANIC:" prefix when entering the kernel debugger via
kernel_debugger().


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


# bcc2c157 13-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactored vm_translation_map:
* Pulled the physical page mapping functions out of vm_translation_map into
a new interface VMPhysicalPageMapper.
* Renamed vm_translation_map to VMTranslationMap and made it a proper C++
class. The functions in the operations vector have become methods.
* Added class GenericVMPhysicalPageMapper implementing VMPhysicalPageMapper
as far as possible (without actually writing new code).
* Adjusted the x86 and the PPC specifics accordingly (untested for the
latter). For the other architectures the build is, I'm afraid, seriously
broken.

The next steps will modify and extend the VMTranslationMap interface, so that
it will be possible to fix the bugs in vm_unmap_page[s]() and employ
architecture specific optimizations.


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


# 3ce26345 30-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Fixed the semantics of [v]snprintf(): If the buffer is not large enough,
the function shall nevertheless return the length of the string that would
be written, if the buffer were large enough.
Added a touch of C++ while doing that. :-)
* Fixed the instances in boot loader, kernel, and kernel modules where the
wrong semantics were expected. The majority of uses actually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34826 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


# 13ce48d9 28-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Moved dprintf_args()/debug_puts() guts to a new dedicated private function
debug_output().
* Added a second buffer to be used when interrupts are turned off, otherwise
dprintf_args() will now use a mutex guarded buffer to fill with vfprintf() -
the actual sending to the outputs still needs the spinlock, so things only
slightly improved.
* Moved private functions into the private section of the source file.


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


# 86860a0c 19-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* debug_printf() from userland actually only worked if serial debug output was
turned on. That should explain Bruno's problems to get debug output from an
accelerant. Thanks to Michael for the hint!


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


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

* Added an arch_debug_stack_trace() function that is called from the KDL loop
in case there aren't any KDL commands available yet.


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


# aa6f54aa 08-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Amended the {user,debug}_strlcpy() fix: Due to the strlcpy() semantics to
always return the source string length, we can't really prevent an overflow
of the source address.


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


# 8a71915a 05-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the {debug,user}_{mem,strl}cpy() and user_memset() functions deal with
address overflows. Apparently at least the x86 string instructions generate
a general protection fault instead of a page fault, and we only use the fault
handler in the latter case (maybe we should change that, too). Fixes #4714.


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


# be51dd0f 30-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added debug_strlcpy() for use in the kernel debugger.


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


# 89294b50 26-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added option for enabling serial debug output.
* Moved device_manager/settings.cpp to debug/safemode_settings.cpp.
* Removed the somewhat hacky concatenation of kernel settings and safemode
settings in the boot loader. Instead, get_safemode_option() will now fall
back to the kernel settings, if it couldn't spot a setting in the safemode
settings. This allows for more control, and also makes enabling serial
debug output actually work (ie. overriding the kernel settings via safemode
options).
* Adjusted debug_init_post_vm(), and smp_init_other_cpus() to use
get_safemode_boolean().
* Therefore, I added safemode_settings.cpp to the boot loader as well.


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


# ea2abd11 02-Aug-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed the ROUNDOWN macro to ROUNDDOWN. Also changed the implementation of
ROUNDUP to use '*' and '/' -- the compiler will optimize that for powers of
two anyway and this implementation works for other numbers as well.
* The thread::fault_handler use in C[++] code was broken with gcc 4. At least
when other functions were invoked. Trying to trick the compiler wasn't a
particularly good idea anyway, since the next compiler version could break
the trick again. So the general policy is to use the fault handlers only in
assembly code where we have full control. Changed that for x86 (save for the
vm86 mode, which has a similar mechanism), but not for the other
architectures.
* Introduced fault_handler, fault_handler_stack_pointer, and fault_jump_buffer
fields in the cpu_ent structure, which must be used instead of
thread::fault_handler in the kernel debugger. Consequently user_memcpy() must
not be used in the kernel debugger either. Introduced a debug_memcpy()
instead.
* Introduced debug_call_with_fault_handler() function which calls a function
in a setjmp() and fault handler context. The architecture specific backend
arch_debug_call_with_fault_handler() has only been implemented for x86 yet.
* Introduced debug_is_kernel_memory_accessible() for use in the kernel
debugger. It determines whether a range of memory can be accessed in the
way specified. The architecture specific back end
arch_vm_translation_map_is_kernel_page_accessible() has only been implemented
for x86 yet.
* Added arch_debug_unset_current_thread() (only implemented for x86) to unset
the current thread pointer in the kernel debugger. When entering the kernel
debugger we do some basic sanity checks of the currently set thread structure
and unset it, if they fail. This allows certain commands (most importantly
the stack trace command) to avoid accessing the thread structure.
* x86: When handling a double fault, we do now install a special handler for
page faults. This allows us to gracefully catch faulting commands, even if
e.g. the thread structure is toast.

We are now in much better shape to deal with double faults. Hopefully avoiding
the triple faults that some people have been experiencing on their hardware
and ideally even allowing to use the kernel debugger normally.


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


# 671a2442 31-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

More work towards making our double fault handler less triple fault prone:
* SMP:
- Added smp_send_broadcast_ici_interrupts_disabled(), which is basically
equivalent to smp_send_broadcast_ici(), but is only called with interrupts
disabled and gets the CPU index, so it doesn't have to use
smp_get_current_cpu() (which dereferences the current thread).
- Added cpu index parameter to smp_intercpu_int_handler().
* x86:
- arch_int.c -> arch_int.cpp
- Set up an IDT per CPU. We were using a single IDT for all CPUs, but that
can't work, since we need different tasks for the double fault interrupt
vector.
- Set the per CPU double fault task gates correctly.
- Renamed set_intr_gate() to set_interrupt_gate and set_system_gate() to
set_trap_gate() and documented them a bit.
- Renamed double_fault_exception() x86_double_fault_exception() and fixed
it not to use smp_get_current_cpu(). Instead we have the new
x86_double_fault_get_cpu() that deducts the CPU index from the used stack.
- Fixed the double_fault interrupt handler: It no longer calls int_bottom to
avoid accessing the current thread.
* debug.cpp:
- Introduced explicit debug_double_fault() to enter the kernel debugger from
a double fault handler.
- Avoid using smp_get_current_cpu().
- Don't use kprintf() before sDebuggerOnCPU is set. Otherwise
acquire_spinlock() is invoked by arch_debug_serial_puts().

Things look a bit better when the current thread pointer is broken -- we run
into kernel_debugger_loop() and successfully print the "Welcome to KDL"
message -- but we still dereference the thread pointer afterwards, so that we
don't get a usable kernel debugger yet.


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


# 213d2d8f 29-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added syscall _kern_kernel_debugger() to enter the kernel debugger.


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


# ebc89d17 28-Jul-2009 Michael Lotz <mmlr@mlotz.ch>

Remove extra newline in debug command description which caused empty lines in
the KDL help to be printed.


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


# c755ecfe 20-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Added an emergency key mechanism to the kernel, inspired by Jan Klötzke's
patch from about a year ago (I couldn't use any code of his yet, though,
but there are a few things left). The emergency keys are triggered by
pressing Alt-SysReq + key.
* By default, only Alt-SysReq+'d' is used as a means to deliberately enter
the kernel debugger. F12 belongs to userland again, now :-)
* Debugger add-ons now have another optional method to implement their own
emergency keys - 'd' for the debugger cannot be overridden, though.
* The mechanism can be turned off via a new kernel setting, so it's not that
easy anymore to "crash" Haiku if you don't want to.
* Right now, the PS/2 driver, and the pre-input_server in-kernel debugger
keyboard mini-driver support this, USB not yet.
* Minor cleanup.


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


# cf2a26ea 03-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Don't overwrite the history buffer when you issue the same command more than
once.


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


# 360d4974 02-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Replaced the temporary storage used in the kernel debug command parser. We now
have a simple dedicated heap for the kernel debugger with stacked allocation
pools (deleting a pool frees all memory allocated in it). The heap should
eventually be used for all commands that need temporary storage too large for
the stack instead of each using its own static buffer.


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


# 48b0c6f9 16-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

debug_trap_cpu_in_kdl(): If the CPU running the kernel debugger exited and
re-entered it fast enough, we wouldn't leave the loop and thus cause a
deadlock, since we wouldn't process the ICI message telling us to halt. We do
now call smp_intercpu_int_handler() in the loop and guard the function from
being re-entered. This also has the advantage that we can execute code on all
CPUs in the kernel debugger, if we have to.


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


# 73b118b6 04-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

bonefish + mmlr:
Check gKernelStartup to avoid sending ICI when entering the kernel debugger
(after ICI is enabled). Moreover it's more obvious than to use that instead
of relying on ICIs not being enabled.


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


# 6eba0636 22-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Added simplified possibility to schedule UHCI transfers from within KDL.
* Added debugger commands to resolve usb_ids to pipes.
* Adjusted the physical memory allocator to be usable in a slimmed down mode
when running inside the kernel debugger.
* Implemented USB keyboard support for KDL through a kernel debugger add-on.
* Added kgetc() and made use of it where previously individual methods were used
to ensure that reading characters always goes through the kernel debugger
add-ons and the other methods.

This has some preconditions to meet though:
1) The keyboard must be in the boot protocol (currently the case but needs to
be revisited once we have a full usb_hid).
2) The keyboard must be attached to a UHCI root port (i.e. not use EHCI or OHCI,
also not through hubs unless those are USB 1.1).
3) the usb_hid driver has to be opened for this to work. This means that for the
time between initializing USB and when usb_hid is opened by the input_server
there is no keyboard support.

Also note that this has no way of detecting hot-plug, meaning that you can't
re-attach your USB keyboard from the hub to the root port once in KDL.

On the bright side of things, since this is a non-destructive mechanism it is
possible to enter and leave KDL without loosing the USB state.

Tested OK in QEMU, not tested on real hardware yet, will see in a few minutes.


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


# 2187c498 02-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Not sure how this happened.


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


# 74c05b1d 02-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Accidently forgot to fix the typo that Adrian pointed out in his patch to
#2919 (OMG :-)).
* While I was at it, I also cleaned up some style inconsistencies.


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


# f9e72b6e 01-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Small variation of Adrian's patch to fix bug #2919, ie. re-enable paging
and colors for the on-screen debug output when leaving KDL. Thanks, Adrian!


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


# cca9f051 30-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* debug_demangle_symbol() did not set _isObjectMethod when there was no
demangle module (yet). This could cause a read fault in x86's
print_demangled_call() (as it assumed there must be a ':' when this is true).


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


# 204b1f01 22-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added boolean "syslogOutput" parameter to flush_pending_repeats() so
that dprintf_no_syslog() can avoid sending something to the syslog.


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


# 18ad0f1b 22-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a new kernel setting "syslog_buffer_size" to change the size of the
internal syslog ring buffer.


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


# 8d805b68 22-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Cleanup.


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


# 210b7fe0 22-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Adrian Panasiuk (Adek336) to fix the syslog output to insert
the <DROP> marker at the place data was dropped, not somewhere else. See
ticket #156; this might already fix this bug.
* Minor cleanup.


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


# 7ab39de9 17-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed unused SMP_MSG_RESCHEDULE ICI message.
* Introduced flag "invoke_scheduler" in the per CPU structure. It is
evaluated in hardware_interrupt() (x86 only ATM).
* Introduced SMP_MSG_RESCHEDULE_IF_IDLE message, which enters the
scheduler when the CPU currently runs an idle thread.
* Don't do dprintf() "CPU x halted!" when handling a SMP_MSG_CPU_HALT
ICI message. It uses nested spinlocks and could thus potentially
deadlock itself (acquire_spinlock() processes ICI messages, so it
could already hold one of the locks). This is a pretty likely scenario
on machines with more than two CPUs, but is also possible when the
panic()ing thread holds the threads spinlock. Probably fixes #2572.
* Reworked the way the kernel debugger is entered and added a "cpu"
command that allows switching the CPU once in KDL. It is thus possible
to get a stack trace of the thread not on the panic()ing CPU.
* When a thread is added to the run queue, we do now check, if another
CPU is idle and ask it to reschedule, if it is. Before this change, the
CPU was continuing to idle until the quantum of the idle thread
expired. Speeds up the libbe.so build about 8% on my machine (haven't
tested the full Haiku image build yet).
* When spinlock debugging is enabled (DEBUG_SPINLOCKS) we also record
the spinlock acquirer on non-smp machines. Added "spinlock" debugger
command to get the info.
* Added debugger commands "ici" and "ici_message", printing info on
pending ICI message respectively on a given one.
* Process not only a single ICI message in acquire_spinlock() and other
places, but all pending ones.
* Also process ICI messages when waiting for a free one -- avoids a
potential deadlock.
* Mask out non-existing CPUs in send_multicast_ici(). panic() instead of
just returning when there's no target CPU left.


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


# ddecb4a7 12-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the way the demangle functionality works: instead of having a kernel
debugger add-on set a demangle hook, all modules under debugger/demangle/ are
now considered demangle modules.
* Added another function to the demangle module interface that gives you access
to the arguments.
* Implemented a demangling module for GCC2.
* The older demangling module is now called "gcc3+", but doesn't support
getting the arguments yet.
* The "call" KDL command is now using demangling to automatically show you
the arguments of a call from a stack crawl.
* Minor cleanup.


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


# ca7cb625 17-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Implemented a (private for now) get_system_info_etc() call, that can retrieve
various system information.
* Implemented retrieving some VM stats via this call.
* The VM now maintains a page fault counter, and sets system_info::page_faults
accordingly.
* Added a (pretty simple) "vmstat" command line app.
* Minor cleanup.


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


# 290e3dd2 22-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduced the notion of a currently debugged thread in the kernel
debugger and added respective getter/setter methods
debug_{get,set}_debugged_thread(). By default the currently debugged
thread is the thread that dropped into the kernel debugger, but commands
like "in_context" can change it.


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


# 46ec2301 12-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

When in the kernel debugger we do now record the relevant information
(fault address, pc, read/write) when a page fault occurs, and print them
in case this caused the termination of a debugger command.


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


# 40d9ff3a 03-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed warning.


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


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

* thread_preboot_init_percpu() sets the current thread pointer with a mostly
empty thread structure. This causes the thread::team pointer to be NULL
during the early boot process, but our kernel debugger didn't like that.


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


# 0b46f622 30-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Made struct ring_buffer public (within the kernel).
* Added "syslog" command that dumps the contents of the syslog ring buffer into
KDL. Use the '-n' option to only show what hasn't been sent to the syslog
daemon yet.
* When entering the kernel debugger, the current thread ID and name are also
printed (not only the current CPU).


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


# 8881176f 23-Jul-2008 François Revol <revol@free.fr>

A module that hooks into the debugger to provide it with a demangle() so at least when using C++ in the kernel stack crawls are meaningful.
It does its job by using part of libsupc++, with fake malloc and friends to make sure it won't double fault.
Works here, but cp-demangle must be extracted by hand from the lib, can't get the rule to work as I want, Ingo ?
Maybe using it directly without malloc hack would be ok with 16KB buffer, but I'm not sure of that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26581 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


# 2b31f85c 05-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Fix two warnings caused by previous commit.

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


# a9fbc548 05-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Give the debugger add-ons a chance when reading input characters. They already
got a debugger_getchar hook, it just wasn't used yet. Not that there would be
any debugger add-on implementing that hook currently...

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


# 9223644a 04-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Add a welcome message including the revision number when initializing the
syslog so syslogs always contain the revision number too (as does serial
output).
This is only necessary because the early part of the serial output (that
contains the revision number) does not make it into the syslog. So fixing that
might be the better way.

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


# 992330f5 03-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_debug_output() used kputs() and thus wouldn't print anything
anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25783 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


# 73aa393d 31-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced pipes in the kernel debugger. The syntax is similar to
pipes in the shell, though the semantics is a little different: The
second command is invoked whenever the first command has written a
complete line. The line is passed as last argument to the second
command. The new command flag B_KDEBUG_PIPE_FINAL_RERUN causes the
second command to be invoked again (with NULL argument) after the
first command is done.
* Added kprintf_unfiltered() and kputs_unfiltered() which bypass the
pipe mechanism and directly print to the bluescreen/serial output.
* Moved most commands from debug.cpp to the new
debug_builtin_commands.cpp.
* B_KDEBUG_DONT_PARSE_ARGUMENTS commands don't get an argument anymore,
if it would consist of white space only.
* Added new debugger command return value B_KDEBUG_ERROR, which
indicates that executing the command failed. This return code will
abort a complete pipe.
* Since debugger commands can nest (i.e. one command can invoke another
one) the setjmp()/longjmp() mechanism to restore the stack after a
page fault in a command needs more than one jump buffer.
* Added abort_debugger_command(), which longjmp()s out of the currently
executed command. This will also abort the current pipe.
* When pagination is enabled pressing "a" will abort the running command
(as opposed to "q" which only disables the blue screen output, but
lets the command continue).
* Added debugger commands:
- "grep" which can be used to filter output by pattern. Removed the
"filter" command and the underlying mechanism that did that before.
- "head" which prints only the first lines of output of another
command.
- "wc" counts lines, words, and characters of another command's
output.


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


# a1587d16 28-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Ctrl-L clears the KDL screen.


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


# dfa611bb 26-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added paranoia checks debug facility. It helps checking that data in
memory haven't changed behind one's back.


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


# e77b684f 26-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added very basic possibility to set a filter for all KDL command
output using the new "filter" command.


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


# a886f802 20-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added debug_screen_output_enabled() function.
* The boot splash code now checks wether debug screen output is enabled or not
using the above function.
* The boot splash code no longer maps it's own copy of the frame buffer, instead,
it will use the boot item feature as the VESA driver does. Also removed the
lock, as that's not needed at all.
* Renamed splash.cpp to boot_splash.cpp, and boot/splash.h to boot_splash.h
(it's not part of the boot loader, but the kernel).
* Removed dead code from boot_splash.cpp, added license. Replaced license
header in boot_splash.h to a style guide conforming one.


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


# ff7eefe8 21-Feb-2008 François Revol <revol@free.fr>

Call debugger_puts hooks on modules when serial debug output is enabled (modules themselves must reject loading if they don't find mymodule_debug_output in kernel settings).


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


# d63cbbe2 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added "error" debugger command to print the error string for a given
numeric error code.


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


# f87d72d7 03-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

Introduce a B_NO_LOCK_VECTOR flag to be used with install_io_interrupt_handler().
When specified it desigantes that the interrupt handler should not lock the
vector with a spinlock when executing the installed interrupt handlers. This
is necessary to allow the same interrupt vector to be handled in parallel on
different CPUs. And it is required for the CPU halt to work synchronously when
there is more than one AP CPU. Though the acquire_spinlock() should cause IPIs
to be processed, only this fixed the SMP_MSG_FLAG_SYNC problem for me.
Not locking is safe as long as it is guaranteed that no interrupt handler is
registered or removed while the interrupt handler is running. We can guarantee
this for the SMP interrupt handlers we install in arch_smp_init() as they are
never uninstalled. Probably this flag should be made private though.
Restored the SMP_MSG_FLAG_SYNC when entering the kernel debugger.

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


# 3cec75dc 30-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Debugger modules now have two methods: enter_debugger() and exit_debugger().
* The kernel now opens up to 8 debugger modules (and puts them into an array;
maybe we'll want to switch to a doubly linked list when there is the need).
* Implemented an example debugger module that prints a stack trace of the
current thread when the kernel debugger is entered (not included in the
image).


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


# 7f569896 26-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Add concurency handling when entering the kernel debugger. Previously there
was a race condition when more than one CPU would enter the debugger at the
same time (or rather before one CPU could stop all the others). We now use the
inDebugger variable to tell if someone is already in the debugger and then
only process inter CPU messages and retry entering the debugger.
Since sending the synchronous broadcast most of the time hung over here with
SMP enabled I removed the synchronous flag and added a simple spin to give the
other CPUs a chance to process the halt request. Added comments that explain
the reasons and a ToDo to revert to synchronous delivery once we fixed the
problem. The kernel debugger is now usable on my quad core.

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


# 325b88a6 21-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced debugger command flag B_KDEBUG_DONT_PARSE_ARGUMENTS.
For commands with this flag set, the parser won't parse the
arguments provided (it will only check for matching parentheses and
brackets), but will pass the unparsed argument list string to the
command instead.
* Set the new flag for the "expr" command, so one doesn't have to quote
the expression to evaluate anymore (or put it in parentheses).
* Fixed tokenizing of quoted and unquoted strings in expression mode.


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


# 635aca08 21-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unused variable.


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


# 90242589 20-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Made kputs() available in the kernel and used it for printing debugger
command usage texts, which can be too long for kprintf().


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


# 19b468ea 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Cursor up/down stop before empty (i.e. unused) history lines, now.
* Added support for page up/down (works like in bash).


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


# e6a8dfa8 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

The usage string directly printed by print_debugger_command() and
invoke_debugger_command() is now automatically preceded by
"usage: <command name>", so the string passed to
add_debugger_command_etc() shouldn't contain it anymore.


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


# 8a90d12e 16-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added add_debugger_command_etc() which is similar to
add_debugger_command(), but additionally takes parameters "usage"
and "flags".
* Added add_debugger_command_alias() which creates another name for an
existing command.
* Added print_debugger_command_usage() to print a command's usage.
* invoke_debugger_command() intercepts invocations with "--help" and
prints the command's usage text, if it is known. If unknown, the
command will be called normally.
* Made use of the new functions in debug.cpp.


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


# 18397925 16-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Change parse_expression() return value from uint32 to uint64.


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


# b9074efc 16-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the "vnodes" KDL command when called without any arguments.
* Fixed the usage text of the "help" KDL command.
* Made the "ambiguous command" warning shorter, so that it will still fit in
the exception buffer.


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


# 15f1e197 15-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for the "--help" argument to some debugger commands.
* The kernel debugger does now define some temporary variables when
entered (current thread and team, etc.).


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


# 3b4fa166 15-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented parse_expression(). The back-end is an expression parser
that is a little more powerful than BeOS'. It features:
- Persistent and temporary uint64 variables. The former kind is set
only by the user. The latter (those prefixed "_") can be set
automatically by commands, thus e.g. making it easier to access
members of a dumped structure. They are unset when the next command
is invoked. The special temporary variable "_" is defined as a
command's return value.
- Expressions can contain nested command invocations using brackets
("[ ... ]").
- Command lines are parsed by the expression parser, too. They can
contain command invocations (in brackets) and expressions (in
parentheses).
* Added debugger commands:
- expr: Evaluates the given expression and prints the result.
- unset: Undefines a variable.
- vars: Prints the values of all defined variables.
* Moved debugger command code into its own source file.



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


# 07b8a5de 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Sort the registered commands by name when entering KDL.
* Don't execute a command anymore, if the given prefix is ambiguous.
* Added tab completion for commands.
* Added on-the-fly help while typing a command line. It is triggered
by pressing tab at a position after the space following the command.
It is implemented by calling the command with argument "--help", which
doesn't work yet with most commands, but some already print their
usage in this case.


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


# ea144d4b 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Use C linkage for kgets(). Should fix hangman.


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


# 945a0600 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added "message" debugger command to reprint the message printed when
entering KDL.


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


# 46a15bd6 13-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for line editing in KDL.


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


# 9d2cde71 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

debug.c -> debug.cpp


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


# 4bf862e3689b034d4e44cf94c5e50fe7ae05aee3 21-Apr-2015 Axel Dörfler <axeld@pinc-software.de>

syslog_daemon: Converted to BServer.

* Instead of letting the kernel search for the syslog port, the
daemon now registers itself with the kernel (which even solves
a TODO).
* A port is created for the actual log messages from the launch_daemon,
and used on start.
* However, the SyslogTest does not yet work, due to the BMessage <->
KMessage communication problems.


# 8540ec2446d1fda22904ace548570b73d91f4726 19-Jan-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Save previous session's debug syslog during boot

Add boot loader debug menu option "Save syslog from previous session
during boot". If enabled (defaults to true), the previous session's
debug syslog data is copy to a separate buffer and passed to the
kernel, which writes it back to the file /var/log/previous_syslog.
As long as Haiku still boots, this should now be the most convenient way
to retrieve the output from a kernel crash.


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

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# 7db89e8dc395db73368479fd9817b2b67899f3f6 25-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Rework cpuidle module

* Create new interface for cpuidle modules (similar to the cpufreq
interface)
* Generic cpuidle module is no longer needed
* Fix and update Intel C-State module


# 73ad2473e7874b3702cf5b0fdf4c81b747812ed9 05-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

Remove remaining unnecessary 'volatile' qualifiers


# b1c3379c7e17a5368f3ce6642e3e995143779481 10-Sep-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_debug_output(): Fix for long strings

The wrong length was passed to debug_puts().


# 5261923e877d1637aea41ab878af97d49d70fd69 20-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add dvprintf()


# 45e0e08aed9ff534cc6e90b71542ed272de100c1 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Made panic() safe to use before the current thread has been set.


# 69a8b95491c160f03a5b0dab0fa8d1899fe42d4b 23-Jun-2012 Ingo Weinhold <ingo_weinhold@gmx.de>

FixedWidthPointer: Fix ==/!= operators, remove OtherType casts

* FixedWidthPointer:
- operators ==/!=: Change second operand type from void* to const
Type*. Also add non-const version to resolve ambiguity warning when
comparing with non-const pointer.
- Add Pointer() getter.
- Remove templatized cast operators. They are nice for casting the
pointer directly to another pointer type, but result in ambiguity.
* Make preloaded_image::debug_string_table non-const. Avoids clashes of
the const and non-coast FixedWidthPointer comparison operators. A
cleaner (but more verbose) solution would be to spezialize
FixedWidthPointer for const types.


# 62d36f98331067e472188f6c020c2ccd808f48cf 22-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Removed the addr_t conversion operators from FixedWidthPointer which makes comparison against NULL work properly.


# d8efc6caf6babe278c48e8aa3277376fb68ff455 21-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Changes to kernel_args to make it identical for x86 and x86_64.

* Added a FixedWidthPointer template class which uses 64-bit storage to hold
a pointer. This is used in place of raw pointers in kernel_args.
* Added __attribute__((packed)) to kernel_args and all structures contained
within it. This is necessary due to different alignment behaviour for
32-bit and 64-bit compilation with GCC.
* With these changes, kernel_args will now come out the same size for both
the x86_64 kernel and the loader, excluding the preloaded_image structure
which has not yet been changed.
* Tested both an x86 GCC2 and GCC4 build, no problems caused by these changes.


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

More 64-bit compilation/safety fixes.


# 14c345e147849e2b2c8c710716de261481300c14 25-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

* Revert r42319 as it introduces a race condition when entering the kernel
debugger. As sInDebugger is already > 0 when the first CPU enters KDL, code
from other CPUs might see debug_debugger_running() == true already before they
enter the debugger.
* Instead, move the sDebuggerOnCPU setting out of the debugger loop and hold the
value until after calling exit_kernel_debugger() so that the exit hooks still
see debug_debugger_running() == true.
* Also avoid calling exit_kernel_debugger() when we've been called recursively
(previousCPU != -1). Previously the exit hooks would've been called and the
debugger state reset erroneously. To balance the missing decrement of
sInDebugger in that case we decrement sInDebugger in enter_kernel_debugger()
also when detecting the recursion case.


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


# 3214710036436191840e86611082f58ced78fd09 25-Jun-2011 Michael Lotz <mmlr@mlotz.ch>

Use sInDebugger instead of sDebuggerOnCPU to determine if the debugger is
running. The former has a broader scope and lasts until the debugger exit is
actually done whereas the latter is already reset when the inner loop is exited.
This fixes the issue Ingo saw where the USB physical memory manager wasn't able
to free resources used for the debug transfer. It has reserved debug memory that
it uses depending on debug_debugger_running() and was therefore confused when
it returned false when called from the kernel debugger module exit hook.


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


# 8bcc50c336108e882e215c8c5cec57155464edf4 12-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added arch_debug_blue_screen_try_getchar() and arch_debug_serial_try_getchar()
which don't wait for a character, but return -1 when no character is
available ATM. Implemented correctly for x86 only.
* Changed the semantics of the debugger_module_info::debugger_getchar() hook.
It is supposed to return immediately now.
* Adjusted usb_keyboard accordingly. Hacked UHCI's debug_process_transfer() to
achieve that. It does now start, check, or cancel a transfer. Split
UHCI::ProcessDebugTransfer() into StartDebugTransfer(), and
CheckDebugTransfer() accordingly, and also added a CancelDebugTransfer().
The latter seems to have issues. Michael, please have a look. I have no clue
what I'm doing. :-)
* Adjusted kgetc() to poll all possible inputs using the new
functions/semantics. This allows to use any input (USB, PS/2, serial) in KDL.
* Removed the no longer needed "serial_input" command.
* read_line(): Also support 0x7f as backspace code. That's what xterm sends.


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


# 6250297a0862f935bdd9e1770bb7dde9cdab2e3f 08-May-2011 Oliver Tappe <zooey@hirschkaefer.de>

Switch haiku-revision from uint32 to string, as that's going to be required soon, no matter if we switch to Git or Mercurial
* increase _SYS_NAMELEN defined in sys/utsname.h to 128 to allow long(ish) revisions
* sHaikuRevision is now a static character array (in both libroot and kernel)
* adjust build tool set_haiku_revision to write the revision as string


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41389 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


# 40982d1e0581f3b89cd461122f32850a5471d999 03-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Check user_strlcpy() return value (CID 4053).


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


# 45849022cee7c67976092cf932497ec7ad326d8f 18-Jul-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

syslog_sender():
* After an unsuccessful find_port() wait a while before trying again.
find_port() is quite expensive and particularly during the boot process it
was called quite busily. Essentially a find_port() per written syslog
message was performed.
* Added TODOs regarding using a semaphore and using find_port().


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


# 45bd7bb3db9d9e4dcb02b89a3e7c2bf382c0a88c 25-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unnecessary inclusions of <boot/kernel_args.h> in private kernel
headers and respectively added includes in source files.


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


# 07e1164e5909baef5f9bc0857ee3e8112ce22e8a 08-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

syslog_init(): Bail out, if kernel_args::debug_output is NULL. Would crash on
platforms that are ignorant of the debug syslog feature.


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


# 8c8fcd770ae49ca577c4b308549889c49f9f7807 05-May-2010 Axel Dörfler <axeld@pinc-software.de>

* Moved the addition of the basic debugger commands directly after the VM init.
* Separated the other stuff previously done in debug_init_post_vm() to the new
debug_init_post_settings().
* Removed superfluous status_t return codes - they are ignored, anyway, and if
there really is a show stopper in the init process, panicking would be the
thing one should do.


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


# 73f4184b7bc72d6524ab3be83fe1fcf223253158 29-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Unset sSyslogBuffer in all error cases in which we disable syslog output.
Spotted by Axel.


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


# 7b8344c61e9d7fa344ddbe80e513d249bd22db52 29-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

syslog_init_post_vm(): If the syslog is disabled, clear sSyslogBuffer. It is
already initialized in syslog_init(), if the debug syslog feature is enabled.
Since the area would never be created, the pointer becomes invalid, however,
and could cause a double fault on entering KDL.


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


# 22984248fac6bd40f97d07690df1d991b07414bf 26-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* kernel_debugger_loop(): Don't access sSyslogBuffer without checking whether
it is non-NULL first.
* syslog_init_post_vm(): Make sure the area for the debug syslog could actually
be created and fail otherwise.
* syslog_init_post_threads(): Fixed the cleanup on error. In case of a debug
syslog we need to delete the respective area instead of free()ing the
memory.


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


# c3676b54bfd2e06b73646d1846b2ab0272cb96e2 13-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added vm_debug_copy_page_memory() which copies memory from a potentially not
mapped page.
* debug_{mem,strl}cpy():
- Added "team" parameter for specifying the address space the address are
to be interpreted in.
- When the standard memcpy() (with fault handler) fails, fall back to
vm_debug_copy_page_memory().
* Added debug_is_debugged_team(): Predicate returning true, if the supplied
team_id refers to the same team debug_get_debugged_thread() belongs to.
* Added DebuggedThreadSetter class for scope-based debug_set_debugged_thread().
Made use of it in several debugger functions.
* print_demangled_call() (x86): Fixed unsafe memory access.

Allows KDL stack traces to work correctly again, even if the page daemon has
already unmapped the concerned pages.


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


# 345730da432ace48edbd1c238aeda0049fd6d27c 27-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed gcc 2 build.


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


# c81e68b2b24c5db151ab757eecc1c26ae824cbb5 27-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

"syslog" debugger command: By default it now ignores the output added to the
syslog in the current KDL session. Added option "-k" for the former behavior.


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


# a36919860353c0f198801594d0da40bbcc214048 19-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

kernel_debugger_loop(): We need to use a dedicated jmp_buf for the call of
arch_debug_stack_trace() through debug_call_with_fault_handler(), since the
one in the CPU structure can only be used for debug_{strl,mem}cpy(), which do
not potentially have nested debug_call_with_fault_handler() calls.


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


# cfefeee3f81bd3ed97243986cdd6bf710d16d0bc 18-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed arch_debug_save_registers() to take an arch-specific structure
arch_debug_registers instead.
* Call arch_debug_save_registers() on all CPUs when entering the kernel
debugger.
* Added debug_get_debug_registers() to return a specified CPU's saved
registers.
* x86:
- Replaced the previous arch_debug_save_registers() implementation. Disabled
getting the registers via the gdb interface for the time being.
- Fixed the "sc", "call", and "calling" commands to also work for threads
running on another CPU.


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


# 2d2b6b1f1ad316c58e6ea5bae74574eb6d15ef52 18-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Unconditionally print a stack trace when we entered KDL via panic().
* Print the initial stack trace safely, i.e. in a setjmp() + fault handler
environment.
* Disable pagination while executing the executing the panic() commands. This
way even when it is not possible to use the keyboard we get the full output.
* Added "panic_commands" kernel debugger command, to execute the panic()
commands again (with pagination enabled).


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


# 64c15cfc27bf54a5afab0a2c3cf1265f660571a3 17-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* sCurrentKernelDebuggerMessageArgs is no longer used directly. Whenever it
is passed to some v*printf(), we clone it first. This way we can use it
repeatedly. It worked only on certain architectures correctly before.
* Changed the panic() semantics a bit: When the format contains the
(hopefully unusual enough) string "@!" only the part before it is
considered to belong to the panic message. The part after it is interpreted
as a command line to be executed directly after entering KDL. This way it
is possible to provide helpful command invocations only developers somewhat
familiar with the subsystem might come up with. E.g.:
panic("dec_vnode_ref_count: called on busy vnode %p"
"@! vnode -p %p; mount _mount", vnode, vnode);


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


# 3fded334935806fe7fe60bb69200256efada6ccf 16-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Write kernel debugger output to the syslog as well. This should make life
for people who cannot capture serial output easier.
* The syslog sender thread waits with timeout now, so output added to the
syslog buffer without explicit notification is still written after a few
seconds at the latest.


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


# 28a2172c3f19a34e31ba20085148e5428544823a 11-Mar-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

kernel:
* The kernel syslog ring buffer is no longer emptied by the syslog sender
thread. Instead we only drop the oldest data from the buffer when we're
writing to it and there's not enough free space in it.
Advantages: We drop old data rather than the most recent data when the buffer
is full. The "syslog" KDL command has more data available now. So the odds
are that kernel syslog messages not written to disk yet are at least still
in the kernel buffer.
* Changed dprintf_no_syslog() semantics: Now it writes to the syslog, but
doesn't notify the syslog sender thread.

boot loader:
* Added the ring_buffer implementation and a dummy user_memcpy().
* bios_x86: Moved the syslog stuff from serial.{cpp,h} to debug.{cpp.h}.
* Moved the debug options from the "Select safe mode options" menu to a new
"Select debug options" menu.
* Added option "Enable debug syslog" to the new menu (ATM available on x86
only). It allocates a 1 MB in-memory buffer for the syslog for this session
in such a way that it can be accessed by the boot loader after a reset.
* Added item "Display syslog from previous session" to the new menu, doing
what its name suggests.


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


# cd4e946773834d7ea4d708c80ea571c95979f420 27-Feb-2010 Alexandre Deckner <alex@zappotek.com>

* Add a serial_input command to the kernel debugger, allows using serial input even when on-screen kdebug is enabled. Usefull for remote debugging. Please review/adjust.


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


# 8b64284b67874c55333961c2c0a535189ab77934 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Handle va_list copying correctly. Fixes PPC build.


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


# 0ea0681f5876299a11b4d2d7a9f4ba5f962c3b64 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the "message" command work correctly again. Broke it with my recent
changes.


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


# 98d2fc4b23b4476dc6aca08859dd5dbab8fb2d54 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Worked around "uninitialized variable" compiler warnings.


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


# 9e4ad0799b474f9707685090e8e7adf4f285eee6 20-Feb-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Pass the panic() format and args through to kernel_debugger_loop(), so that
the message doesn't get truncated.
* No longer print the "PANIC:" prefix when entering the kernel debugger via
kernel_debugger().


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


# bcc2c157a1c54f5169de1e7a3e32c49e92bbe0aa 13-Jan-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Refactored vm_translation_map:
* Pulled the physical page mapping functions out of vm_translation_map into
a new interface VMPhysicalPageMapper.
* Renamed vm_translation_map to VMTranslationMap and made it a proper C++
class. The functions in the operations vector have become methods.
* Added class GenericVMPhysicalPageMapper implementing VMPhysicalPageMapper
as far as possible (without actually writing new code).
* Adjusted the x86 and the PPC specifics accordingly (untested for the
latter). For the other architectures the build is, I'm afraid, seriously
broken.

The next steps will modify and extend the VMTranslationMap interface, so that
it will be possible to fix the bugs in vm_unmap_page[s]() and employ
architecture specific optimizations.


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


# 3ce26345338e484601eb0a6598414d22cb73c9cc 30-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Fixed the semantics of [v]snprintf(): If the buffer is not large enough,
the function shall nevertheless return the length of the string that would
be written, if the buffer were large enough.
Added a touch of C++ while doing that. :-)
* Fixed the instances in boot loader, kernel, and kernel modules where the
wrong semantics were expected. The majority of uses actually.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34826 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


# 13ce48d9224395297da82c6ddb7da97635d1e087 28-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* Moved dprintf_args()/debug_puts() guts to a new dedicated private function
debug_output().
* Added a second buffer to be used when interrupts are turned off, otherwise
dprintf_args() will now use a mutex guarded buffer to fill with vfprintf() -
the actual sending to the outputs still needs the spinlock, so things only
slightly improved.
* Moved private functions into the private section of the source file.


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


# 86860a0c076eef7372f741606bf2cbb662516a43 19-Oct-2009 Axel Dörfler <axeld@pinc-software.de>

* debug_printf() from userland actually only worked if serial debug output was
turned on. That should explain Bruno's problems to get debug output from an
accelerant. Thanks to Michael for the hint!


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


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

* Added an arch_debug_stack_trace() function that is called from the KDL loop
in case there aren't any KDL commands available yet.


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


# aa6f54aa24c3b1cfb4f8864dafd0e1a135fdb7f4 08-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Amended the {user,debug}_strlcpy() fix: Due to the strlcpy() semantics to
always return the source string length, we can't really prevent an overflow
of the source address.


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


# 8a71915a9df58aca2347b87f6ee4f7d60516786e 05-Oct-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Made the {debug,user}_{mem,strl}cpy() and user_memset() functions deal with
address overflows. Apparently at least the x86 string instructions generate
a general protection fault instead of a page fault, and we only use the fault
handler in the latter case (maybe we should change that, too). Fixes #4714.


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


# be51dd0f4c69e723129015002d33b68ef5e0b14a 30-Sep-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added debug_strlcpy() for use in the kernel debugger.


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


# 89294b508428bd4575a67bd179bceabce7619c08 26-Aug-2009 Axel Dörfler <axeld@pinc-software.de>

* Added option for enabling serial debug output.
* Moved device_manager/settings.cpp to debug/safemode_settings.cpp.
* Removed the somewhat hacky concatenation of kernel settings and safemode
settings in the boot loader. Instead, get_safemode_option() will now fall
back to the kernel settings, if it couldn't spot a setting in the safemode
settings. This allows for more control, and also makes enabling serial
debug output actually work (ie. overriding the kernel settings via safemode
options).
* Adjusted debug_init_post_vm(), and smp_init_other_cpus() to use
get_safemode_boolean().
* Therefore, I added safemode_settings.cpp to the boot loader as well.


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


# ea2abd110bd6a4518a954477562e2dd94a5fef9d 02-Aug-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed the ROUNDOWN macro to ROUNDDOWN. Also changed the implementation of
ROUNDUP to use '*' and '/' -- the compiler will optimize that for powers of
two anyway and this implementation works for other numbers as well.
* The thread::fault_handler use in C[++] code was broken with gcc 4. At least
when other functions were invoked. Trying to trick the compiler wasn't a
particularly good idea anyway, since the next compiler version could break
the trick again. So the general policy is to use the fault handlers only in
assembly code where we have full control. Changed that for x86 (save for the
vm86 mode, which has a similar mechanism), but not for the other
architectures.
* Introduced fault_handler, fault_handler_stack_pointer, and fault_jump_buffer
fields in the cpu_ent structure, which must be used instead of
thread::fault_handler in the kernel debugger. Consequently user_memcpy() must
not be used in the kernel debugger either. Introduced a debug_memcpy()
instead.
* Introduced debug_call_with_fault_handler() function which calls a function
in a setjmp() and fault handler context. The architecture specific backend
arch_debug_call_with_fault_handler() has only been implemented for x86 yet.
* Introduced debug_is_kernel_memory_accessible() for use in the kernel
debugger. It determines whether a range of memory can be accessed in the
way specified. The architecture specific back end
arch_vm_translation_map_is_kernel_page_accessible() has only been implemented
for x86 yet.
* Added arch_debug_unset_current_thread() (only implemented for x86) to unset
the current thread pointer in the kernel debugger. When entering the kernel
debugger we do some basic sanity checks of the currently set thread structure
and unset it, if they fail. This allows certain commands (most importantly
the stack trace command) to avoid accessing the thread structure.
* x86: When handling a double fault, we do now install a special handler for
page faults. This allows us to gracefully catch faulting commands, even if
e.g. the thread structure is toast.

We are now in much better shape to deal with double faults. Hopefully avoiding
the triple faults that some people have been experiencing on their hardware
and ideally even allowing to use the kernel debugger normally.


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


# 671a2442d93f46c5343ef34e01306befa760c16a 31-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

More work towards making our double fault handler less triple fault prone:
* SMP:
- Added smp_send_broadcast_ici_interrupts_disabled(), which is basically
equivalent to smp_send_broadcast_ici(), but is only called with interrupts
disabled and gets the CPU index, so it doesn't have to use
smp_get_current_cpu() (which dereferences the current thread).
- Added cpu index parameter to smp_intercpu_int_handler().
* x86:
- arch_int.c -> arch_int.cpp
- Set up an IDT per CPU. We were using a single IDT for all CPUs, but that
can't work, since we need different tasks for the double fault interrupt
vector.
- Set the per CPU double fault task gates correctly.
- Renamed set_intr_gate() to set_interrupt_gate and set_system_gate() to
set_trap_gate() and documented them a bit.
- Renamed double_fault_exception() x86_double_fault_exception() and fixed
it not to use smp_get_current_cpu(). Instead we have the new
x86_double_fault_get_cpu() that deducts the CPU index from the used stack.
- Fixed the double_fault interrupt handler: It no longer calls int_bottom to
avoid accessing the current thread.
* debug.cpp:
- Introduced explicit debug_double_fault() to enter the kernel debugger from
a double fault handler.
- Avoid using smp_get_current_cpu().
- Don't use kprintf() before sDebuggerOnCPU is set. Otherwise
acquire_spinlock() is invoked by arch_debug_serial_puts().

Things look a bit better when the current thread pointer is broken -- we run
into kernel_debugger_loop() and successfully print the "Welcome to KDL"
message -- but we still dereference the thread pointer afterwards, so that we
don't get a usable kernel debugger yet.


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


# 213d2d8f9dc09656dd2c20cfa36f96d6d53a4f07 29-Jul-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Added syscall _kern_kernel_debugger() to enter the kernel debugger.


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


# ebc89d1766bf5f87daf0438e9e9dd1b4ff7ffe92 28-Jul-2009 Michael Lotz <mmlr@mlotz.ch>

Remove extra newline in debug command description which caused empty lines in
the KDL help to be printed.


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


# c755ecfe9626d075350b9d8e9fd4b3a025d4f3e8 20-Jul-2009 Axel Dörfler <axeld@pinc-software.de>

* Added an emergency key mechanism to the kernel, inspired by Jan Klötzke's
patch from about a year ago (I couldn't use any code of his yet, though,
but there are a few things left). The emergency keys are triggered by
pressing Alt-SysReq + key.
* By default, only Alt-SysReq+'d' is used as a means to deliberately enter
the kernel debugger. F12 belongs to userland again, now :-)
* Debugger add-ons now have another optional method to implement their own
emergency keys - 'd' for the debugger cannot be overridden, though.
* The mechanism can be turned off via a new kernel setting, so it's not that
easy anymore to "crash" Haiku if you don't want to.
* Right now, the PS/2 driver, and the pre-input_server in-kernel debugger
keyboard mini-driver support this, USB not yet.
* Minor cleanup.


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


# cf2a26ea962ac658872caa62ac5cebe15d88c0f2 03-Jun-2009 Axel Dörfler <axeld@pinc-software.de>

* Don't overwrite the history buffer when you issue the same command more than
once.


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


# 360d4974b96a6821dbf4b31e0662bfcd31f713bc 02-Jun-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Replaced the temporary storage used in the kernel debug command parser. We now
have a simple dedicated heap for the kernel debugger with stacked allocation
pools (deleting a pool frees all memory allocated in it). The heap should
eventually be used for all commands that need temporary storage too large for
the stack instead of each using its own static buffer.


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


# 48b0c6f93ad3ba41103e59e3008b8ac6247e8f28 16-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

debug_trap_cpu_in_kdl(): If the CPU running the kernel debugger exited and
re-entered it fast enough, we wouldn't leave the loop and thus cause a
deadlock, since we wouldn't process the ICI message telling us to halt. We do
now call smp_intercpu_int_handler() in the loop and guard the function from
being re-entered. This also has the advantage that we can execute code on all
CPUs in the kernel debugger, if we have to.


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


# 73b118b6332cb8f9d0558f34d240bc6d7726f5b1 04-Apr-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

bonefish + mmlr:
Check gKernelStartup to avoid sending ICI when entering the kernel debugger
(after ICI is enabled). Moreover it's more obvious than to use that instead
of relying on ICIs not being enabled.


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


# 6eba063647cc4ff5aa863e1b5dc5093c22a3acb0 22-Feb-2009 Michael Lotz <mmlr@mlotz.ch>

* Added simplified possibility to schedule UHCI transfers from within KDL.
* Added debugger commands to resolve usb_ids to pipes.
* Adjusted the physical memory allocator to be usable in a slimmed down mode
when running inside the kernel debugger.
* Implemented USB keyboard support for KDL through a kernel debugger add-on.
* Added kgetc() and made use of it where previously individual methods were used
to ensure that reading characters always goes through the kernel debugger
add-ons and the other methods.

This has some preconditions to meet though:
1) The keyboard must be in the boot protocol (currently the case but needs to
be revisited once we have a full usb_hid).
2) The keyboard must be attached to a UHCI root port (i.e. not use EHCI or OHCI,
also not through hubs unless those are USB 1.1).
3) the usb_hid driver has to be opened for this to work. This means that for the
time between initializing USB and when usb_hid is opened by the input_server
there is no keyboard support.

Also note that this has no way of detecting hot-plug, meaning that you can't
re-attach your USB keyboard from the hub to the root port once in KDL.

On the bright side of things, since this is a non-destructive mechanism it is
possible to enter and leave KDL without loosing the USB state.

Tested OK in QEMU, not tested on real hardware yet, will see in a few minutes.


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


# 2187c4988aa909f829bffcd45044606c1fce854b 02-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Not sure how this happened.


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


# 74c05b1d3c8390d31ff313e90370c49fa3fbd18f 02-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Accidently forgot to fix the typo that Adrian pointed out in his patch to
#2919 (OMG :-)).
* While I was at it, I also cleaned up some style inconsistencies.


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


# f9e72b6e5b804fed4c8eddc6634f49822d951b73 01-Jan-2009 Axel Dörfler <axeld@pinc-software.de>

* Small variation of Adrian's patch to fix bug #2919, ie. re-enable paging
and colors for the on-screen debug output when leaving KDL. Thanks, Adrian!


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


# cca9f051149aa589896bab6f256fb6425d27967b 30-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* debug_demangle_symbol() did not set _isObjectMethod when there was no
demangle module (yet). This could cause a read fault in x86's
print_demangled_call() (as it assumed there must be a ':' when this is true).


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


# 204b1f011bf89df3129b35b05c862830406cc2b5 22-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added boolean "syslogOutput" parameter to flush_pending_repeats() so
that dprintf_no_syslog() can avoid sending something to the syslog.


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


# 18ad0f1b8a6538010b2a62668e4ed34c28ab0280 22-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a new kernel setting "syslog_buffer_size" to change the size of the
internal syslog ring buffer.


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


# 8d805b68a5f1398ebccb5ee38ac0f5de99a2aa55 22-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Cleanup.


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


# 210b7fe0133b18e44672291b260003e5c466f88d 22-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Applied patch by Adrian Panasiuk (Adek336) to fix the syslog output to insert
the <DROP> marker at the place data was dropped, not somewhere else. See
ticket #156; this might already fix this bug.
* Minor cleanup.


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


# 7ab39de9895775d10669a1a85ce3ff60b1ca7b55 17-Oct-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Removed unused SMP_MSG_RESCHEDULE ICI message.
* Introduced flag "invoke_scheduler" in the per CPU structure. It is
evaluated in hardware_interrupt() (x86 only ATM).
* Introduced SMP_MSG_RESCHEDULE_IF_IDLE message, which enters the
scheduler when the CPU currently runs an idle thread.
* Don't do dprintf() "CPU x halted!" when handling a SMP_MSG_CPU_HALT
ICI message. It uses nested spinlocks and could thus potentially
deadlock itself (acquire_spinlock() processes ICI messages, so it
could already hold one of the locks). This is a pretty likely scenario
on machines with more than two CPUs, but is also possible when the
panic()ing thread holds the threads spinlock. Probably fixes #2572.
* Reworked the way the kernel debugger is entered and added a "cpu"
command that allows switching the CPU once in KDL. It is thus possible
to get a stack trace of the thread not on the panic()ing CPU.
* When a thread is added to the run queue, we do now check, if another
CPU is idle and ask it to reschedule, if it is. Before this change, the
CPU was continuing to idle until the quantum of the idle thread
expired. Speeds up the libbe.so build about 8% on my machine (haven't
tested the full Haiku image build yet).
* When spinlock debugging is enabled (DEBUG_SPINLOCKS) we also record
the spinlock acquirer on non-smp machines. Added "spinlock" debugger
command to get the info.
* Added debugger commands "ici" and "ici_message", printing info on
pending ICI message respectively on a given one.
* Process not only a single ICI message in acquire_spinlock() and other
places, but all pending ones.
* Also process ICI messages when waiting for a free one -- avoids a
potential deadlock.
* Mask out non-existing CPUs in send_multicast_ici(). panic() instead of
just returning when there's no target CPU left.


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


# ddecb4a7da1e8c56af7f319cbb26f5e47e65f6f6 12-Oct-2008 Axel Dörfler <axeld@pinc-software.de>

* Changed the way the demangle functionality works: instead of having a kernel
debugger add-on set a demangle hook, all modules under debugger/demangle/ are
now considered demangle modules.
* Added another function to the demangle module interface that gives you access
to the arguments.
* Implemented a demangling module for GCC2.
* The older demangling module is now called "gcc3+", but doesn't support
getting the arguments yet.
* The "call" KDL command is now using demangling to automatically show you
the arguments of a call from a stack crawl.
* Minor cleanup.


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


# ca7cb625b9769be2657365e2137197bdc3a9692d 17-Sep-2008 Axel Dörfler <axeld@pinc-software.de>

* Implemented a (private for now) get_system_info_etc() call, that can retrieve
various system information.
* Implemented retrieving some VM stats via this call.
* The VM now maintains a page fault counter, and sets system_info::page_faults
accordingly.
* Added a (pretty simple) "vmstat" command line app.
* Minor cleanup.


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


# 290e3dd2281d8484acd712bf51137978e7836ecd 22-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Introduced the notion of a currently debugged thread in the kernel
debugger and added respective getter/setter methods
debug_{get,set}_debugged_thread(). By default the currently debugged
thread is the thread that dropped into the kernel debugger, but commands
like "in_context" can change it.


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


# 46ec23016212f35b99bc1ba02b7421eb287033e1 12-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

When in the kernel debugger we do now record the relevant information
(fault address, pc, read/write) when a page fault occurs, and print them
in case this caused the termination of a debugger command.


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


# 40d9ff3ae478875d1e0c65d79ccd74944ee616c1 03-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed warning.


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


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

* thread_preboot_init_percpu() sets the current thread pointer with a mostly
empty thread structure. This causes the thread::team pointer to be NULL
during the early boot process, but our kernel debugger didn't like that.


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


# 0b46f622d157d4313672dcd6220fbec0749e268b 30-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Made struct ring_buffer public (within the kernel).
* Added "syslog" command that dumps the contents of the syslog ring buffer into
KDL. Use the '-n' option to only show what hasn't been sent to the syslog
daemon yet.
* When entering the kernel debugger, the current thread ID and name are also
printed (not only the current CPU).


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


# 8881176ff3ff0a868ebf53e25858864153edfc9f 23-Jul-2008 François Revol <revol@free.fr>

A module that hooks into the debugger to provide it with a demangle() so at least when using C++ in the kernel stack crawls are meaningful.
It does its job by using part of libsupc++, with fake malloc and friends to make sure it won't double fault.
Works here, but cp-demangle must be extracted by hand from the lib, can't get the rule to work as I want, Ingo ?
Maybe using it directly without malloc hack would be ok with 16KB buffer, but I'm not sure of that.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26581 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


# 2b31f85c9edee0925ceb342e8b73339b0032df34 05-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Fix two warnings caused by previous commit.

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


# a9fbc5482c03761f113b5ba6c8bfe0c2b12704c1 05-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Give the debugger add-ons a chance when reading input characters. They already
got a debugger_getchar hook, it just wasn't used yet. Not that there would be
any debugger add-on implementing that hook currently...

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


# 9223644a022f1e7d61eb1323a89f586e732075a9 04-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Add a welcome message including the revision number when initializing the
syslog so syslogs always contain the revision number too (as does serial
output).
This is only necessary because the early part of the serial output (that
contains the revision number) does not make it into the syslog. So fixing that
might be the better way.

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


# 992330f54bde301ba68449ecfa06840c9d5e024a 03-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

_user_debug_output() used kputs() and thus wouldn't print anything
anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25783 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


# 73aa393d737b25eb29a5200d5f6e6340000affee 31-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced pipes in the kernel debugger. The syntax is similar to
pipes in the shell, though the semantics is a little different: The
second command is invoked whenever the first command has written a
complete line. The line is passed as last argument to the second
command. The new command flag B_KDEBUG_PIPE_FINAL_RERUN causes the
second command to be invoked again (with NULL argument) after the
first command is done.
* Added kprintf_unfiltered() and kputs_unfiltered() which bypass the
pipe mechanism and directly print to the bluescreen/serial output.
* Moved most commands from debug.cpp to the new
debug_builtin_commands.cpp.
* B_KDEBUG_DONT_PARSE_ARGUMENTS commands don't get an argument anymore,
if it would consist of white space only.
* Added new debugger command return value B_KDEBUG_ERROR, which
indicates that executing the command failed. This return code will
abort a complete pipe.
* Since debugger commands can nest (i.e. one command can invoke another
one) the setjmp()/longjmp() mechanism to restore the stack after a
page fault in a command needs more than one jump buffer.
* Added abort_debugger_command(), which longjmp()s out of the currently
executed command. This will also abort the current pipe.
* When pagination is enabled pressing "a" will abort the running command
(as opposed to "q" which only disables the blue screen output, but
lets the command continue).
* Added debugger commands:
- "grep" which can be used to filter output by pattern. Removed the
"filter" command and the underlying mechanism that did that before.
- "head" which prints only the first lines of output of another
command.
- "wc" counts lines, words, and characters of another command's
output.


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


# a1587d16d511ce0b3d7bdec2db34a626150578f7 28-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Ctrl-L clears the KDL screen.


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


# dfa611bb04b180563729b0a7fbdc2f05ef04a03f 26-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added paranoia checks debug facility. It helps checking that data in
memory haven't changed behind one's back.


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


# e77b684f9e092815b240e53764001f44d62d1084 26-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added very basic possibility to set a filter for all KDL command
output using the new "filter" command.


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


# a886f802fca0b7d6c6e2bb4b790d8865c1807bff 20-Mar-2008 Axel Dörfler <axeld@pinc-software.de>

* Added debug_screen_output_enabled() function.
* The boot splash code now checks wether debug screen output is enabled or not
using the above function.
* The boot splash code no longer maps it's own copy of the frame buffer, instead,
it will use the boot item feature as the VESA driver does. Also removed the
lock, as that's not needed at all.
* Renamed splash.cpp to boot_splash.cpp, and boot/splash.h to boot_splash.h
(it's not part of the boot loader, but the kernel).
* Removed dead code from boot_splash.cpp, added license. Replaced license
header in boot_splash.h to a style guide conforming one.


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


# ff7eefe8e3df3af845f073e8cae6ce5d86ab4d85 21-Feb-2008 François Revol <revol@free.fr>

Call debugger_puts hooks on modules when serial debug output is enabled (modules themselves must reject loading if they don't find mymodule_debug_output in kernel settings).


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


# d63cbbe2dfb77f61dad6462c5bc0e0fe6623ea80 17-Feb-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added "error" debugger command to print the error string for a given
numeric error code.


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


# f87d72d7880e6124b0c5f7f09de2cf5e19923d1a 03-Feb-2008 Michael Lotz <mmlr@mlotz.ch>

Introduce a B_NO_LOCK_VECTOR flag to be used with install_io_interrupt_handler().
When specified it desigantes that the interrupt handler should not lock the
vector with a spinlock when executing the installed interrupt handlers. This
is necessary to allow the same interrupt vector to be handled in parallel on
different CPUs. And it is required for the CPU halt to work synchronously when
there is more than one AP CPU. Though the acquire_spinlock() should cause IPIs
to be processed, only this fixed the SMP_MSG_FLAG_SYNC problem for me.
Not locking is safe as long as it is guaranteed that no interrupt handler is
registered or removed while the interrupt handler is running. We can guarantee
this for the SMP interrupt handlers we install in arch_smp_init() as they are
never uninstalled. Probably this flag should be made private though.
Restored the SMP_MSG_FLAG_SYNC when entering the kernel debugger.

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


# 3cec75dc33dd1cda148e057d91b48989f6f3a0c1 30-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Debugger modules now have two methods: enter_debugger() and exit_debugger().
* The kernel now opens up to 8 debugger modules (and puts them into an array;
maybe we'll want to switch to a doubly linked list when there is the need).
* Implemented an example debugger module that prints a stack trace of the
current thread when the kernel debugger is entered (not included in the
image).


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


# 7f5698963f4407358856d270a66acf6fc37a5cd9 26-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

Add concurency handling when entering the kernel debugger. Previously there
was a race condition when more than one CPU would enter the debugger at the
same time (or rather before one CPU could stop all the others). We now use the
inDebugger variable to tell if someone is already in the debugger and then
only process inter CPU messages and retry entering the debugger.
Since sending the synchronous broadcast most of the time hung over here with
SMP enabled I removed the synchronous flag and added a simple spin to give the
other CPUs a chance to process the halt request. Added comments that explain
the reasons and a ToDo to revert to synchronous delivery once we fixed the
problem. The kernel debugger is now usable on my quad core.

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


# 325b88a661bd51702cf70ec96dc1974de429b258 21-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced debugger command flag B_KDEBUG_DONT_PARSE_ARGUMENTS.
For commands with this flag set, the parser won't parse the
arguments provided (it will only check for matching parentheses and
brackets), but will pass the unparsed argument list string to the
command instead.
* Set the new flag for the "expr" command, so one doesn't have to quote
the expression to evaluate anymore (or put it in parentheses).
* Fixed tokenizing of quoted and unquoted strings in expression mode.


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


# 635aca08c5d0c7890e8a88a66a1b441ef70d4965 21-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Removed unused variable.


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


# 902425896d6b7f001f68d54708884e2727b837fc 20-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Made kputs() available in the kernel and used it for printing debugger
command usage texts, which can be too long for kprintf().


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


# 19b468ea247213ddf51ab015a7969e8b9bf98aa8 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Cursor up/down stop before empty (i.e. unused) history lines, now.
* Added support for page up/down (works like in bash).


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


# e6a8dfa805352a70636d964b29b38f3022ffc083 17-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

The usage string directly printed by print_debugger_command() and
invoke_debugger_command() is now automatically preceded by
"usage: <command name>", so the string passed to
add_debugger_command_etc() shouldn't contain it anymore.


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


# 8a90d12e268b539b26b461a9e4e2560acdf91e2b 16-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added add_debugger_command_etc() which is similar to
add_debugger_command(), but additionally takes parameters "usage"
and "flags".
* Added add_debugger_command_alias() which creates another name for an
existing command.
* Added print_debugger_command_usage() to print a command's usage.
* invoke_debugger_command() intercepts invocations with "--help" and
prints the command's usage text, if it is known. If unknown, the
command will be called normally.
* Made use of the new functions in debug.cpp.


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


# 18397925246b82cd36b8211461c6924229955839 16-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Change parse_expression() return value from uint32 to uint64.


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


# b9074efcb78d914f902047cc8410532d42ce7bbb 16-Jan-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the "vnodes" KDL command when called without any arguments.
* Fixed the usage text of the "help" KDL command.
* Made the "ambiguous command" warning shorter, so that it will still fit in
the exception buffer.


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


# 15f1e19781af3b462c4542cb19df687bb9aca6c0 15-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added support for the "--help" argument to some debugger commands.
* The kernel debugger does now define some temporary variables when
entered (current thread and team, etc.).


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


# 3b4fa1664e6fb9ba781ee509bf725774937eeaeb 15-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Implemented parse_expression(). The back-end is an expression parser
that is a little more powerful than BeOS'. It features:
- Persistent and temporary uint64 variables. The former kind is set
only by the user. The latter (those prefixed "_") can be set
automatically by commands, thus e.g. making it easier to access
members of a dumped structure. They are unset when the next command
is invoked. The special temporary variable "_" is defined as a
command's return value.
- Expressions can contain nested command invocations using brackets
("[ ... ]").
- Command lines are parsed by the expression parser, too. They can
contain command invocations (in brackets) and expressions (in
parentheses).
* Added debugger commands:
- expr: Evaluates the given expression and prints the result.
- unset: Undefines a variable.
- vars: Prints the values of all defined variables.
* Moved debugger command code into its own source file.



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


# 07b8a5de222b50e841e1e63cbe1bce09ae2a09d1 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Sort the registered commands by name when entering KDL.
* Don't execute a command anymore, if the given prefix is ambiguous.
* Added tab completion for commands.
* Added on-the-fly help while typing a command line. It is triggered
by pressing tab at a position after the space following the command.
It is implemented by calling the command with argument "--help", which
doesn't work yet with most commands, but some already print their
usage in this case.


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


# ea144d4b8b75e6696905ce1c2920a92c7f1df6cd 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Use C linkage for kgets(). Should fix hangman.


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


# 945a060042f4e584d7fc81ed0722d4bdc756bada 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added "message" debugger command to reprint the message printed when
entering KDL.


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


# 46a15bd6ea83261e531996ddbef9a69a39528404 13-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for line editing in KDL.


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


# 9d2cde71830a0ed48ced18614cfcc62af201e84b 14-Jan-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

debug.c -> debug.cpp


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