[Lldb-commits] [PATCH] D18464: Implement `target modules dump headers`

Adrian McCarthy via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 4 13:53:22 PDT 2016


amccarth added inline comments.

================
Comment at: source/Commands/CommandObjectTarget.cpp:1568
@@ +1567,3 @@
+                ObjectFile *objfile = module->GetObjectFile();
+                strm.Printf("'%s':\n", objfile->GetFileSpec().GetCString());
+                strm.IndentMore();
----------------
clayborg wrote:
> Actually looking at the ObjectFilePECOFF and ObjectFileMachO dump functions, they both do something like:
> 
> ```
>         lldb_private::Mutex::Locker locker(module_sp->GetMutex());
>         s->Printf("%p: ", static_cast<void*>(this));
>         s->Indent();
>         if (m_header.magic == MH_MAGIC_64 || m_header.magic == MH_CIGAM_64)
>             s->PutCString("ObjectFileMachO64");
>         else
>             s->PutCString("ObjectFileMachO32");
> 
>         ArchSpec header_arch;
>         GetArchitecture(header_arch);
> 
>         *s << ", file = '" << m_file << "', arch = " << header_arch.GetArchitectureName() << "\n";
> ```
> 
> We should update ObjectFileELF to do the same kind of thing and remove the filename from here.
Can do.  Is locking the module mutex actually necessary to dump the object file?

================
Comment at: source/Commands/CommandObjectTarget.cpp:1569
@@ +1568,3 @@
+                strm.Printf("'%s':\n", objfile->GetFileSpec().GetCString());
+                strm.IndentMore();
+                objfile->Dump(&strm);
----------------
clayborg wrote:
> No need to indent more if we aren't printing anything.
I thought IndentMore changes the state of the stream so that the dump on the next line would be indented relative to the file name we just printed.  Is that not how it works?

Perhaps you meant that, since this will no longer print the file name, there's no point in indenting.


http://reviews.llvm.org/D18464





More information about the lldb-commits mailing list