Skip to content

Commit a2b8466

Browse files
committed
Remove the now unused --backtraces-hide-core-files option
* Improve debugging documentation.
1 parent da400da commit a2b8466

File tree

6 files changed

+16
-32
lines changed

6 files changed

+16
-32
lines changed

doc/contributor/debugging.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
# Debugging TruffleRuby
22

3-
## More information in backtraces
3+
## Printing Exceptions
44

5-
We try to match MRI's backtrace format as closely as possible. This often means
5+
There are two ways to print exceptions, which can be useful to find the source of an error:
6+
* the standard Ruby `-d` flag which print the `file:line` where each exception was raised.
7+
* `--backtraces-raise` which show the full backtrace on each exception raised.
8+
9+
Both are printed even if the exception is later rescued.
10+
11+
See other `--backtraces-*` and `--exceptions-*` options for more possibilities.
12+
13+
## More Information in Backtraces
14+
15+
We try to match MRI's backtrace format as closely as possible. This sometimes means
616
that we don't display extra information that we actually do have available.
717
When debugging you may want to see this information.
818

9-
Two options to show more information are `--backtraces-hide-core-files=false`
10-
which doesn't hide methods that are used to implement the core library, and
11-
`--backtraces-interleave-java=true` which shows you the Java methods involved in
12-
executing each Ruby method.
19+
An option to show more information is `--backtraces-interleave-java=true`
20+
which shows you the Java methods involved in executing each Ruby method.
1321

1422
When you are interoperating with other languages, including C extensions,
1523
backtraces for Java exceptions may be missing information, as the Java frames

