-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix VMDEBUG #13147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix VMDEBUG #13147
Conversation
@@ -65,13 +65,6 @@ calc_pos(const rb_iseq_t *iseq, const VALUE *pc, int *lineno, int *node_id) | |||
/* use pos-1 because PC points next instruction at the beginning of instruction */ | |||
pos--; | |||
} | |||
#if VMDEBUG && defined(HAVE_BUILTIN___BUILTIN_TRAP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We end up in this branch fairly frequently with pos == 0
. I've removed it for now, otherwise this will terminate any program right away.
@@ -381,6 +381,8 @@ vm_stack_dump_each(const rb_execution_context_t *ec, const rb_control_frame_t *c | |||
else { | |||
rb_bug("unsupported frame type: %08lx", VM_FRAME_TYPE(cfp)); | |||
} | |||
error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The kprintf
macro used above has a goto error
. All of this is within a #if VMDEBUG > 2
@@ -429,7 +429,7 @@ vm_push_frame(rb_execution_context_t *ec, | |||
|
|||
ec->cfp = cfp; | |||
|
|||
if (VMDEBUG == 2) { | |||
if (VMDEBUG == 2 && rb_current_execution_context(false) != NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this I get:
../vm_core.h:1988: Assertion Failed: rb_current_execution_context:!expect_ec || ec != NULL
It happens during vm init, pushing a dummy frame before ruby_current_ec
has been set (Init_BareVM -> th_init -> rb_ec_initialize_vm_stack -> vm_push_frame).
dccccbc
to
7d40279
Compare
7d40279
to
6348379
Compare
This comment has been minimized.
This comment has been minimized.
I've found some of the VMDEBUG levels helpful in learning how things work. But prior to this commit there were some compile errors, as well as a failed assertion and an early exit. I'd guess that VMDEBUG is not commonly used, and these things didn't get updated as the surrounding code changed.
6348379
to
a2f646c
Compare
I've found some of the VMDEBUG levels helpful in learning how things work. But prior to this commit there were some compile errors, as well as a failed assertion and an early exit. I'd guess that VMDEBUG is not commonly used, and these things didn't get updated as the surrounding code changed.