Index: /trunk/include/cf_debug.h
===================================================================
--- /trunk/include/cf_debug.h	(revision 62)
+++ /trunk/include/cf_debug.h	(revision 63)
@@ -79,5 +79,5 @@
 
 /**
- * 함수에서 종료
+ * 함수에서 리턴
  *
  * @see CF_Debug_LeaveFunction
@@ -85,4 +85,12 @@
 # define CF_DEBUG_END_FUNCTION										\
 	CF_Debug_LeaveFunction ()
+
+/**
+ * 콜스택 을 지정된 파일 포인터로 출력
+ *
+ * @see CF_Debug_PrintCallStack
+ */
+# define CF_DEBUG_PRINT_CALLSTACK(__fp)								\
+	CF_Debug_PrintCallStack (__fp)
 
 #else // #ifdef _DEBUG
@@ -93,4 +101,5 @@
 # define CF_DEBUG_BEGIN_FUNCTION
 # define CF_DEBUG_END_FUNCTION
+# define CF_DEBUG_PRINT_CALLSTACK(__fp)
 #endif // #ifdef _DEBUG
 
Index: /trunk/src/cf_debug.c
===================================================================
--- /trunk/src/cf_debug.c	(revision 62)
+++ /trunk/src/cf_debug.c	(revision 63)
@@ -414,4 +414,52 @@
 
 /**
+ * 함수 진입을 명시 (글로벌 컨텍스트)
+ *
+ * @return 성공 시, CF_OK; 실패 시, 오류 코드
+ *
+ * @param file	파일 경로
+ * @param func	함수 이름
+ * @param line	라인 넘버
+ *
+ * @see CF_Debug_LeaveFunction
+ */
+int
+CF_Debug_EnterFunction (const char	* file,
+						const char	* func,
+						const int	line)
+{
+	CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx;
+
+	ASSERT_CTX (ctx);
+
+	CF_Mutex_Lock (&ctx->mutex);
+	CF_Debug_CallStackPush (gDebugSingleCtx, file, func, line);
+	CF_Mutex_Unlock (&ctx->mutex);
+
+	return CF_OK;
+}
+
+/**
+ * 함수 종료를 명시 (글로벌 컨텍스트)
+ *
+ * @return 성공 시, CF_OK; 실패 시, 오류 코드
+ *
+ * @see CF_Debug_EnterFunction
+ */
+int
+CF_Debug_LeaveFunction (void)
+{
+	CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx;
+
+	ASSERT_CTX (ctx);
+
+	CF_Mutex_Lock (&ctx->mutex);
+	CF_Debug_CallStackPop (gDebugSingleCtx, NULL);
+	CF_Mutex_Unlock (&ctx->mutex);
+
+	return CF_OK;
+}
+
+/**
  * 현재 콜스택을 출력 (글로벌 컨텍스트)
  *
@@ -428,6 +476,5 @@
 	CF_DEBUG_CALLSTACK	* callstack = NULL;
 
-	if (ctx == NULL)
-		return CF_ERROR_DEBUG_INVALID_CTX;
+	ASSERT_CTX (ctx);
 
 	for ( callstack = ctx->callstack.caller
@@ -435,59 +482,12 @@
 		; callstack = callstack->caller)
 	{
-		fprintf (fp, "#%-4d %s <%s:%d>\n",
-					 iter++,
-					 callstack->func,
-					 callstack->file,
-					 callstack->line);
-	}
-
-	return CF_OK;
-}
-
-/**
- * 함수 진입을 명시 (글로벌 컨텍스트)
- *
- * @return 성공 시, CF_OK; 실패 시, 오류 코드
- *
- * @param file	파일 경로
- * @param func	함수 이름
- * @param line	라인 넘버
- *
- * @see CF_Debug_LeaveFunction
- */
-int
-CF_Debug_EnterFunction (const char	* file,
-						const char	* func,
-						const int	line)
-{
-	CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx;
-
-	ASSERT_CTX (ctx);
-
-	CF_Mutex_Lock (&ctx->mutex);
-	CF_Debug_CallStackPush (gDebugSingleCtx, file, func, line);
-	CF_Mutex_Unlock (&ctx->mutex);
-
-	return CF_OK;
-}
-
-/**
- * 함수 종료를 명시 (글로벌 컨텍스트)
- *
- * @return 성공 시, CF_OK; 실패 시, 오류 코드
- *
- * @see CF_Debug_EnterFunction
- */
-int
-CF_Debug_LeaveFunction (void)
-{
-	CF_DEBUG_CTX * ctx = (CF_DEBUG_CTX *)gDebugSingleCtx;
-
-	ASSERT_CTX (ctx);
-
-	CF_Mutex_Lock (&ctx->mutex);
-	CF_Debug_CallStackPop (gDebugSingleCtx, NULL);
-	CF_Mutex_Unlock (&ctx->mutex);
-
-	return CF_OK;
-}
+		fprintf (fp == NULL ? stderr : fp,
+				 "#%-4d %s <%s:%d>\n",
+				 iter++,
+				 callstack->func,
+				 callstack->file,
+				 callstack->line);
+	}
+
+	return CF_OK;
+}
Index: /trunk/test/debug.c
===================================================================
--- /trunk/test/debug.c	(revision 62)
+++ /trunk/test/debug.c	(revision 63)
@@ -12,5 +12,5 @@
 	CF_DEBUG_BEGIN_FUNCTION;
 
