Ruby  2.7.2p137(2020-10-01revision5445e0435260b449decf2ac16f9d09bae3cafe72)
Macros | Functions | Variables
debug.c File Reference
#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "ruby/io.h"
#include "ruby/util.h"
#include "vm_debug.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "symbol.h"
#include "id.h"
#include "gc.h"

Go to the source code of this file.

Macros

#define SET_WHEN(name, var, val)
 
#define NAME_MATCH_VALUE(name)
 
#define SET_UINT(val)
 
#define SET_UINT_LIST(name, vals, num)
 
#define SET_WHEN_UINT(name, vals, num, req)    if (NAME_MATCH_VALUE(name)) SET_UINT_LIST(name, vals, num);
 

Functions

int ruby_debug_print_indent (int level, int debug_level, int indent_level)
 
void ruby_debug_printf (const char *format,...)
 
VALUE ruby_debug_print_value (int level, int debug_level, const char *header, VALUE obj)
 
void ruby_debug_print_v (VALUE v)
 
ID ruby_debug_print_id (int level, int debug_level, const char *header, ID id)
 
NODEruby_debug_print_node (int level, int debug_level, const char *header, const NODE *node)
 
void ruby_debug_breakpoint (void)
 
int ruby_env_debug_option (const char *str, int len, void *arg)
 
void ruby_set_debug_option (const char *str)
 

Variables

struct {
enum  {
  RUBY_FMODE_READABLE = FMODE_READABLE, RUBY_FMODE_WRITABLE = FMODE_WRITABLE, RUBY_FMODE_READWRITE = FMODE_READWRITE, RUBY_FMODE_BINMODE = FMODE_BINMODE,
  RUBY_FMODE_SYNC = FMODE_SYNC, RUBY_FMODE_TTY = FMODE_TTY, RUBY_FMODE_DUPLEX = FMODE_DUPLEX, RUBY_FMODE_APPEND = FMODE_APPEND,
  RUBY_FMODE_CREATE = FMODE_CREATE, RUBY_FMODE_NOREVLOOKUP = 0x00000100, RUBY_FMODE_TRUNC = FMODE_TRUNC, RUBY_FMODE_TEXTMODE = FMODE_TEXTMODE,
  RUBY_FMODE_PREP = 0x00010000, RUBY_FMODE_SETENC_BY_BOM = FMODE_SETENC_BY_BOM, RUBY_FMODE_UNIX = 0x00200000, RUBY_FMODE_INET = 0x00400000,
  RUBY_FMODE_INET6 = 0x00800000, RUBY_NODE_TYPESHIFT = NODE_TYPESHIFT, RUBY_NODE_TYPEMASK = NODE_TYPEMASK, RUBY_NODE_LSHIFT = NODE_LSHIFT,
  RUBY_NODE_FL_NEWLINE = NODE_FL_NEWLINE
}
 
   enum ruby_special_consts   special_consts
 
   enum ruby_value_type   value_type
 
   enum ruby_tag_type   tag_type
 
   enum node_type   node_type
 
   enum ruby_method_ids   method_ids
 
   enum ruby_id_types   id_types
 
   enum ruby_fl_type   fl_types
 
   enum ruby_encoding_consts   encoding_consts
 
   enum ruby_coderange_type   enc_coderange_types
 
   enum ruby_econv_flag_type   econv_flag_types
 
   enum ruby_robject_flags   robject_flags
 
   enum ruby_rmodule_flags   rmodule_flags
 
   enum ruby_rstring_flags   rstring_flags
 
   enum ruby_rarray_flags   rarray_flags
 
   enum { ... }    various
 
   union {
enum  { RUBY_IMEMO_MASK = IMEMO_MASK }
 
      enum imemo_type   types
 
      enum { ... } ::   mask
 
      struct RIMemo *   ptr
 
   }   imemo
 
   struct RSymbol *   symbol_ptr
 
   enum vm_call_flag_bits   vm_call_flags
 
   struct rb_encoding_entry *   list
 
   int   count
 
   int   size
 
   st_table *   names
 
   uint8_t   len
 
   char   str [HTML_ESCAPE_MAX_LEN+1]
 
   const char *   name
 
   const int   id
 
   int   nid
 
   ID   id_BEGIN
 
   ID   id_END
 
   ID   id_alias
 
   ID   id_alias_error
 
   ID   id_aref
 
   ID   id_aref_field
 
   ID   id_arg_ambiguous
 
   ID   id_arg_paren
 
   ID   id_args_add
 
   ID   id_args_add_block
 
   ID   id_args_add_star
 
   ID   id_args_forward
 
   ID   id_args_new
 
   ID   id_array
 
   ID   id_aryptn
 
   ID   id_assign
 
