move internal/debug.h definitions to internal.h

Debug utilities should be accessible from any internal code.
This commit is contained in:
Koichi Sasada 2020-01-03 04:46:51 +09:00
Родитель 6f5ee1f092
Коммит 9f460e017b
7 изменённых файлов: 24 добавлений и 46 удалений

Просмотреть файл

@ -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"

1
hash.c
Просмотреть файл

@ -49,7 +49,6 @@
#if HASH_DEBUG
#include "gc.h"
#include "internal/debug.h"
#endif
#define HAS_EXTRA_STATES(hash, klass) ( \

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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 */

1
vm.c
Просмотреть файл

@ -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"