ruby-changes:59607
From: Koichi <ko1@a...>
Date: Fri, 3 Jan 2020 04:51:21 +0900 (JST)
Subject: [ruby-changes:59607] 9f460e017b (master): move internal/debug.h definitions to internal.h
https://git.ruby-lang.org/ruby.git/commit/?id=9f460e017b From 9f460e017b341fc8378f00315b0776e300107ccd Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Fri, 3 Jan 2020 04:46:51 +0900 Subject: move internal/debug.h definitions to internal.h Debug utilities should be accessible from any internal code. diff --git a/common.mk b/common.mk index 2ab2855..0d69e1b 100644 --- a/common.mk +++ b/common.mk @@ -1802,7 +1802,6 @@ compile.$(OBJEXT): $(top_srcdir)/internal/bits.h https://github.com/ruby/ruby/blob/trunk/common.mk#L1802 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 https://github.com/ruby/ruby/blob/trunk/common.mk#L1941 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 https://github.com/ruby/ruby/blob/trunk/common.mk#L4108 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 diff --git a/compile.c b/compile.c index 200670f..0eb94da 100644 --- a/compile.c +++ b/compile.c @@ -23,7 +23,6 @@ https://github.com/ruby/ruby/blob/trunk/compile.c#L23 #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" diff --git a/debug.c b/debug.c index 7bb9d02..b15a089 100644 --- a/debug.c +++ b/debug.c @@ -15,7 +15,6 @@ https://github.com/ruby/ruby/blob/trunk/debug.c#L15 #include "eval_intern.h" #include "id.h" -#include "internal/debug.h" #include "internal/signal.h" #include "internal/util.h" #include "ruby/encoding.h" diff --git a/hash.c b/hash.c index 04c821a..606d5d3 100644 --- a/hash.c +++ b/hash.c @@ -49,7 +49,6 @@ https://github.com/ruby/ruby/blob/trunk/hash.c#L49 #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 7479c73..4d95fe7 100644 --- a/internal.h +++ b/internal.h @@ -74,4 +74,28 @@ https://github.com/ruby/ruby/blob/trunk/internal.h#L74 #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 2769910..0000000 --- a/internal/debug.h +++ /dev/null @@ -1,39 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/internal.h#L0 -#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 */ diff --git a/vm.c b/vm.c index d4a1d44..e432cb1 100644 --- a/vm.c +++ b/vm.c @@ -15,7 +15,6 @@ https://github.com/ruby/ruby/blob/trunk/vm.c#L15 #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" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/