   ID   id_assign_error
 
   ID   id_assoc_new
 
   ID   id_assoc_splat
 
   ID   id_assoclist_from_args
 
   ID   id_bare_assoc_hash
 
   ID   id_begin
 
   ID   id_binary
 
   ID   id_block_var
 
   ID   id_blockarg
 
   ID   id_bodystmt
 
   ID   id_brace_block
 
   ID   id_break
 
   ID   id_call
 
   ID   id_case
 
   ID   id_class
 
   ID   id_class_name_error
 
   ID   id_command
 
   ID   id_command_call
 
   ID   id_const_path_field
 
   ID   id_const_path_ref
 
   ID   id_const_ref
 
   ID   id_def
 
   ID   id_defined
 
   ID   id_defs
 
   ID   id_do_block
 
   ID   id_dot2
 
   ID   id_dot3
 
   ID   id_dyna_symbol
 
   ID   id_else
 
   ID   id_elsif
 
   ID   id_ensure
 
   ID   id_excessed_comma
 
   ID   id_fcall
 
   ID   id_field
 
   ID   id_for
 
   ID   id_hash
 
   ID   id_heredoc_dedent
 
   ID   id_hshptn
 
   ID   id_if
 
   ID   id_if_mod
 
   ID   id_ifop
 
   ID   id_in
 
   ID   id_kwrest_param
 
   ID   id_lambda
 
   ID   id_magic_comment
 
   ID   id_massign
 
   ID   id_method_add_arg
 
   ID   id_method_add_block
 
   ID   id_mlhs_add
 
   ID   id_mlhs_add_post
 
   ID   id_mlhs_add_star
 
   ID   id_mlhs_new
 
   ID   id_mlhs_paren
 
   ID   id_module
 
   ID   id_mrhs_add
 
   ID   id_mrhs_add_star
 
   ID   id_mrhs_new
 
   ID   id_mrhs_new_from_args
 
   ID   id_next
 
   ID   id_nokw_param
 
   ID   id_opassign
 
   ID   id_operator_ambiguous
 
   ID   id_param_error
 
   ID   id_params
 
   ID   id_paren
 
   ID   id_parse_error
 
   ID   id_program
 
   ID   id_qsymbols_add
 
   ID   id_qsymbols_new
 
   ID   id_qwords_add
 
   ID   id_qwords_new
 
   ID   id_redo
 
   ID   id_regexp_add
 
   ID   id_regexp_literal
 
   ID   id_regexp_new
 
   ID   id_rescue
 
   ID   id_rescue_mod
 
   ID   id_rest_param
 
   ID   id_retry
 
   ID   id_return
 
   ID   id_return0
 
   ID   id_sclass
 
   ID   id_stmts_add
 
   ID   id_stmts_new
 
   ID   id_string_add
 
   ID   id_string_concat
 
   ID   id_string_content
 
   ID   id_string_dvar
 
   ID   id_string_embexpr
 
   ID   id_string_literal
 
   ID   id_super
 
   ID   id_symbol
 
   ID   id_symbol_literal
 
   ID   id_symbols_add
 
   ID   id_symbols_new
 
   ID   id_top_const_field
 
   ID   id_top_const_ref
 
   ID   id_unary
 
   ID   id_undef
 
   ID   id_unless
 
   ID   id_unless_mod
 
   ID   id_until
 
   ID   id_until_mod
 
   ID   id_var_alias
 
   ID   id_var_field
 
   ID   id_var_ref
 
   ID   id_vcall
 
   ID   id_void_stmt
 
   ID   id_when
 
   ID   id_while
 
   ID   id_while_mod
 
   ID   id_word_add
 
   ID   id_word_new
 
   ID   id_words_add
 
   ID   id_words_new
 
   ID   id_xstring_add
 
   ID   id_xstring_literal
 
   ID   id_xstring_new
 
   ID   id_yield
 
   ID   id_yield0
 
   ID   id_zsuper
 
   unsigned short   token
 
   const char   name [3]
 
   const char   term
 
   seed_keys_t   key
 
   uint32_t   u32 [type_roomof(seed_keys_t,
      uint32_t)]
 
   char   bin [32]
 
   uint64_t   u64 [4]
 
   unsigned int   size
 
   unsigned int   mask
 
   struct cache_entry *   entries
 
   DWORD   winerr
 
