From 036b08917d73c08bf2959fc0de5041b75f85c73e Mon Sep 17 00:00:00 2001
From: Nikhil Shagrithaya <nikhilshagri@gmail.com>
Date: Wed, 29 Jun 2016 20:04:06 +0530
Subject: [PATCH] Added a pretty printer for &mut slices

---
 src/etc/debugger_pretty_printers_common.py | 2 +-
 src/test/debuginfo/vec-slices.rs           | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/etc/debugger_pretty_printers_common.py b/src/etc/debugger_pretty_printers_common.py
index 06a83c75936fe..b2bb7859661ab 100644
--- a/src/etc/debugger_pretty_printers_common.py
+++ b/src/etc/debugger_pretty_printers_common.py
@@ -139,7 +139,7 @@ def __classify_struct(self):
             return TYPE_KIND_STR_SLICE
 
         # REGULAR SLICE
-        if (unqualified_type_name.startswith("&[") and
+        if (unqualified_type_name.startswith(("&[", "&mut [")) and
             unqualified_type_name.endswith("]") and
             self.__conforms_to_field_layout(SLICE_FIELD_NAMES)):
             return TYPE_KIND_SLICE
diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs
index 0d396c885eb85..cdb5bc4ecfb6e 100644
--- a/src/test/debuginfo/vec-slices.rs
+++ b/src/test/debuginfo/vec-slices.rs
@@ -53,6 +53,11 @@
 // gdb-command:print *((int64_t[2]*)('vec_slices::MUT_VECT_SLICE'.data_ptr))
 // gdb-check:$15 = {64, 65}
 
+//gdb-command:print mut_slice.length
+//gdb-check:$16 = 5
+//gdb-command:print *((int64_t[5]*)(mut_slice.data_ptr))
+//gdb-check:$17 = {1, 2, 3, 4, 5}
+
 
 // === LLDB TESTS ==================================================================================
 
@@ -106,6 +111,8 @@ fn main() {
         MUT_VECT_SLICE = VECT_SLICE;
     }
 
+    let mut_slice: &mut [i64] = &mut [1, 2, 3, 4, 5];
+
     zzz(); // #break
 }