summaryrefslogtreecommitdiff
path: root/vm_debug.h
Commit message (Collapse)AuthorAgeFilesLines
* Allow `RUBY_DEBUG_LOG` format to be emptyNobuyoshi Nakada2022-08-061-0/+9
| | | | | | | GCC warns of empty format strings, perhaps because they have no effects in printf() and there are better ways than sprintf(). However, ruby_debug_log() adds informations other than the format, this warning is not the case.
* `RUBY_DEBUG_LOG2` should filter against the given `file`Nobuyoshi Nakada2022-07-281-1/+1
|
* Fix compile errorKazuhiro NISHIYAMA2022-06-091-5/+5
| | | | | | | | | | | | | | ``` compiling ../debug.c ../debug.c:452:1: error: conflicting types for 'ruby_debug_log_filter' ruby_debug_log_filter(const char *func_name, const char *file_name) ^ ../vm_debug.h:87:6: note: previous declaration is here bool ruby_debug_log_filter(const char *func_name); ^ 1 error generated. make: *** [debug.o] Error 1 ```
* `USE_RUBY_DEBUG_LOG` doesn't check `RUBY_DEVEL`Koichi Sasada2021-12-291-13/+2
| | | | | | | | `USE_RUBY_DEBUG_LOG` was only defined when `RUBY_DEVEL` is defined. This patch removes this dependency (`USE_RUBY_DEBUG_LOG` is defined independently from `RUBY_DEVEL`). Do not commit a patch which enables `USE_RUBY_DEBUG_LOG`.
* Suppress undef warnings for USE_RUBY_DEBUG_LOGNobuyoshi Nakada2021-12-251-1/+1
|
* Define fallback RUBY_DEVEL to suppress undef warningsNobuyoshi Nakada2021-12-251-0/+4
|
* Stop including node.h from vm_debug.h only for `NODE`Nobuyoshi Nakada2021-11-211-2/+3
|
* Use `RUBY_FUNCTION_NAME_STRING` for old Visual C++Nobuyoshi Nakada2021-10-201-5/+7
| | | | | Probably `__func__` is supported since Visual C++ 2015 (= 14.0, `_MSC_VER` = 1900).
* Ensure the format argument of RUBY_DEBUG_LOG is a string literalNobuyoshi Nakada2021-10-201-3/+3
|
* Supress `warning: data argument not used by format string [-Wformat-extra-args]`Kazuhiro NISHIYAMA2021-10-201-7/+7
|
* suppress GCC's -Wsuggest-attribute=format卜部昌平2021-09-101-0/+1
| | | | I was not aware of this because I use clang these days.
* support multiple filters by RUBY_DEBUG_LOG_FILTERKoichi Sasada2020-08-021-2/+12
| | | | | | Now you can specify multiple filters for RUBY_DEBUG_LOG output by RUBY_DEBUG_LOG_FILTER=a,b,c (in this case, logs that the function name contains a, b or c).
* Fix typos [ci skip]Kazuhiro NISHIYAMA2020-07-091-2/+2
|
* RUBY_DEBUG_LOG: Logging debug information mechanism (#3279)Koichi Sasada2020-07-031-0/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * RUBY_DEBUG_LOG: Logging debug information mechanism This feature provides a mechanism to store logging information to a file, stderr or memory space with simple macros. The following information will be stored. * (1) __FILE__, __LINE__ in C * (2) __FILE__, __LINE__ in Ruby * (3) __func__ in C (message title) * (4) given string with sprintf format * (5) Thread number (if multiple threads are running) This feature is enabled only USE_RUBY_DEBUG_LOG is enabled. Release version should not enable it. Running with the `RUBY_DEBUG_LOG` environment variable enables this feature. # logging into a file RUBY_DEBUG_LOG=/path/to/file STDERR # logging into STDERR RUBY_DEBUG_LOG=stderr # logging into memory space (check with a debugger) # It will help if the timing is important. RUBY_DEBUG_LOG=mem RUBY_DEBUG_LOG_FILTER environment variable can specify the fileter string. If "(3) __func__ in C (message title)" contains the specified string, the infomation will be stored (example: RUBY_DEBUG_LOG_FILTER=str will enable only on str related information). In a MRI source code, you can use the following macros: * RUBY_DEBUG_LOG(fmt, ...): Above (1) to (4) will be logged. * RUBY_DEBUG_LOG2(file, line, fmt, ...): Same as RUBY_DEBUG_LOG(), but (1) will be replaced with given file, line.
* add #include guard hack卜部昌平2020-04-131-3/+2
| | | | | | | | | | | | | | | | | | | | | | According to MSVC manual (*1), cl.exe can skip including a header file when that: - contains #pragma once, or - starts with #ifndef, or - starts with #if ! defined. GCC has a similar trick (*2), but it acts more stricter (e. g. there must be _no tokens_ outside of #ifndef...#endif). Sun C lacked #pragma once for a looong time. Oracle Developer Studio 12.5 finally implemented it, but we cannot assume such recent version. This changeset modifies header files so that each of them include strictly one #ifndef...#endif. I believe this is the most portable way to trigger compiler optimizations. [Bug #16770] *1: https://docs.microsoft.com/en-us/cpp/preprocessor/once *2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
* add rp() and bp() in internal.h.Koichi Sasada2019-08-091-3/+0
| | | | | | | | debug utility macro rp() (rp_m()) and bp() are introduced. * rp(obj) shows obj information w/o any side-effect to STDERR. * rp_m(m, obj) is similar to rp(obj), but show m before. * bp() is alias of ruby_debug_breakpoint(), which is registered as a breakpoint in run.gdb (used by `make gdb` or make gdb-ruby`).
* defines.h: RUBY_SYMBOL_EXPORT_{BEGIN,END}nobu2013-04-051-6/+2
| | | | | | | * include/ruby/defines.h (RUBY_SYMBOL_EXPORT_{BEGIN,END}): visibility control macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/debug.h: introdudced.ko12012-11-201-0/+41
Debugging/profiling features will be located. * vm_trace.c: expose C-level TracePoint APIs. Note that they are experimental. * vm_trace.c, include/ruby/debug.h: rename `rb_hook_flag_t' to `rb_event_hook_flag_t'. Macro names `RUBY_HOOK_FLAG_*' are also renamed to `RUBY_EVENT_HOOK_FLAG_*'. * debug.h, vm_debug.h: rename debug.h to vm_debug.h. * common.mk: ditto. * debug.c, main.c, vm_core.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e