   int   err
 
ruby_dummy_gdb_enums
 
const SIGNED_VALUE RUBY_NODE_LMASK = NODE_LMASK
 
int ruby_rgengc_debug
 
int ruby_on_ci
 

Macro Definition Documentation

◆ NAME_MATCH_VALUE

#define NAME_MATCH_VALUE (   name)
Value:
((size_t)len >= sizeof(name)-1 && \
strncmp(str, (name), sizeof(name)-1) == 0 && \
((len == sizeof(name)-1 && !(len = 0)) || \
(str[sizeof(name)-1] == '=' && \
(str += sizeof(name), len -= sizeof(name), 1))))

◆ SET_UINT

#define SET_UINT (   val)
Value:
do { \
n = ruby_scan_digits(str, len, 10, &retlen, &ov); \
if (!ov && retlen) { \
val = (unsigned int)n; \
} \
str += retlen; \
len -= retlen; \
} while (0)

◆ SET_UINT_LIST

#define SET_UINT_LIST (   name,
  vals,
  num 
)
Value:
do { \
int i; \
for (i = 0; i < (num); ++i) { \
SET_UINT((vals)[i]); \
if (!len || *str != ':') break; \
++str; \
--len; \
} \
if (len > 0) { \
fprintf(stderr, "ignored "name" option: `%.*s'\n", len, str); \
} \
} while (0)

◆ SET_WHEN

#define SET_WHEN (   name,
  var,
  val 
)
Value:
do { \
if (len == sizeof(name) - 1 && \
strncmp(str, (name), len) == 0) { \
(var) = (val); \
return 1; \
} \
} while (0)

◆ SET_WHEN_UINT

#define SET_WHEN_UINT (   name,
  vals,
  num,
  req 
)     if (NAME_MATCH_VALUE(name)) SET_UINT_LIST(name, vals, num);

Function Documentation

◆ ruby_debug_breakpoint()

void ruby_debug_breakpoint ( void  )

Definition at line 135 of file debug.c.

◆ ruby_debug_print_id()

ID ruby_debug_print_id ( int  level,
int  debug_level,
const char header,
ID  id 
)

Definition at line 115 of file debug.c.

References fflush(), fprintf(), id, rb_id2name(), and stderr.

◆ ruby_debug_print_indent()

int ruby_debug_print_indent ( int  level,
int  debug_level,
int  indent_level 
)

Definition at line 74 of file debug.c.

References FALSE, fflush(), fprintf(), stderr, and TRUE.

◆ ruby_debug_print_node()

NODE* ruby_debug_print_node ( int  level,
int  debug_level,
const char header,
const NODE node 
)

Definition at line 125 of file debug.c.

References fprintf(), nd_line, nd_type, ruby_node_name(), and stderr.

◆ ruby_debug_print_v()

void ruby_debug_print_v ( VALUE  v)

Definition at line 109 of file debug.c.

References ruby_debug_print_value(), and v.

◆ ruby_debug_print_value()

VALUE ruby_debug_print_value ( int  level,
int  debug_level,
const char header,
VALUE  obj 
)

Definition at line 96 of file debug.c.

References fflush(), fprintf(), obj, rb_raw_obj_info(), and stderr.

Referenced by ruby_debug_print_v().

◆ ruby_debug_printf()

void ruby_debug_printf ( const char format,
  ... 
)

Definition at line 85 of file debug.c.

References stderr, va_end, va_start, and vfprintf().

◆ ruby_env_debug_option()

int ruby_env_debug_option ( const char str,
int  len,
void arg 
)

◆ ruby_set_debug_option()

void ruby_set_debug_option ( const char str)

Definition at line 226 of file debug.c.

Referenced by main().

Variable Documentation

◆ econv_flag_types

enum ruby_econv_flag_type econv_flag_types

Definition at line 226 of file debug.c.

◆ enc_coderange_types

enum ruby_coderange_type enc_coderange_types

Definition at line 226 of file debug.c.

◆ encoding_consts

enum ruby_encoding_consts encoding_consts

Definition at line 226 of file debug.c.

◆ fl_types

enum ruby_fl_type fl_types

Definition at line 226 of file debug.c.

◆ id_types

enum ruby_id_types id_types

Definition at line 226 of file debug.c.

◆ imemo

union { ... } imemo

◆ mask

enum { ... } mask

Referenced by ffi_prep_closure_loc().

◆ method_ids

enum ruby_method_ids method_ids

Definition at line 226 of file debug.c.

◆ node_type

Definition at line 226 of file debug.c.

◆ ptr

struct RIMemo* ptr

Definition at line 65 of file debug.c.

