From 7ffc4e778223a027c8247dc57b4917d00e019f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 29 Mar 2005 15:31:09 +0000 Subject: [PATCH] Enlarged buffer for _sPrintf() from 256 to 1024 bytes per call. Minor cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12118 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/os/debug.c | 37 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/kernel/libroot/os/debug.c b/src/kernel/libroot/os/debug.c index 7cb242eb70..9d076395d0 100644 --- a/src/kernel/libroot/os/debug.c +++ b/src/kernel/libroot/os/debug.c @@ -1,11 +1,12 @@ -/* -** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ +/* + * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ #include #include +#include #include "syscalls.h" #include @@ -104,6 +105,7 @@ debug_thread(thread_id thread) * their debugged teams via fork() and want the child to wait till they have * installed themselves as team debugger before continuing with exec*(). */ + void wait_for_debugger(void) { @@ -139,6 +141,7 @@ get_debug_message_string(debug_debugger_message message, char *buffer, (uint32)message, buffer, bufferSize); } + void get_debug_exception_string(debug_exception_type exception, char *buffer, int32 bufferSize) @@ -148,11 +151,12 @@ get_debug_exception_string(debug_exception_type exception, char *buffer, } -// relating to Debug.h -// TODO: verify these functions -// TODO: add implementations for printfs +// #pragma mark - +// Debug.h functions + +// TODO: verify these functions +// TODO: add implementations for printfs? -#include bool _rtDebugFlag = false; @@ -178,8 +182,6 @@ _debugPrintf(const char *fmt, ...) va_list ap; int ret; - // TODO : we need locking here - va_start(ap, fmt); ret = vfprintf(stdout, fmt, ap); va_end(ap); @@ -191,22 +193,18 @@ _debugPrintf(const char *fmt, ...) int _sPrintf(const char *fmt, ...) { + char buffer[1024]; va_list ap; int ret; - char buffer[256]; // seems to be the size used in R5 - // TODO : we need locking here - va_start(ap, fmt); - ret = vsnprintf(buffer, 256, fmt, ap); + ret = vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); - if (ret < 0) - return ret; + if (ret >= 0) + _kern_debug_output(buffer); - _kern_debug_output(buffer); - - return 0; + return ret; } @@ -233,6 +231,7 @@ _debuggerAssert(const char * file, int line, char * message) } // TODO: Remove. Temporary debug helper. +// (accidently these are more or less the same as _sPrintf()) void debug_printf(const char *format, ...)