[Lldb-commits] [lldb] r130728 - /lldb/trunk/source/Commands/CommandObjectImage.cpp

Greg Clayton gclayton at apple.com
Mon May 2 14:39:03 PDT 2011


Author: gclayton
Date: Mon May  2 16:39:03 2011
New Revision: 130728

URL: http://llvm.org/viewvc/llvm-project?rev=130728&view=rev
Log:
Added a "--triple [<width>]"  ("-t<width>" as a short option) option to the
image list command so we can see the full triple for each target module.


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

Modified: lldb/trunk/source/Commands/CommandObjectImage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectImage.cpp?rev=130728&r1=130727&r2=130728&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectImage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectImage.cpp Mon May  2 16:39:03 2011
@@ -37,14 +37,19 @@
 // Static Helper functions
 //----------------------------------------------------------------------
 static void
-DumpModuleArchitecture (Stream &strm, Module *module, uint32_t width)
+DumpModuleArchitecture (Stream &strm, Module *module, bool full_triple, uint32_t width)
 {
     if (module)
     {
+        const char *arch_cstr;
+        if (full_triple)
+            arch_cstr = module->GetArchitecture().GetTriple().str().c_str();
+        else
+            arch_cstr = module->GetArchitecture().GetArchitectureName();
         if (width)
-            strm.Printf("%-*s", width, module->GetArchitecture().GetArchitectureName());
+            strm.Printf("%-*s", width, arch_cstr);
         else
-            strm.PutCString(module->GetArchitecture().GetArchitectureName());
+            strm.PutCString(arch_cstr);
     }
 }
 
@@ -1278,9 +1283,13 @@
                             switch (format_char)
                             {
                             case 'a':
-                                DumpModuleArchitecture (strm, module, width);
+                                DumpModuleArchitecture (strm, module, false, width);
                                 break;
 
+                            case 't':
+                                DumpModuleArchitecture (strm, module, true, width);
+                                break;
+                                    
                             case 'f':
                                 DumpFullpath (strm, &module->GetFileSpec(), width);
                                 dump_object_name = true;
@@ -1354,6 +1363,7 @@
 CommandObjectImageList::CommandOptions::g_option_table[] =
 {
 { LLDB_OPT_SET_1, false, "arch",       'a', optional_argument, NULL, 0, eArgTypeWidth,   "Display the architecture when listing images."},
+{ LLDB_OPT_SET_1, false, "triple",     't', optional_argument, NULL, 0, eArgTypeWidth,   "Display the triple when listing images."},
 { LLDB_OPT_SET_1, false, "uuid",       'u', no_argument,       NULL, 0, eArgTypeNone,    "Display the UUID when listing images."},
 { LLDB_OPT_SET_1, false, "fullpath",   'f', optional_argument, NULL, 0, eArgTypeWidth,   "Display the fullpath to the image object file."},
 { LLDB_OPT_SET_1, false, "directory",  'd', optional_argument, NULL, 0, eArgTypeWidth,   "Display the directory with optional width for the image object file."},





More information about the lldb-commits mailing list