Referenced by ffi_closure_call_SYSV(), ffi_closure_eabi(), ffi_closure_helper_SYSV(), ffi_closure_SYSV(), ffi_java_ptrarray_to_raw(), ffi_prep_args(), ffi_prep_args_SYSV(), ffi_prep_cif_core(), ffi_prep_cif_machdep(), ffi_ptrarray_to_raw(), ffi_raw_to_ptrarray(), ffi_v9_layout_struct(), Init_Method(), ossl_asn1_get_asn1type(), ossl_generate_cb_stop(), ossl_pkey_check_public_key(), rb_adjust_argv_kw_splat(), rb_alloc_tmp_buffer_with_count(), rb_ary_delete_at(), rb_check_id_cstr(), rb_check_symbol_cstr(), rb_ec_get_errinfo(), rb_enc_str_buf_cat(), rb_enc_str_new(), rb_exc_new(), rb_external_str_new(), rb_external_str_new_cstr(), rb_external_str_new_with_enc(), rb_fiddle_free(), rb_filesystem_str_new(), rb_filesystem_str_new_cstr(), rb_free_tmp_buffer(), rb_fstring_cstr(), rb_gc_guarded_ptr_val(), rb_io_fptr_finalize_internal(), rb_ivar_lookup(), rb_locale_str_new(), rb_locale_str_new_cstr(), rb_objspace_data_type_memsize(), rb_parser_calloc(), rb_parser_free(), rb_parser_malloc(), rb_parser_realloc(), rb_str_buf_cat_ascii(), rb_str_buf_new_cstr(), rb_str_cat_conv_enc_opts(), rb_str_conv_enc_opts(), rb_str_drop_bytes(), rb_str_end_with_asciichar(), rb_str_initialize(), rb_str_quote_unprintable(), rb_str_symname_p(), rb_string_value(), rb_string_value_cstr(), rb_string_value_ptr(), rb_sym_intern(), rb_sym_intern_ascii(), rb_sym_intern_ascii_cstr(), rb_tainted_str_new(), rb_tainted_str_new_cstr(), rb_usascii_str_new(), rb_usascii_str_new_cstr(), rb_utf8_str_new_cstr(), rb_vm_mark(), rb_vm_update_references(), rb_w32_conv_from_wstr(), rb_w32_mbstr_to_wstr(), rb_w32_write_console(), rb_w32_wstr_to_mbstr(), rb_wait_for_single_fd(), ruby_atomic_exchange(), ruby_mimfree(), ruby_xrealloc(), ruby_xrealloc2(), ruby_xrealloc2_body(), ruby_xrealloc_body(), st_hash(), and VpMemRealloc().

◆ rarray_flags

enum ruby_rarray_flags rarray_flags

Definition at line 226 of file debug.c.

◆ rmodule_flags

enum ruby_rmodule_flags rmodule_flags

Definition at line 226 of file debug.c.

◆ robject_flags

enum ruby_robject_flags robject_flags

Definition at line 226 of file debug.c.

◆ rstring_flags

enum ruby_rstring_flags rstring_flags

Definition at line 226 of file debug.c.

◆ ruby_dummy_gdb_enums

const { ... } ruby_dummy_gdb_enums

◆ RUBY_NODE_LMASK

const SIGNED_VALUE RUBY_NODE_LMASK = NODE_LMASK

Definition at line 71 of file debug.c.

◆ ruby_on_ci

int ruby_on_ci
extern

Definition at line 44 of file vm_dump.c.

Referenced by ruby_env_debug_option().

◆ ruby_rgengc_debug

int ruby_rgengc_debug
extern

Definition at line 388 of file gc.c.

Referenced by ruby_env_debug_option().

◆ special_consts

enum ruby_special_consts special_consts

Definition at line 226 of file debug.c.

◆ symbol_ptr

struct RSymbol* symbol_ptr

Definition at line 67 of file debug.c.

◆ tag_type

enum ruby_tag_type tag_type

Definition at line 226 of file debug.c.

◆ types

enum imemo_type types

Definition at line 67 of file debug.c.

Referenced by rb_insn_operand_intern(), rb_iseq_disasm_insn(), and rb_iseq_mark_insn_storage().

◆ value_type

Definition at line 226 of file debug.c.

◆ various

enum { ... } various

◆ vm_call_flags

enum vm_call_flag_bits vm_call_flags

Definition at line 67 of file debug.c.

strncmp
int strncmp(const char *, const char *, size_t)
int
__inline__ int
Definition: rb_mjit_min_header-2.7.2.h:2877
i
uint32_t i
Definition: rb_mjit_min_header-2.7.2.h:5499
ruby_scan_digits
RUBY_EXTERN unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow)
Definition: util.c:97
if
if((ID)(DISPID) nameid !=nameid)
Definition: win32ole.c:357
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
size_t
long unsigned int size_t
Definition: rb_mjit_min_header-2.7.2.h:669
len
uint8_t len
Definition: escape.c:17
stderr
#define stderr
Definition: rb_mjit_min_header-2.7.2.h:1522
name
const char * name
Definition: nkf.c:208
n
const char size_t n
Definition: rb_mjit_min_header-2.7.2.h:5491