summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-09 05:08:54 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-02-09 05:08:54 +0000
commite75bb4af0f07342a7d6c11cde0340931ba5ddb82 (patch)
tree8ccf4808a27a27a8a563fd116a98d67a63c38f8b /TAO/tao
parent9a3180523bd5768572e5f8085ad709c078cd3cfd (diff)
downloadATCD-e75bb4af0f07342a7d6c11cde0340931ba5ddb82.tar.gz
ChangeLogTag:Mon Feb 8 17:09:03 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/ORB_Core.cpp3
-rw-r--r--TAO/tao/Stub.cpp8
-rw-r--r--TAO/tao/debug.cpp351
-rw-r--r--TAO/tao/debug.h76
-rw-r--r--TAO/tao/deep_free.cpp8
5 files changed, 10 insertions, 436 deletions
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 6a94f83c377..a8c175f2dd6 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -431,7 +431,8 @@ TAO_ORB_Core::init (int &argc, char *argv[])
TAO_debug_level = ACE_OS::atoi (value);
if (TAO_debug_level <= 0)
TAO_debug_level = 1;
- dmsg1 ("TAO_debug_level == %d", TAO_debug_level);
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_debug_level == %d", TAO_debug_level));
}
}
#endif /* DEBUG */
diff --git a/TAO/tao/Stub.cpp b/TAO/tao/Stub.cpp
index 5d5f321c006..7493b052001 100644
--- a/TAO/tao/Stub.cpp
+++ b/TAO/tao/Stub.cpp
@@ -681,7 +681,7 @@ STUB_Object::do_dynamic_call (const char *opname,
{
CORBA::TypeCode_var tcp = result->value ()->type ();
size_t size = tcp->size (env);
- dexc (env, "do_dynamic_call, get result size");
+ env.print_exception ("do_dynamic_call, get result size");
if (size != 0)
{
@@ -689,7 +689,7 @@ STUB_Object::do_dynamic_call (const char *opname,
result->value ()->replace (tcp.in (), ptr,
1, env);
- dexc (env, "do_dynamic_call, set result mem");
+ env.print_exception ("do_dynamic_call, set result mem");
}
}
#endif
@@ -749,7 +749,7 @@ STUB_Object::do_dynamic_call (const char *opname,
{
CORBA::TypeCode_var tcp = value->value ()->type ();
size_t size = tcp->size (env);
- dexc (env, "do_dynamic_call, get param size");
+ env.print_exception ("do_dynamic_call, get param size");
if (size != 0)
{
@@ -757,7 +757,7 @@ STUB_Object::do_dynamic_call (const char *opname,
value->value ()->replace (tcp.in (), ptr,
1, env);
- dexc (env, "do_dynamic_call, set result mem");
+ env.print_exception ("do_dynamic_call, set result mem");
}
}
#endif
diff --git a/TAO/tao/debug.cpp b/TAO/tao/debug.cpp
index 8777b222ba1..1e88b85c576 100644
--- a/TAO/tao/debug.cpp
+++ b/TAO/tao/debug.cpp
@@ -14,360 +14,9 @@
// XXX on Windows, make it always use OutputDebugString () instead of stdio.
#include "tao/debug.h"
-#include "tao/Environment.h"
-#include "tao/Exception.h"
ACE_RCSID(tao, debug, "$Id$")
-#if !defined (ACE_HAS_PTHREADS) && !defined (ACE_HAS_DCE_DRAFT4_THREADS)
- // _POSIX_THREAD_SAFE_FUNCTIONS implied
-# define flockfile(f)
-# define funlockfile(f)
-#endif /* ! ACE_HAS_PTHREADS && ! ACE_HAS_DCE_DRAFT4_THREADS */
-
TAO_Export u_int TAO_debug_level = 0;
TAO_Export u_int TAO_orbdebug = 0;
TAO_Export char *TAO_debug_filter = "l";
-
-static FILE *debug_stream = stderr;
-
-// Dummy function to get rid of "'debug_stream' defined but not used"
-// warning.
-
-FILE *
-use_debug_stream_to_get_rid_of_warning (void)
-{
- return debug_stream;
-}
-
-// The rest of this file is not needed without -DDEBUG, and unless the
-// vfprintf () call is available it can't work.
-//
-// NOTE: some older platforms have "_doprnt" that provides much the
-// same functionality ... this could be modified to use that routine
-// where it's available.
-
-#if defined (DEBUG) && defined (HAVE_VPRINTF)
-
-// Support for prefixing debug messages with process ID and, if
-// threaded, the thread ID. This lets messages from different sources
-// be safely disentangled, even though they're interspersed in the
-// output stream.
-static pid_t my_pid;
-
-#if defined (unix) || defined (VXWORKS)
-
-#if defined (ACE_HAS_PTHREADS)
-
-// Use POSIX initialization support to initialize just once.
-
-static pthread_once_t debug_init = PTHREAD_ONCE_INIT;
-
-#define setup() pthread_once (&debug_init, setup_once)
-
-static void
-setup_once ()
-{
- my_pid = ACE_OS::getpid ();
-}
-
-static void
-emit_prefix (FILE *stream)
-{
- pthread_t self = pthread_self ();
-
- ACE_OS::fprintf (stream, "p%ld t%ld: ", (long) my_pid, (long) self);
-}
-
-// !defined (ACE_HAS_PTHREADS)
-#else
-
-// Without threads, guard initialization so it can be repeated,
-// and don't emit the thread ID in the messages.
-
-static void
-setup (void)
-{
- if (my_pid == 0)
- my_pid = ACE_OS::getpid ();
-
-// Any other setup goes here.
-}
-
-#define emit_prefix(stream) fprintf (stream, "p%ld: ", (long) my_pid)
-#endif /* !ACE_HAS_PTHREADS */
-
-#elif defined (_WIN32)
-
-// Not all implementations of Win32 have threads, but in any case this
-// code doesn't yet support Win32 threads.
-
-static void
-setup (void)
-{
- if (my_pid == 0)
- my_pid = GetCurrentProcessId ();
- // Any other setup goes here.
-}
-
-#define emit_prefix(stream) fprintf (stream, "p%ld: ", my_pid)
-
-#else
-# error "unknown OS platform"
-#endif /* OS-specific initialization */
-
-void TAO_Export
-dmsg_filter (const char *categories,
- const char *fmt,
- ...)
-{
- const char *cp = 0;
-
- if (!categories || !TAO_debug_filter)
- return;
- else if (*TAO_debug_filter != '*')
- { // filter with "*" --> all pass
- for (cp = categories; *cp; cp++)
- if (strchr (TAO_debug_filter, *cp) != 0)
- break;
-
- if (!*cp)
- return;
- }
-
- va_list ap;
-
- setup ();
- flockfile (debug_stream);
- emit_prefix (debug_stream);
-
- switch (*cp)
- { // standard categories
- case 'l':
- ACE_OS::fprintf (debug_stream, " (LEAK) ");
- break;
- }
-
- va_start (ap, fmt);
- vfprintf (debug_stream, fmt, ap);
- va_end (ap);
-
- if (strchr (fmt, '\n') == 0)
- ACE_OS::fprintf (debug_stream, "\n");
-
- funlockfile (debug_stream);
-
-#if defined (_WIN32)
- OutputDebugString ("called dmsg_filter\n"); // experimental
-#endif /* _WIN32 */
-}
-
-void TAO_Export
-dmsg_filter (u_int level,
- const char *fmt,
- ...)
-{
- if (level > TAO_debug_level)
- return;
-
- va_list ap;
-
- setup ();
- flockfile (debug_stream);
- emit_prefix (debug_stream);
- va_start (ap, fmt);
- vfprintf (debug_stream, fmt, ap);
- va_end (ap);
- if (strchr (fmt, '\n') == 0)
- ACE_OS::fprintf (debug_stream, "\n");
- funlockfile (debug_stream);
-
-#if defined (_WIN32)
- OutputDebugString ("called dmsg_filter\n"); // experimental
-#endif /* _WIN32 */
-}
-
-void TAO_Export
-dmsg_v (const char *fmt,
- ...)
-{
- va_list ap;
-
- setup ();
- flockfile (debug_stream);
- emit_prefix (debug_stream);
- va_start (ap, fmt);
- vfprintf (debug_stream, fmt, ap);
- va_end (ap);
- if (strchr (fmt, '\n') == 0)
- ACE_OS::fprintf (debug_stream, "\n");
- funlockfile (debug_stream);
-
-#if defined (_WIN32)
- OutputDebugString ("called dmsg_v\n"); // experimental
-#endif /* _WIN32 */
-}
-
-void TAO_Export
-_dmsg_x (CORBA::Environment &env,
- const char *info)
-{
- const CORBA::Exception *ex = env.exception ();
-
- setup ();
- flockfile (debug_stream);
- emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream,
- "exception '%s' at '%s'\n",
- ex->_id (),
- info);
-
- if (env.exception_type () == CORBA::SYSTEM_EXCEPTION)
- {
- CORBA::SystemException *sysex = (CORBA::SystemException *) ex;
-
- emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream,
- "minor %#lx, completed %#lx\n",
- sysex->minor (),
- (long) sysex->completed ());
- }
- funlockfile (debug_stream);
-
-#if defined (_WIN32)
- OutputDebugString ("called _dmsg_x\n"); // experimental
-#endif /* _WIN32 */
-}
-
-void TAO_Export
-dmsg_opaque (char *label,
- u_char *buffer,
- u_long len)
-{
- setup ();
- flockfile (debug_stream);
- emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream,
- "%s ",
- label);
-
- if (len == 0 || !buffer)
- ACE_OS::fprintf (debug_stream,
- " (empty)");
- else if (len > UINT_MAX)
- ACE_OS::fprintf (debug_stream,
- "Oversized opaque data: %ld bytes",
- len);
- else
- {
- u_int i;
-
- for (i = 0; i < len; i++)
- if (!isprint (buffer [i]))
- break;
-
- if (i < len)
- {
- if (len >= 20)
- ACE_OS::fprintf (debug_stream,
- "%ld bytes binary data",
- len);
- else
- {
- ACE_OS::fprintf (debug_stream,
- "binary data {%2X", buffer [0]);
- for (i = 1; i < len; i++)
- ACE_OS::fprintf (debug_stream,
- ", %2x",
- buffer [i]);
- ACE_OS::fprintf (debug_stream,
- "}");
- }
- }
- else
- {
- if (len >= 50)
- ACE_OS::fprintf (debug_stream,
- "%ld bytes string data",
- len);
- else
- ACE_OS::fprintf (debug_stream,
- "string data { \"%.*s\" }",
- (int) len,
- buffer);
- }
- }
- ACE_OS::fprintf (debug_stream,
- "\n");
- funlockfile (debug_stream);
-
-#if defined (_WIN32)
- OutputDebugString ("called dmsg_opaque\n"); // experimental
-#endif /* _WIN32 */
-}
-
-void TAO_Export
-dmsg_opaque_full (char *label,
- const u_char *buffer,
- u_long len)
-{
- setup ();
- flockfile (debug_stream);
-
- emit_prefix (debug_stream);
- ACE_OS::fprintf (debug_stream,
- "%s ",
- label);
-
- if (len == 0 || !buffer)
- ACE_OS::fprintf (debug_stream,
- " (empty)");
- else
- {
- u_int i;
-
- for (i = 0; i < len; i++)
- {
- if (i == 0)
- ACE_OS::fprintf (debug_stream,
- "\nhex: ");
- else if ((i % 32) == 0)
- ACE_OS::fprintf (debug_stream,
- "\n ");
- else if ((i % 4) == 0)
- ACE_OS::fprintf (debug_stream,
- " ");
- ACE_OS::fprintf (debug_stream,
- "%02x",
- buffer[i]);
- }
-
- for (i = 0; i < len; i++)
- {
- if (i == 0)
- ACE_OS::fprintf (debug_stream,
- "\nchars: ");
- else if ((i % 32) == 0)
- ACE_OS::fprintf (debug_stream,
- "\n ");
- else if ((i % 4) == 0)
- ACE_OS::fprintf (debug_stream,
- " ");
- ACE_OS::fprintf (debug_stream, "%c ",
- (isprint (buffer[i]) ? buffer[i] : '?'));
-
- }
-
- ACE_OS::fprintf (debug_stream,
- "\n");
- }
- ACE_OS::fprintf (debug_stream,
- "\n");
- funlockfile (debug_stream);
-
-#if defined (_WIN32)
- OutputDebugString ("called dmsg_opaque_full\n"); // experimental
-#endif /* _WIN32 */
-}
-
-#endif /* DEBUG && HAVE_VPRINTF */
diff --git a/TAO/tao/debug.h b/TAO/tao/debug.h
index 93e76e4720e..27f1fc3fda6 100644
--- a/TAO/tao/debug.h
+++ b/TAO/tao/debug.h
@@ -38,80 +38,4 @@ extern TAO_Export u_int TAO_orbdebug;
// set by getopt
extern TAO_Export char *TAO_debug_filter;
-// These are just simple 0, 1, and 2 argument messages that will
-// appear when debugging's enabled, regardless of category. They also
-// just compile out painlessly.
-
-#if defined (DEBUG)
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-
-// 1, 2, 3 argument messages -- generic
-#define dmsg(s) { if (TAO_debug_level) dmsg_v (s); }
-#define dmsg1(s,a1) { if (TAO_debug_level) dmsg_v (s, a1); }
-#define dmsg2(s,a1,a2) { if (TAO_debug_level) dmsg_v (s, a1, a2); }
-
-// dump CORBA_Exception, if any, with id tag
-#define dexc(env,s) { if (TAO_debug_level && env.exception ()) \
- _dmsg_x (env, s); }
-
-// dump POSIX error indication, if any, with ID tag
-#define dperror(str) { if (TAO_debug_level) dmsg_v ("%s: %s", \
- str, strerror (errno)); }
-
-// dump socket error indication, if any, with ID tag
-#if defined (_WINSOCKAPI_)
-#define dsockerr(s) { if (TAO_debug_level) dmsg_v ("%s: winsock error %d", \
- s, WSAGetLastError()); }
-#else
-#define dsockerr(s) dperror(s)
-#endif /* _WINSOCKAPI_ */
-
-#else /* !DEBUG */
-#define dmsg(s) { }
-#define dmsg1(s,a1) { }
-#define dmsg2(s,a1,a2) { }
-
-#define dexc(env, s) { }
-#define dperror(s) { }
-#define dsockerr(s) { }
-#endif /* DEBUG */
-
-// These don't compile out; you must #ifdef them. This is done
-// intentionally since CPP macros have severe limits, and varargs _(or
-// lack thereof) is one of them.
-
-#if defined (DEBUG)
-
-// This is like an fprintf statement except the filter is a set of
-// characters (string). If TAO_debug_level is nonzero and any
-// characters in that string are in the "TAO_debug_filter" string, the
-// message is then printed. Assign thosee characters as needed.
-
-extern void TAO_Export dmsg_filter (const char *filter,
- const char *fmt,
- ...);
-
-// Filter according to TAO_debug_level instead of category. (For
-// speed, test against TAO_debug_level directly.)
-
-extern void TAO_Export dmsg_filter (u_int level,
- const char *fmt,
- ...);
-
-// General varargs debug message printer, no filtering
-
-extern void TAO_Export dmsg_v (const char *fmt,
- ...);
-extern void TAO_Export _dmsg_x (CORBA_Environment &env,
- const char *info);
-extern void TAO_Export dmsg_opaque (char *label,
- u_char *buffer,
- u_long len);
-extern void TAO_Export dmsg_opaque_full (char *label,
- const u_char *buffer,
- u_long len);
-#endif /* DEBUG */
-
#endif /* TAO_DEBUG_H */
diff --git a/TAO/tao/deep_free.cpp b/TAO/tao/deep_free.cpp
index 0b0658b6202..2263bdfc319 100644
--- a/TAO/tao/deep_free.cpp
+++ b/TAO/tao/deep_free.cpp
@@ -130,7 +130,7 @@ TAO_Marshal_Primitive::deep_free (CORBA::TypeCode_ptr tc,
// @@EXC@@ Don't know how to print the following debug info.
// Anyhow, currently, tc->kind won't throw any exception.
- // dmsg ("TAO_Marshal_Primitive::deep_free detected error");
+ // ACE_DEBUG ((LM_DEBUG,"TAO_Marshal_Primitive::deep_free detected error"));
TAO_CHECK_ENV_RETURN (env, CORBA::TypeCode::TRAVERSE_STOP);
switch (my_kind)
@@ -183,7 +183,7 @@ TAO_Marshal_Struct::deep_free (CORBA::TypeCode_ptr tc,
// @@EXC@@ Don't know how to print out this error message using
// the TAO_CHECK... macro. Is it necessary?
- // dmsg ("TAO_Marshal_Struct::deep_free detected error");
+ // ACE_DEBUG((LM_DEBUG,"TAO_Marshal_Struct::deep_free detected error"));
TAO_CHECK_ENV_RETURN (env, CORBA::TypeCode::TRAVERSE_STOP);
for (int i = 0; i < member_count && retval ==
@@ -194,7 +194,7 @@ TAO_Marshal_Struct::deep_free (CORBA::TypeCode_ptr tc,
// @@EXC@@ Don't know how to print out this error message using
// the TAO_CHECK... macro. Is it necessary?
- // dmsg ("TAO_Marshal_Struct::deep_free detected error");
+ // ACE_DEBUG ((LM_DEBUG,"TAO_Marshal_Struct::deep_free detected error"));
TAO_CHECK_ENV_RETURN (env, CORBA::TypeCode::TRAVERSE_STOP);
// get the size of the field
@@ -202,7 +202,7 @@ TAO_Marshal_Struct::deep_free (CORBA::TypeCode_ptr tc,
// @@EXC@@ Don't know how to print out this error message using
// the TAO_CHECK... macro. Is it necessary?
- // dmsg ("TAO_Marshal_Struct::deep_free detected error");
+ // ACE_DEBUG ((LM_DEBUG,"TAO_Marshal_Struct::deep_free detected error"));
TAO_CHECK_ENV_RETURN (env, CORBA::TypeCode::TRAVERSE_STOP);
switch (param->kind_)