Ruby: vm_dump.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions | Variables
vm_dump.c File Reference
`#include "ruby/internal/config.h"`
`#include "addr2line.h"`
`#include "gc.h"`
`#include "internal.h"`
`#include "internal/variable.h"`
`#include "internal/vm.h"`
`#include "iseq.h"`
`#include "vm_core.h"`
`#include "ractor_core.h"`

Go to the source code of this file.

## Macros
#define | MAX_POSBUF 128
#define | VM_CFP_CNT(ec, cfp)
#define | RUBY_VM_IFUNC_P(ptr) IMEMO_TYPE_P(ptr, imemo_ifunc)
#define | HAVE_BACKTRACE 0
#define | rb_dump_machine_register(ctx) ((void)0)
#define | LIMITED_NAME_LENGTH(s) (((len = RSTRING_LEN(s)) > max_name_length) ? max_name_length : (int)len)

## Functions
const char * | rb_method_type_name (rb_method_type_t type)
void | rb_vmdebug_stack_dump_raw (const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
void | rb_vmdebug_stack_dump_raw_current (void)
void | rb_vmdebug_env_dump_raw (const rb_env_t *env, const VALUE *ep)
void | rb_vmdebug_proc_dump_raw (rb_proc_t *proc)
void | rb_vmdebug_stack_dump_th (VALUE thval)
void | rb_vmdebug_debug_print_register (const rb_execution_context_t *ec)
void | rb_vmdebug_thread_dump_regs (VALUE thval)
void | rb_vmdebug_debug_print_pre (const rb_execution_context_t *ec, const rb_control_frame_t *cfp, const VALUE *_pc)
void | rb_vmdebug_debug_print_post (const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
VALUE | rb_vmdebug_thread_dump_state (VALUE self)
void | rb_print_backtrace (void)
void | rb_vm_bugreport (const void *ctx)
void | rb_vmdebug_stack_dump_all_threads (void)

## Variables
int | ruby_on_ci

## Macro Definition Documentation

## ◆ HAVE_BACKTRACE

#define HAVE_BACKTRACE 0

Definition at line 579 of file vm_dump.c.

## ◆ LIMITED_NAME_LENGTH

#define LIMITED_NAME_LENGTH | ( |  | s | ) | (((len = RSTRING_LEN(s)) > max_name_length) ? max_name_length : (int)len)

## ◆ MAX_POSBUF

#define MAX_POSBUF 128

Definition at line 40 of file vm_dump.c.

## ◆ rb_dump_machine_register

#define rb_dump_machine_register | ( |  | ctx | ) | ((void)0)

Definition at line 958 of file vm_dump.c.

## ◆ RUBY_VM_IFUNC_P

#define RUBY_VM_IFUNC_P | ( |  | ptr | ) | IMEMO_TYPE_P(ptr, imemo_ifunc)

## ◆ VM_CFP_CNT

#define VM_CFP_CNT | ( |  | ec,
|  |  | cfp
| ) |  |

Value:
((rb_control_frame_t *)((ec)->vm_stack + (ec)->vm_stack_size) - \
(rb_control_frame_t *)(cfp))
rb_control_frame_struct
Definition: vm_core.h:769

Definition at line 42 of file vm_dump.c.

## Function Documentation

## ◆ rb_method_type_name()

const char * rb_method_type_name | ( | rb_method_type_t | type | ) |

Definition at line 12177 of file gc.c.

References rb_bug(), VM_METHOD_TYPE_ALIAS, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_IVAR, VM_METHOD_TYPE_MISSING, VM_METHOD_TYPE_NOTIMPLEMENTED, VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_REFINED, VM_METHOD_TYPE_UNDEF, and VM_METHOD_TYPE_ZSUPER.

Referenced by rb_raw_obj_info().

## ◆ rb_print_backtrace()

void rb_print_backtrace | ( | void |  | ) |

Definition at line 753 of file vm_dump.c.

References free, and int().

Referenced by rb_fatal(), and rb_vm_bugreport().

## ◆ rb_vm_bugreport()

void rb_vm_bugreport | ( | const void * | ctx | ) |

Definition at line 962 of file vm_dump.c.

References CLASS_OF, count, feof, getenv, len, LIMITED_NAME_LENGTH, rb_vm_struct::loaded_features, map(), name, NULL, PATH_MAX, procstat_vm(), rb_vm_struct::progname, RARRAY_AREF, RARRAY_LEN, rb_backtrace_print_as_bugreport(), rb_class_real(), rb_dump_machine_register, rb_obj_class(), rb_print_backtrace(), rb_search_class_path(), RSTRING_PTR, SDR, snprintf, T_CLASS, T_MODULE, and T_STRING.

Referenced by rb_assert_failure().

## ◆ rb_vmdebug_debug_print_post()

void rb_vmdebug_debug_print_post | ( | const rb_execution_context_t * | ec,
|  | const rb_control_frame_t * | cfp
| ) |  |

Definition at line 417 of file vm_dump.c.

References rb_execution_context_struct::cfp, rb_inspect(), rb_vmdebug_debug_print_register(), SDR2, and StringValueCStr.

## ◆ rb_vmdebug_debug_print_pre()

void rb_vmdebug_debug_print_pre | ( | const rb_execution_context_t * | ec,
|  | const rb_control_frame_t * | cfp,
|  | const VALUE * | _pc
| ) |  |

Definition at line 388 of file vm_dump.c.

References rb_iseq_struct::body, int(), rb_control_frame_struct::iseq, rb_iseq_constant_body::iseq_encoded, rb_iseq_disasm_insn(), rb_iseq_original_iseq(), rb_vmdebug_debug_print_register(), rb_control_frame_struct::sp, VM_CFP_CNT, and rb_execution_context_struct::vm_stack.

## ◆ rb_vmdebug_debug_print_register()

void rb_vmdebug_debug_print_register | ( | const rb_execution_context_t * | ec | ) |

Definition at line 361 of file vm_dump.c.

References rb_iseq_struct::body, rb_execution_context_struct::cfp, rb_control_frame_struct::ep, rb_control_frame_struct::iseq, rb_iseq_constant_body::iseq_encoded, rb_control_frame_struct::pc, PRIdPTRDIFF, rb_control_frame_struct::sp, rb_execution_context_struct::vm_stack, and rb_execution_context_struct::vm_stack_size.

Referenced by rb_vmdebug_debug_print_post(), rb_vmdebug_debug_print_pre(), and rb_vmdebug_thread_dump_regs().

## ◆ rb_vmdebug_env_dump_raw()

void rb_vmdebug_env_dump_raw | ( | const rb_env_t * | env,
|  | const VALUE * | ep
| ) |  |

Definition at line 235 of file vm_dump.c.

References env, PRIxVALUE, and rb_vm_env_prev_env().

Referenced by rb_vmdebug_proc_dump_raw().

## ◆ rb_vmdebug_proc_dump_raw()

void rb_vmdebug_proc_dump_raw | ( | rb_proc_t * | proc | ) |

Definition at line 254 of file vm_dump.c.

References rb_proc_t::block, env, rb_inspect(), rb_vmdebug_env_dump_raw(), and StringValueCStr.

## ◆ rb_vmdebug_stack_dump_all_threads()

void rb_vmdebug_stack_dump_all_threads | ( | void |  | ) |

Definition at line 1140 of file vm_dump.c.

References NULL, rb_vmdebug_stack_dump_raw(), rb_ractor_struct::set, rb_thread_struct::thread_id, and rb_ractor_struct::threads.

## ◆ rb_vmdebug_stack_dump_raw()

void rb_vmdebug_stack_dump_raw | ( | const rb_execution_context_t * | ec,
|  | const rb_control_frame_t * | cfp
| ) |  |

Definition at line 195 of file vm_dump.c.

References rb_control_frame_struct::ep, GC_GUARDED_PTR_REF, PRIxVALUE, rb_control_frame_struct::sp, t, rb_execution_context_struct::vm_stack, and rb_execution_context_struct::vm_stack_size.

Referenced by rb_vmdebug_stack_dump_all_threads(), rb_vmdebug_stack_dump_raw_current(), and rb_vmdebug_stack_dump_th().

## ◆ rb_vmdebug_stack_dump_raw_current()

void rb_vmdebug_stack_dump_raw_current | ( | void |  | ) |

Definition at line 228 of file vm_dump.c.

References rb_execution_context_struct::cfp, and rb_vmdebug_stack_dump_raw().

## ◆ rb_vmdebug_stack_dump_th()

void rb_vmdebug_stack_dump_th | ( | VALUE | thval | ) |

Definition at line 268 of file vm_dump.c.

References rb_execution_context_struct::cfp, rb_thread_struct::ec, and rb_vmdebug_stack_dump_raw().

## ◆ rb_vmdebug_thread_dump_regs()

void rb_vmdebug_thread_dump_regs | ( | VALUE | thval | ) |

Definition at line 382 of file vm_dump.c.

References rb_vmdebug_debug_print_register().

## ◆ rb_vmdebug_thread_dump_state()

VALUE rb_vmdebug_thread_dump_state | ( | VALUE | self | ) |

Definition at line 452 of file vm_dump.c.

References rb_execution_context_struct::cfp, rb_thread_struct::ec, rb_control_frame_struct::ep, rb_control_frame_struct::pc, Qnil, and rb_control_frame_struct::sp.

## Variable Documentation

## ◆ ruby_on_ci

int ruby_on_ci

Definition at line 47 of file vm_dump.c.

Referenced by ruby_env_debug_option().