|
From: Carlo W. <li...@us...> - 2002-02-21 20:18:49
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2002-01-21 20:18:47 UTC
Modified files:
libcwd/tests/.cvsignore
Added files:
libcwd/tests/location.cc
Log message:
Just another tiny test.
---------------------- diff included ----------------------
Index: src/libcwd/tests/.cvsignore
diff -u src/libcwd/tests/.cvsignore:1.14 src/libcwd/tests/.cvsignore:1.15
--- src/libcwd/tests/.cvsignore:1.14 Sun Feb 3 19:51:18 2002
+++ src/libcwd/tests/.cvsignore Thu Feb 21 12:18:37 2002
@@ -10,5 +10,6 @@
threads4
stabs
dout_alloc
+location
.deps
.libs
Index: src/libcwd/tests/location.cc
diff -u /dev/null src/libcwd/tests/location.cc:1.1
--- /dev/null Thu Feb 21 12:18:47 2002
+++ src/libcwd/tests/location.cc Thu Feb 21 12:18:37 2002
@@ -0,0 +1,47 @@
+// $Header: /cvsroot/l/li/libcw/src/libcwd/tests/location.cc,v 1.1 2002/02/21 20:18:37 libcw Exp $
+//
+// Copyright (C) 2002, by
+//
+// Carlo Wood, Run on IRC <ca...@al...>
+// RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
+// Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
+//
+// This file may be distributed under the terms of the Q Public License
+// version 1.0 as appearing in the file LICENSE.QPL included in the
+// packaging of this file.
+//
+
+#include "sys.h"
+#include <iostream>
+#include "debug.h"
+#include <libcw/demangle.h>
+
+void test(void)
+{
+ libcw::debug::location_ct loc((char*)__builtin_return_address(0) + libcw::debug::builtin_return_address_offset);
+ std::string funcname;
+ libcw::debug::demangle_symbol(loc.mangled_function_name(), funcname);
+ Dout(dc::notice, "Called from " << funcname );
+}
+
+class A {
+ public:
+ A(void);
+};
+
+A::A(void)
+{
+ Dout(dc::notice, "Called from " << location_ct((char*)__builtin_return_address(0) + libcw::debug::builtin_return_address_offset) );
+ test();
+}
+
+int main(void)
+{
+ ForAllDebugChannels( if (!debugChannel.is_on()) debugChannel.on(); );
+ Debug( libcw_do.set_ostream(&std::cout) );
+ Debug( libcw_do.on() );
+
+ delete NEW(A);
+
+ return 0;
+}
----------------------- End of diff -----------------------
|