Skip to content

Commit

Permalink
Rollup merge of rust-lang#56756 - tromey:Bug-56730-btree-pretty-print…
Browse files Browse the repository at this point in the history
…er, 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
  • Loading branch information
kennytm committed Dec 14, 2018
2 parents adb674c + 4007adf commit 4a0ee22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/etc/gdb_rust_pretty_printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# except according to those terms.

import gdb
import re
import sys
import debugger_pretty_printers_common as rustpp

Expand All @@ -20,6 +21,16 @@

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

# The btree pretty-printers fail in a confusing way unless
# https://sourceware.org/bugzilla/show_bug.cgi?id=21763 is fixed.
# This fix went in 8.1, so check for that.
# See https://github.com/rust-lang/rust/issues/56730
gdb_81 = False
_match = re.match('([0-9]+)\\.([0-9]+)', gdb.VERSION)
if _match:
if int(_match.group(1)) > 8 or (int(_match.group(1)) == 8 and int(_match.group(2)) >= 1):
gdb_81 = True

#===============================================================================
# GDB Pretty Printing Module for Rust
#===============================================================================
Expand Down Expand Up @@ -110,10 +121,10 @@ def rust_pretty_printer_lookup_function(gdb_val):
if type_kind == rustpp.TYPE_KIND_STD_VECDEQUE:
return RustStdVecDequePrinter(val)

if type_kind == rustpp.TYPE_KIND_STD_BTREESET:
if type_kind == rustpp.TYPE_KIND_STD_BTREESET and gdb_81:
return RustStdBTreeSetPrinter(val)

if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP:
if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP and gdb_81:
return RustStdBTreeMapPrinter(val)

if type_kind == rustpp.TYPE_KIND_STD_STRING:
Expand Down
6 changes: 5 additions & 1 deletion src/test/debuginfo/pretty-std-collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
// ignore-freebsd: gdb package too new
// ignore-android: FIXME(#10381)
// compile-flags:-g
// min-gdb-version 7.7

// The pretty printers being tested here require the patch from
// https://sourceware.org/bugzilla/show_bug.cgi?id=21763
// min-gdb-version 8.1

// min-lldb-version: 310

// === GDB TESTS ===================================================================================
Expand Down

0 comments on commit 4a0ee22

Please sign in to comment.