diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2014-08-20 12:53:50 +0200 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2014-08-27 15:19:14 +0200 |
| commit | 849ae5d8815c54d135eb9d58cae77c2e6dcac55a (patch) | |
| tree | ceb472feaae7c7a2b63305c2a5dce26663252326 /src/etc | |
| parent | 6974b4f1b52556e191ade6653e9a9440d1d19610 (diff) | |
| download | rust-849ae5d8815c54d135eb9d58cae77c2e6dcac55a.tar.gz rust-849ae5d8815c54d135eb9d58cae77c2e6dcac55a.zip | |
debuginfo: Emit different autotest debugger scripts depending on GDB version.
Diffstat (limited to 'src/etc')
| -rw-r--r-- | src/etc/gdb_rust_pretty_printing.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py index c84dde92f8f..e8a6427c1d7 100644 --- a/src/etc/gdb_rust_pretty_printing.py +++ b/src/etc/gdb_rust_pretty_printing.py @@ -80,8 +80,7 @@ def rust_pretty_printer_lookup_function(val): discriminant_name, discriminant_val = extract_discriminant_value(val) return rust_pretty_printer_lookup_function(val[enum_members[discriminant_val]]) - - + # No pretty printer has been found return None #=------------------------------------------------------------------------------ @@ -99,10 +98,17 @@ class RustStructPrinter: def children(self): cs = [] for field in self.val.type.fields(): - field_name = field.name; + field_name = field.name + # Normally the field name is used as a key to access the field value, + # because that's also supported in older versions of GDB... + field_key = field_name if field_name == None: field_name = "" - name_value_tuple = ( field_name, self.val[field] ) + # ... but for fields without a name (as in tuples), we have to fall back + # to the newer method of using the field object directly as key. In + # older versions of GDB, this will just fail. + field_key = field + name_value_tuple = ( field_name, self.val[field_key] ) cs.append( name_value_tuple ) if self.hide_first_field: @@ -222,4 +228,4 @@ def get_field_at_index(val, index): for field in val.type.fields(): if i == index: return field - return None \ No newline at end of file + return None |