-	CF_Debug_PrintCallStack (stdout);
+	CF_DEBUG_PRINT_CALLSTACK (stdout);
 
 	CF_DEBUG_END_FUNCTION;
Index: /trunk/test/test.c
===================================================================
--- /trunk/test/test.c	(revision 62)
+++ /trunk/test/test.c	(revision 63)
@@ -29,4 +29,43 @@
 const char * file = "./log.txt";
 
+int		test_log_mt			(void * arg);
+void	test_log			(const char * message);
+void	test_file			(const char * message);
+void	test_callstack3		(void);
+void	test_callstack2		(void);
+void	test_callstack1		(void);
+int		socket_echo_server	(void * arg);
+int		socket_echo_client	(void * arg);
+void	test_socket			(void);
+
+int main (int argc, char ** argv)
+{
+	CF_DEBUG_INITIALIZE;
+	CF_DEBUG_BEGIN_FUNCTION;
+
+	// 1
+	CF_DEBUG_PRINT (stderr, " == LOG TEST ==\n");
+	test_log ("LOG_TEST");
+
+	// 2
+	CF_DEBUG_PRINT (stderr, " == FILE READ TEST ==\n");
+	test_file ("FILE_READ_TEST");
+
+	// 3
+	CF_DEBUG_PRINT (stderr, " == CALLSTACK TEST ==\n");
+	test_callstack1 ();
+
+	// 4
+	CF_DEBUG_PRINT (stderr, " == MULTI-THREADED SOCKET TEST ==\n");
+	test_socket ();
+
+	CF_DEBUG_PRINT (stderr, " == END OF TEST ==\n");
+
+	CF_DEBUG_END_FUNCTION;
+	CF_DEBUG_FINALIZE;
+
+	return 0;
+}
+
 int test_log_mt (void * arg)
 {
@@ -157,5 +196,5 @@
 {
 	CF_DEBUG_BEGIN_FUNCTION;
-	CF_Debug_PrintCallStack (stdout);
+	CF_DEBUG_PRINT_CALLSTACK (stdout);
 	CF_DEBUG_END_FUNCTION;
 }
@@ -331,31 +370,2 @@
 }
 
-int main (int argc, char ** argv)
-{
-	CF_DEBUG_INITIALIZE;
-	CF_DEBUG_BEGIN_FUNCTION;
-
-	// 1
-	CF_DEBUG_PRINT (stderr, " == LOG TEST ==\n");
-	test_log ("LOG_TEST");
-
-	// 2
-	CF_DEBUG_PRINT (stderr, " == FILE READ TEST ==\n");
-	test_file ("FILE_READ_TEST");
-
-	// 3
-	CF_DEBUG_PRINT (stderr, " == CALLSTACK TEST ==\n");
-	test_callstack1 ();
-
-	// 4
-	CF_DEBUG_PRINT (stderr, " == MULTI-THREADED SOCKET TEST ==\n");
-	test_socket ();
-
-	CF_DEBUG_PRINT (stderr, " == END OF TEST ==\n");
-
-	CF_DEBUG_END_FUNCTION;
-	CF_DEBUG_FINALIZE;
-
-	return 0;
-}
-
