Skip to content

Commit

Permalink
Add the option -no-symbolic-operands to llvm-objdump used with -macho…
Browse files Browse the repository at this point in the history
… and

-disassemble to not symbolic operands when disassembling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232558 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
enderby committed Mar 17, 2015
1 parent de0ccb2 commit ba5a585
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions test/tools/llvm-objdump/X86/macho-symbolized-disassembly.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/hello.obj.macho-i386 | FileCheck %s -check-prefix=i386-OBJ
// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/hello.exe.macho-i386 | FileCheck %s -check-prefix=i386-EXE

// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -no-symbolic-operands %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s -check-prefix=NO-SYM-OPS-OBJ
// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex -no-symbolic-operands %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s -check-prefix=NO-SYM-OPS-EXE

OBJ: 0000000000000008 leaq L_.str(%rip), %rax ## literal pool for: "Hello world\n"
OBJ: 0000000000000026 callq _printf

Expand Down Expand Up @@ -36,3 +39,9 @@ CXX-EXE: 00000001000014cb callq __ZNSt3__116__pad_and_outputIcNS_11char_traitsIc
i386-OBJ: 0000002f calll _printf

i386-EXE: 00001f6f calll 0x1f84 ## symbol stub for: _printf

NO-SYM-OPS-OBJ: 0000000000000008 leaq (%rip), %rax
NO-SYM-OPS-OBJ: 0000000000000026 callq 0x2b

NO-SYM-OPS-EXE: 0000000100000f38 leaq 0x4f(%rip), %rax
NO-SYM-OPS-EXE: 0000000100000f56 callq 0x100000f6c
10 changes: 7 additions & 3 deletions tools/llvm-objdump/MachODump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ static cl::opt<bool> FullLeadingAddr("full-leading-addr",
static cl::opt<bool> NoLeadingAddr("no-leading-addr",
cl::desc("Print no leading address"));


static cl::opt<bool>
PrintImmHex("print-imm-hex",
cl::desc("Use hex format for immediate values"));
Expand Down Expand Up @@ -124,6 +123,11 @@ cl::opt<std::string> llvm::DisSymName(
"dis-symname",
cl::desc("disassemble just this symbol's instructions (requires -macho"));

static cl::opt<bool> NoSymbolicOperands(
"no-symbolic-operands",
cl::desc("do not symbolic operands when disassembling (requires -macho)"));


static cl::list<std::string>
ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
cl::ZeroOrMore);
Expand Down Expand Up @@ -3209,7 +3213,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
return;
}
// Set up the block of info used by the Symbolizer call backs.
SymbolizerInfo.verbose = true;
SymbolizerInfo.verbose = !NoSymbolicOperands;
SymbolizerInfo.O = MachOOF;
SymbolizerInfo.S = Sections[SectIdx];
SymbolizerInfo.AddrMap = &AddrMap;
Expand All @@ -3222,7 +3226,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
SymbolizerInfo.adrp_addr = 0;
SymbolizerInfo.adrp_inst = 0;
// Same for the ThumbSymbolizer
ThumbSymbolizerInfo.verbose = true;
ThumbSymbolizerInfo.verbose = !NoSymbolicOperands;
ThumbSymbolizerInfo.O = MachOOF;
ThumbSymbolizerInfo.S = Sections[SectIdx];
ThumbSymbolizerInfo.AddrMap = &AddrMap;
Expand Down

0 comments on commit ba5a585

Please sign in to comment.