Skip to content

Commit 72cdd40

Browse files
authored
Rollup merge of rust-lang#56756 - tromey:Bug-56730-btree-pretty-printer, r=alexcrichton
Disable btree pretty-printers on older gdbs gdb versions before 8.1 have a bug that prevents the BTreeSet and BTreeMap pretty-printers from working. This patch disables the test on those versions, and also disables the pretty-printers there as well. Closes rust-lang#56730
2 parents 18247c4 + 4007adf commit 72cdd40

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/etc/gdb_rust_pretty_printing.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# except according to those terms.
1010

1111
import gdb
12+
import re
1213
import sys
1314
import debugger_pretty_printers_common as rustpp
1415

@@ -20,6 +21,16 @@
2021

2122
rust_enabled = 'set language rust' in gdb.execute('complete set language ru', to_string = True)
2223

24+
# The btree pretty-printers fail in a confusing way unless
25+
# https://sourceware.org/bugzilla/show_bug.cgi?id=21763 is fixed.
26+
# This fix went in 8.1, so check for that.
27+
# See https://github.com/rust-lang/rust/issues/56730
28+
gdb_81 = False
29+
_match = re.match('([0-9]+)\\.([0-9]+)', gdb.VERSION)
30+
if _match:
31+
if int(_match.group(1)) > 8 or (int(_match.group(1)) == 8 and int(_match.group(2)) >= 1):
32+
gdb_81 = True
33+
2334
#===============================================================================
2435
# GDB Pretty Printing Module for Rust
2536
#===============================================================================
@@ -110,10 +121,10 @@ def rust_pretty_printer_lookup_function(gdb_val):
110121
if type_kind == rustpp.TYPE_KIND_STD_VECDEQUE:
111122
return RustStdVecDequePrinter(val)
112123

113-
if type_kind == rustpp.TYPE_KIND_STD_BTREESET:
124+
if type_kind == rustpp.TYPE_KIND_STD_BTREESET and gdb_81:
114125
return RustStdBTreeSetPrinter(val)
115126

116-
if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP:
127+
if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP and gdb_81:
117128
return RustStdBTreeMapPrinter(val)
118129

119130
if type_kind == rustpp.TYPE_KIND_STD_STRING:

src/test/debuginfo/pretty-std-collections.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
// ignore-freebsd: gdb package too new
1414
// ignore-android: FIXME(#10381)
1515
// compile-flags:-g
16-
// min-gdb-version 7.7
16+
17+
// The pretty printers being tested here require the patch from
18+
// https://sourceware.org/bugzilla/show_bug.cgi?id=21763
19+
// min-gdb-version 8.1
20+
1721
// min-lldb-version: 310
1822

1923
// === GDB TESTS ===================================================================================

0 commit comments

Comments
 (0)