diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-01-03 04:46:51 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-01-03 04:46:51 +0900 |
commit | 9f460e017b341fc8378f00315b0776e300107ccd (patch) | |
tree | c4769a642548b9b77970217c5a7e8c3536635a7c | |
parent | 6f5ee1f092414e4d60a403d82a57cf023b38c0b9 (diff) | |
download | ruby-9f460e017b341fc8378f00315b0776e300107ccd.tar.gz |
move internal/debug.h definitions to internal.h
Debug utilities should be accessible from any internal code.
-rw-r--r-- | common.mk | 3 | ||||
-rw-r--r-- | compile.c | 1 | ||||
-rw-r--r-- | debug.c | 1 | ||||
-rw-r--r-- | hash.c | 1 | ||||
-rw-r--r-- | internal.h | 24 | ||||
-rw-r--r-- | internal/debug.h | 39 | ||||
-rw-r--r-- | vm.c | 1 |
7 files changed, 24 insertions, 46 deletions
@@ -1802,7 +1802,6 @@ compile.$(OBJEXT): $(top_srcdir)/internal/bits.h compile.$(OBJEXT): $(top_srcdir)/internal/compile.h compile.$(OBJEXT): $(top_srcdir)/internal/compilers.h compile.$(OBJEXT): $(top_srcdir)/internal/complex.h -compile.$(OBJEXT): $(top_srcdir)/internal/debug.h compile.$(OBJEXT): $(top_srcdir)/internal/encoding.h compile.$(OBJEXT): $(top_srcdir)/internal/error.h compile.$(OBJEXT): $(top_srcdir)/internal/fixnum.h @@ -1942,7 +1941,6 @@ debug.$(OBJEXT): $(hdrdir)/ruby.h debug.$(OBJEXT): $(hdrdir)/ruby/ruby.h debug.$(OBJEXT): $(top_srcdir)/internal/array.h debug.$(OBJEXT): $(top_srcdir)/internal/compilers.h -debug.$(OBJEXT): $(top_srcdir)/internal/debug.h debug.$(OBJEXT): $(top_srcdir)/internal/gc.h debug.$(OBJEXT): $(top_srcdir)/internal/imemo.h debug.$(OBJEXT): $(top_srcdir)/internal/serial.h @@ -4110,7 +4108,6 @@ vm.$(OBJEXT): $(top_srcdir)/internal/compar.h vm.$(OBJEXT): $(top_srcdir)/internal/compile.h vm.$(OBJEXT): $(top_srcdir)/internal/compilers.h vm.$(OBJEXT): $(top_srcdir)/internal/cont.h -vm.$(OBJEXT): $(top_srcdir)/internal/debug.h vm.$(OBJEXT): $(top_srcdir)/internal/error.h vm.$(OBJEXT): $(top_srcdir)/internal/eval.h vm.$(OBJEXT): $(top_srcdir)/internal/fixnum.h @@ -23,7 +23,6 @@ #include "internal/array.h" #include "internal/compile.h" #include "internal/complex.h" -#include "internal/debug.h" #include "internal/encoding.h" #include "internal/error.h" #include "internal/hash.h" @@ -15,7 +15,6 @@ #include "eval_intern.h" #include "id.h" -#include "internal/debug.h" #include "internal/signal.h" #include "internal/util.h" #include "ruby/encoding.h" @@ -49,7 +49,6 @@ #if HASH_DEBUG #include "gc.h" -#include "internal/debug.h" #endif #define HAS_EXTRA_STATES(hash, klass) ( \ diff --git a/internal.h b/internal.h index 7479c73563..4d95fe704e 100644 --- a/internal.h +++ b/internal.h @@ -74,4 +74,28 @@ #define rb_funcallv(...) rb_nonexistent_symbol(__VA_ARGS__) #define rb_method_basic_definition_p(...) rb_nonexistent_symbol(__VA_ARGS__) + +/* MRI debug support */ + +/* gc.c */ +void rb_obj_info_dump(VALUE obj); +void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func); + +/* debug.c */ +void ruby_debug_breakpoint(void); +PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2); + +// show obj data structure without any side-effect +#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, __func__) + +// same as rp, but add message header +#define rp_m(msg, obj) do { \ + fprintf(stderr, "%s", (msg)); \ + rb_obj_info_dump((VALUE)obj); \ +} while (0) + +// `ruby_debug_breakpoint()` does nothing, +// but breakpoint is set in run.gdb, so `make gdb` can stop here. +#define bp() ruby_debug_breakpoint() + #endif /* RUBY_INTERNAL_H */ diff --git a/internal/debug.h b/internal/debug.h deleted file mode 100644 index 276991027c..0000000000 --- a/internal/debug.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef INTERNAL_DEBUG_H /* -*- C -*- */ -#define INTERNAL_DEBUG_H -/** - * @file - * @brief Internal header for debugging. - * @author \@shyouhei - * @copyright This file is a part of the programming language Ruby. - * Permission is hereby granted, to either redistribute and/or - * modify this file, provided that the conditions mentioned in the - * file COPYING are met. Consult the file for details. - */ -#include "ruby/config.h" -#include <stdio.h> /* for fprintf */ -#include "ruby/ruby.h" /* for VALUE */ - -/* MRI debug support */ - -/* gc.c */ -void rb_obj_info_dump(VALUE obj); -void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func); - -/* debug.c */ -void ruby_debug_breakpoint(void); -PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2); - -// show obj data structure without any side-effect -#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, __func__) - -// same as rp, but add message header -#define rp_m(msg, obj) do { \ - fprintf(stderr, "%s", (msg)); \ - rb_obj_info_dump((VALUE)obj); \ -} while (0) - -// `ruby_debug_breakpoint()` does nothing, -// but breakpoint is set in run.gdb, so `make gdb` can stop here. -#define bp() ruby_debug_breakpoint() - -#endif /* INTERNAL_DEBUG_H */ @@ -15,7 +15,6 @@ #include "internal.h" #include "internal/compile.h" #include "internal/cont.h" -#include "internal/debug.h" #include "internal/error.h" #include "internal/eval.h" #include "internal/inits.h" |