[PATCH] D48904: [llvm-objdump] Add --archive-headers (-a) option

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 04:27:48 PDT 2018


jhenderson added a comment.

In https://reviews.llvm.org/D48904#1152865, @paulsemel wrote:

> Ok, so it appears that I can't trigger the error anymore, because I move the call to `printArchiveChild` to the `DumpObject` function.
>  In the `DumpArchive` function, when the object is ill-formed, we are just ignoring and going to the next file.
>  I think we can let it like this, as it is barely not possible to test the behavior now..


Okay, that's fine. I'm not sure if I agree with the `DumpArchive` function ignoring errors completely, but that's not relevant to this change, so don't worry about it.

I've got one more question, and one small request, then I think this will be good to go on.



================
Comment at: test/tools/llvm-objdump/archive-headers-disas.test:6-11
+# CHECK:        0:	55 	pushq	%rbp
+# CHECK:        1:	48 89 e5 	movq	%rsp, %rbp
+# CHECK:        4:	b8 00 00 00 00 	movl	$0, %eax
+# CHECK:        9:	e8 00 00 00 00 	callq	0 <main+0xe>
+# CHECK:        e:	5d 	popq	%rbp
+# CHECK:        f:	c3 	retq
----------------
jhenderson wrote:
> I'd probably omit the actual disassembly part of the CHECK to make it less fragile to minor changes in how it is printed. It probably makes sense to just keep the first three CHECKs for each member (i.e. the --archive-headers line, the "Disassembly of..." line and the symbol name.
Sorry, maybe I confused you - I meant each member should have a disassembly check, so the later members should have it just like the earlier ones, but only the first part, like you've done here. Otherwise, it looks like the first few cases are different and special.


================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:2230-2231
+    outs() << ":\tfile format " << o->getFileFormatName() << "\n";
+    if (!ArchiveHeaders || MachOOpt)
+      outs() << "\n";
   }
----------------
Maybe a silly question, but why is this case special? Why not always print the double new line?


Repository:
  rL LLVM

https://reviews.llvm.org/D48904





More information about the llvm-commits mailing list