|
9 | 9 | # except according to those terms.
|
10 | 10 |
|
11 | 11 | import gdb
|
| 12 | +import re |
12 | 13 | import sys
|
13 | 14 | import debugger_pretty_printers_common as rustpp
|
14 | 15 |
|
|
20 | 21 |
|
21 | 22 | rust_enabled = 'set language rust' in gdb.execute('complete set language ru', to_string = True)
|
22 | 23 |
|
| 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 | + |
23 | 34 | #===============================================================================
|
24 | 35 | # GDB Pretty Printing Module for Rust
|
25 | 36 | #===============================================================================
|
@@ -110,10 +121,10 @@ def rust_pretty_printer_lookup_function(gdb_val):
|
110 | 121 | if type_kind == rustpp.TYPE_KIND_STD_VECDEQUE:
|
111 | 122 | return RustStdVecDequePrinter(val)
|
112 | 123 |
|
113 |
| - if type_kind == rustpp.TYPE_KIND_STD_BTREESET: |
| 124 | + if type_kind == rustpp.TYPE_KIND_STD_BTREESET and gdb_81: |
114 | 125 | return RustStdBTreeSetPrinter(val)
|
115 | 126 |
|
116 |
| - if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP: |
| 127 | + if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP and gdb_81: |
117 | 128 | return RustStdBTreeMapPrinter(val)
|
118 | 129 |
|
119 | 130 | if type_kind == rustpp.TYPE_KIND_STD_STRING:
|
|
0 commit comments