[Lldb-commits] [lldb] r119100 - /lldb/trunk/source/Commands/CommandObjectFrame.cpp

Greg Clayton gclayton at apple.com
Sun Nov 14 17:32:26 PST 2010


Author: gclayton
Date: Sun Nov 14 19:32:26 2010
New Revision: 119100

URL: http://llvm.org/viewvc/llvm-project?rev=119100&view=rev
Log:
Added the address of operator for the "frame variable" command. 

Modified:
    lldb/trunk/source/Commands/CommandObjectFrame.cpp

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=119100&r1=119099&r2=119100&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Sun Nov 14 19:32:26 2010
@@ -586,12 +586,18 @@
                         }
                         else
                         {
+                            bool address_of = false;
                             // If first character is a '*', then show pointer contents
                             if (name_cstr[0] == '*')
                             {
                                 ++ptr_depth;
                                 name_cstr++; // Skip the '*'
                             }
+                            else if (name_cstr[0] == '&')
+                            {
+                                address_of = true;
+                                name_cstr++; // Skip the '&'
+                            }
 
                             std::string var_path (name_cstr);
                             size_t separator_idx = var_path.find_first_of(".-[");
@@ -724,18 +730,25 @@
                                     }
 
 
-                                    ValueObject::DumpValueObject (result.GetOutputStream(), 
-                                                                  exe_ctx.frame, 
-                                                                  valobj_sp.get(), 
-                                                                  valobj_sp->GetParent() ? name_cstr : NULL, 
-                                                                  ptr_depth, 
-                                                                  0, 
-                                                                  m_options.max_depth, 
-                                                                  m_options.show_types,
-                                                                  m_options.show_location,
-                                                                  m_options.use_objc, 
-                                                                  false,
-                                                                  m_options.flat_output);                                        
+                                    if (address_of)
+                                    {
+                                        s.Printf("&%s = %s\n", name_cstr, valobj_sp->GetLocationAsCString (exe_ctx.frame));
+                                    }
+                                    else
+                                    {
+                                        ValueObject::DumpValueObject (result.GetOutputStream(), 
+                                                                      exe_ctx.frame, 
+                                                                      valobj_sp.get(), 
+                                                                      valobj_sp->GetParent() ? name_cstr : NULL, 
+                                                                      ptr_depth, 
+                                                                      0, 
+                                                                      m_options.max_depth, 
+                                                                      m_options.show_types,
+                                                                      m_options.show_location,
+                                                                      m_options.use_objc, 
+                                                                      false,
+                                                                      m_options.flat_output);
+                                    }
                                 }
                             }
                             else





More information about the lldb-commits mailing list