[macruby-changes] [5029] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Tue Dec 14 23:49:01 PST 2010
Revision: 5029
http://trac.macosforge.org/projects/ruby/changeset/5029
Author: lsansonetti at apple.com
Date: 2010-12-14 23:48:57 -0800 (Tue, 14 Dec 2010)
Log Message:
-----------
better debug stuff
Modified Paths:
--------------
MacRuby/trunk/vm.cpp
MacRuby/trunk/vm.h
Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp 2010-12-15 07:48:25 UTC (rev 5028)
+++ MacRuby/trunk/vm.cpp 2010-12-15 07:48:57 UTC (rev 5029)
@@ -493,48 +493,38 @@
mcache = NULL;
}
-static void
-append_ptr_address(std::string &s, void *ptr)
+void
+RoxorVM::debug_blocks(void)
{
- char buf[100];
- snprintf(buf, sizeof buf, "%p", ptr);
- s.append(buf);
+ for (std::vector<rb_vm_block_t *>::iterator i = current_blocks.begin();
+ i != current_blocks.end();
+ ++i) {
+ printf("%p ", *i);
+ }
+ printf("\n");
}
-std::string
-RoxorVM::debug_blocks(void)
+void
+RoxorVM::debug_exceptions(void)
{
- std::string s;
- if (current_blocks.empty()) {
- s.append("empty");
+ for (std::vector<VALUE>::iterator i = current_exceptions.begin();
+ i != current_exceptions.end();
+ ++i) {
+ printf("%p ", (void *)*i);
}
- else {
- for (std::vector<rb_vm_block_t *>::iterator i = current_blocks.begin();
- i != current_blocks.end();
- ++i) {
- append_ptr_address(s, *i);
- s.append(" ");
- }
- }
- return s;
+ printf("\n");
}
-std::string
-RoxorVM::debug_exceptions(void)
+void
+RoxorCore::debug_outers(Class k)
{
+ struct rb_vm_outer *o = get_outer(k);
std::string s;
- if (current_exceptions.empty()) {
- s.append("empty");
+ while (o != NULL) {
+ printf("%p ", o->klass);
+ o = o->outer;
}
- else {
- for (std::vector<VALUE>::iterator i = current_exceptions.begin();
- i != current_exceptions.end();
- ++i) {
- append_ptr_address(s, (void *)*i);
- s.append(" ");
- }
- }
- return s;
+ printf("\n");
}
#if !defined(MACRUBY_STATIC)
@@ -1297,6 +1287,10 @@
class_outer->klass = klass;
class_outer->outer = mod_outer;
outers[klass] = class_outer;
+#if ROXOR_VM_DEBUG
+ printf("set outer of %s to %s\n", class_getName(klass),
+ class_getName(mod));
+#endif
}
}
}
@@ -1305,10 +1299,6 @@
void
rb_vm_set_outer(VALUE klass, VALUE under)
{
-#if ROXOR_VM_DEBUG
- printf("set outer of %s to %s\n", class_getName((Class)klass),
- class_getName((Class)under));
-#endif
GET_CORE()->set_outer((Class)klass, (Class)under);
}
Modified: MacRuby/trunk/vm.h
===================================================================
--- MacRuby/trunk/vm.h 2010-12-15 07:48:25 UTC (rev 5028)
+++ MacRuby/trunk/vm.h 2010-12-15 07:48:57 UTC (rev 5029)
@@ -927,6 +927,8 @@
bool respond_to(VALUE obj, VALUE klass, SEL sel, bool priv,
bool check_override);
+ void debug_outers(Class k);
+
private:
bool register_bs_boxed(bs_element_type_t type, void *value);
void register_bs_class(bs_element_class_t *bs_class);
@@ -1069,7 +1071,7 @@
ACCESSOR(current_mri_method_self, VALUE);
ACCESSOR(current_mri_method_sel, SEL);
- std::string debug_blocks(void);
+ void debug_blocks(void);
bool is_block_current(rb_vm_block_t *b) {
return b == NULL
@@ -1138,7 +1140,7 @@
}
}
- std::string debug_exceptions(void);
+ void debug_exceptions(void);
VALUE current_exception(void) {
return current_exceptions.empty()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101214/d29e89b7/attachment-0001.html>
More information about the macruby-changes
mailing list