src/main/java/org/truffleruby/language/backtrace/BacktraceFormatter.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public class BacktraceFormatter {
3838
public enum FormattingFlags {
3939
OMIT_EXCEPTION,
4040
OMIT_FROM_PREFIX,
41-
INCLUDE_CORE_FILES,
4241
INTERLEAVE_JAVA
4342
}
4443

@@ -54,10 +53,6 @@ public enum FormattingFlags {
5453
public static BacktraceFormatter createDefaultFormatter(RubyContext context) {
5554
final EnumSet<FormattingFlags> flags = EnumSet.noneOf(FormattingFlags.class);
5655

57-
if (!context.getOptions().BACKTRACES_HIDE_CORE_FILES) {
58-
flags.add(FormattingFlags.INCLUDE_CORE_FILES);
59-
}
60-
6156
if (context.getOptions().BACKTRACES_INTERLEAVE_JAVA) {
6257
flags.add(FormattingFlags.INTERLEAVE_JAVA);
6358
}
@@ -72,7 +67,7 @@ public static BacktraceFormatter createDefaultFormatter(RubyContext context) {
7267
public static String printableRubyBacktrace(RubyContext context, Node node) {
7368
final BacktraceFormatter backtraceFormatter = new BacktraceFormatter(
7469
context,
75-
EnumSet.of(FormattingFlags.INCLUDE_CORE_FILES));
70+
EnumSet.noneOf(FormattingFlags.class));
7671
final String backtrace = backtraceFormatter.formatBacktrace(null, context.getCallStack().getBacktrace(node));
7772
if (backtrace.isEmpty()) {
7873
return "<empty backtrace>";

src/main/java/org/truffleruby/options/Options.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ public class Options {
9797
public final boolean EXCEPTIONS_WARN_STACKOVERFLOW;
9898
/** --exceptions-warn-out-of-memory=true */
9999
public final boolean EXCEPTIONS_WARN_OUT_OF_MEMORY;
100-
/** --backtraces-hide-core-files=true */
101-
public final boolean BACKTRACES_HIDE_CORE_FILES;
102100
/** --backtraces-interleave-java=false */
103101
public final boolean BACKTRACES_INTERLEAVE_JAVA;
104102
/** --backtraces-limit=9999 */
@@ -322,7 +320,6 @@ public Options(Env env, OptionValues options) {
322320
EXCEPTIONS_TRANSLATE_ASSERT = options.get(OptionsCatalog.EXCEPTIONS_TRANSLATE_ASSERT_KEY);
323321
EXCEPTIONS_WARN_STACKOVERFLOW = options.get(OptionsCatalog.EXCEPTIONS_WARN_STACKOVERFLOW_KEY);
324322
EXCEPTIONS_WARN_OUT_OF_MEMORY = options.get(OptionsCatalog.EXCEPTIONS_WARN_OUT_OF_MEMORY_KEY);
325-
BACKTRACES_HIDE_CORE_FILES = options.get(OptionsCatalog.BACKTRACES_HIDE_CORE_FILES_KEY);
326323
BACKTRACES_INTERLEAVE_JAVA = options.get(OptionsCatalog.BACKTRACES_INTERLEAVE_JAVA_KEY);
327324
BACKTRACES_LIMIT = options.get(OptionsCatalog.BACKTRACES_LIMIT_KEY);
328325
BACKTRACES_OMIT_UNUSED = options.get(OptionsCatalog.BACKTRACES_OMIT_UNUSED_KEY);
@@ -493,8 +490,6 @@ public Object fromDescriptor(OptionDescriptor descriptor) {
493490
return EXCEPTIONS_WARN_STACKOVERFLOW;
494491
case "ruby.exceptions-warn-out-of-memory":
495492
return EXCEPTIONS_WARN_OUT_OF_MEMORY;
496-
case "ruby.backtraces-hide-core-files":
497-
return BACKTRACES_HIDE_CORE_FILES;
498493
case "ruby.backtraces-interleave-java":
499494
return BACKTRACES_INTERLEAVE_JAVA;
500495
case "ruby.backtraces-limit":

src/options.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ EXPERT:
5252
EXCEPTIONS_TRANSLATE_ASSERT: [exceptions-translate-assert, boolean, true, Translate failed Java assertions to Ruby exceptions]
5353
EXCEPTIONS_WARN_STACKOVERFLOW: [exceptions-warn-stackoverflow, boolean, true, Warn when a stack overflow error is thrown]
5454
EXCEPTIONS_WARN_OUT_OF_MEMORY: [exceptions-warn-out-of-memory, boolean, true, Warn when an out-of-memory error is thrown]
55-
BACKTRACES_HIDE_CORE_FILES: [backtraces-hide-core-files, boolean, true, 'Hide core source files in backtraces, like MRI does']
5655
BACKTRACES_INTERLEAVE_JAVA: [backtraces-interleave-java, boolean, false, Interleave Java stacktraces into the Ruby backtrace]
5756
BACKTRACES_LIMIT: [backtraces-limit, integer, 9999, Limit the size of Ruby backtraces]
5857
BACKTRACES_OMIT_UNUSED: [backtraces-omit-unused, boolean, true, Omit backtraces that should be unused as they have pure rescue expressions]

src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ public class OptionsCatalog {
5757
public static final OptionKey<Boolean> EXCEPTIONS_TRANSLATE_ASSERT_KEY = new OptionKey<>(true);
5858
public static final OptionKey<Boolean> EXCEPTIONS_WARN_STACKOVERFLOW_KEY = new OptionKey<>(true);
5959
public static final OptionKey<Boolean> EXCEPTIONS_WARN_OUT_OF_MEMORY_KEY = new OptionKey<>(true);
60-
public static final OptionKey<Boolean> BACKTRACES_HIDE_CORE_FILES_KEY = new OptionKey<>(true);
6160
public static final OptionKey<Boolean> BACKTRACES_INTERLEAVE_JAVA_KEY = new OptionKey<>(false);
6261
public static final OptionKey<Integer> BACKTRACES_LIMIT_KEY = new OptionKey<>(9999);
6362
public static final OptionKey<Boolean> BACKTRACES_OMIT_UNUSED_KEY = new OptionKey<>(true);
@@ -410,13 +409,6 @@ public class OptionsCatalog {
410409
.stability(OptionStability.EXPERIMENTAL)
411410
.build();
412411

413-
public static final OptionDescriptor BACKTRACES_HIDE_CORE_FILES = OptionDescriptor
414-
.newBuilder(BACKTRACES_HIDE_CORE_FILES_KEY, "ruby.backtraces-hide-core-files")
415-
.help("Hide core source files in backtraces, like MRI does")
416-
.category(OptionCategory.EXPERT)
417-
.stability(OptionStability.EXPERIMENTAL)
418-
.build();
419-
420412
public static final OptionDescriptor BACKTRACES_INTERLEAVE_JAVA = OptionDescriptor
421413
.newBuilder(BACKTRACES_INTERLEAVE_JAVA_KEY, "ruby.backtraces-interleave-java")
422414
.help("Interleave Java stacktraces into the Ruby backtrace")
@@ -1137,8 +1129,6 @@ public static OptionDescriptor fromName(String name) {
11371129
return EXCEPTIONS_WARN_STACKOVERFLOW;
11381130
case "ruby.exceptions-warn-out-of-memory":
11391131
return EXCEPTIONS_WARN_OUT_OF_MEMORY;
1140-
case "ruby.backtraces-hide-core-files":
1141-
return BACKTRACES_HIDE_CORE_FILES;
11421132
case "ruby.backtraces-interleave-java":
11431133
return BACKTRACES_INTERLEAVE_JAVA;
11441134
case "ruby.backtraces-limit":
@@ -1367,7 +1357,6 @@ public static OptionDescriptor[] allDescriptors() {
13671357
EXCEPTIONS_TRANSLATE_ASSERT,
13681358
EXCEPTIONS_WARN_STACKOVERFLOW,
13691359
EXCEPTIONS_WARN_OUT_OF_MEMORY,
1370-
BACKTRACES_HIDE_CORE_FILES,
13711360
BACKTRACES_INTERLEAVE_JAVA,
13721361
BACKTRACES_LIMIT,
13731362
BACKTRACES_OMIT_UNUSED,

tool/jt.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def help
605605
jt ruby [jt options] [--] [ruby options] args...
606606
run TruffleRuby with args
607607
--stress stress the compiler (compile immediately, foreground compilation, compilation exceptions are fatal)
608-
--reveal enable assertions, show core Ruby files in backtrace
608+
--reveal enable assertions
609609
--asm show assembly
610610
--igv dump select Graal graphs to graal_dumps/ (-Dgraal.Dump=Truffle:1)
611611
--igv-full dump all Graal graphs to graal_dumps/ (-Dgraal.Dump=Truffle:2)
@@ -788,8 +788,6 @@ def rebuild(*options)
788788
core_load_path = false
789789
when '--reveal'
790790
vm_args += %w[--vm.ea --vm.esa] unless truffleruby_native?
791-
add_experimental_options.call
792-
vm_args += %w[--backtraces-hide-core-files=false]
793791
when '--stress'
794792
add_experimental_options.call
795793
vm_args << '--engine.CompileImmediately'

0 commit comments

Comments
 (0)