[Lldb-commits] [lldb] r276132 - If x/i is followed by x/g, the format should be reset to 'x'.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 20 08:41:12 PDT 2016


Author: jingham
Date: Wed Jul 20 10:41:12 2016
New Revision: 276132

URL: http://llvm.org/viewvc/llvm-project?rev=276132&view=rev
Log:
If x/i is followed by x/g, the format should be reset to 'x'.

Otherwise, you have to say "x/gx" to what you obviously intended to
happen to happen.

<rdar://problem/27415507>

Modified:
    lldb/trunk/source/Interpreter/OptionGroupFormat.cpp

Modified: lldb/trunk/source/Interpreter/OptionGroupFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionGroupFormat.cpp?rev=276132&r1=276131&r2=276132&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionGroupFormat.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionGroupFormat.cpp Wed Jul 20 10:41:12 2016
@@ -230,10 +230,28 @@ OptionGroupFormat::ParserGDBFormatLetter
         case 's': format = eFormatCString;      m_prev_gdb_format = format_letter; return true;
         case 'T': format = eFormatOSType;       m_prev_gdb_format = format_letter; return true;
         case 'A': format = eFormatHexFloat;     m_prev_gdb_format = format_letter; return true;
-        case 'b': byte_size = 1;                m_prev_gdb_size = format_letter;   return true;
-        case 'h': byte_size = 2;                m_prev_gdb_size = format_letter;   return true;
-        case 'w': byte_size = 4;                m_prev_gdb_size = format_letter;   return true;
-        case 'g': byte_size = 8;                m_prev_gdb_size = format_letter;   return true;
+        
+        // Size isn't used for printing instructions, so if a size is specified, and the previous format was
+        // 'i', then we should reset it to the default ('x').  Otherwise we'll continue to print as instructions,
+        // which isn't expected.
+        case 'b': 
+            byte_size = 1;                
+            LLVM_FALLTHROUGH; 
+        case 'h': 
+            byte_size = 2;
+            LLVM_FALLTHROUGH; 
+        case 'w': 
+            byte_size = 4;
+            LLVM_FALLTHROUGH; 
+        case 'g': 
+            byte_size = 8;
+            
+            m_prev_gdb_size = format_letter;
+            if (m_prev_gdb_format == 'i')
+                m_prev_gdb_format = 'x';
+            return true;
+            
+            break; 
         default:  break;
     }
     return false;




More information about the lldb-commits mailing list