[PATCH] D63631: [llvm-objdump] Perform --start-address / --stop-address error checking
Yuanfang Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 20 16:52:33 PDT 2019
ychen created this revision.
ychen added reviewers: jhenderson, grimar, MaskRay, rupprecht.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
for all actions user may do with llvm-objdump; notably, -r and -s in
addition to existing -d. Match GNU behavior.
prepare for patch on PR41911
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D63631
Files:
llvm/test/tools/llvm-objdump/X86/start-stop-address.test
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1418,9 +1418,6 @@
}
static void disassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
- if (StartAddress >= StopAddress)
- error("start address should be less than stop address");
-
const Target *TheTarget = getTarget(Obj);
// Package up features to be passed to target/subtarget
@@ -2064,6 +2061,9 @@
cl::ParseCommandLineOptions(argc, argv, "llvm object file dumper\n");
+ if (StartAddress >= StopAddress)
+ error("start address should be less than stop address");
+
ToolName = argv[0];
// Defaults to a.out if no filenames specified.
Index: llvm/test/tools/llvm-objdump/X86/start-stop-address.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/start-stop-address.test
+++ llvm/test/tools/llvm-objdump/X86/start-stop-address.test
@@ -69,4 +69,7 @@
// RUN: not llvm-objdump -d %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG
// RUN: not llvm-objdump -d %t.out --start-address=0x40 --stop-address=0x40 2>&1 | FileCheck %s --check-prefix ERRMSG
+// RUN: not llvm-objdump %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG
+// RUN: not llvm-objdump -r %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG
+// RUN: not llvm-objdump -s %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG
// ERRMSG: start address should be less than stop address.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63631.205924.patch
Type: text/x-patch
Size: 1718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190620/82880d3f/attachment.bin>
More information about the llvm-commits
mailing list