[PATCH] D61969: Fix Bugzilla ID 41862 to support checking addresses of disassembled object

Nicholas Krause via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 21:28:11 PDT 2019


xerofoify updated this revision to Diff 201122.
xerofoify added a comment.

This is the updated patch. I wasn't sure if the test cases are correct, not sure if the syntax has issues. Otherwise this should be fixed now and thanks for the comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61969/new/

https://reviews.llvm.org/D61969

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
@@ -1403,8 +1403,10 @@
 }
 
 static void disassembleObject(const ObjectFile *Obj, bool InlineRelocs) {
-  if (StartAddress > StopAddress)
-    error("Start address should be less than stop address");
+  if (StartAddress >= StopAddress)
+    error("error: start address should be less than stop address");
+  if (StartAddress < StopAddress)
+   error("error: the stop address should be after the start address");
 
   const Target *TheTarget = getTarget(Obj);
 
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
@@ -68,4 +68,7 @@
 // OUT-OF-RANGE-NOT: Disassembly
 
 // RUN: not llvm-objdump -d %t.out --start-address=0x40 --stop-address=0x3f 2>&1 | FileCheck %s --check-prefix ERRMSG
-// ERRMSG: error: Start address should be less than stop address.
+// RUN: not llvm-objdump -d %t.out --start-address=0x40 --stop-address=0x40 2=&1 | FileCheck %s --check-prefix ERRMSG
+// ERRMSG: error: start address should be less than stop address.
+// RUN: not llvm-objdump -d %t.out --start-address=0x3f --stop-address=0x40 1>&2 | FileCheck %s --check-prefix ERRMSG
+// ERRMSG: error: the stop address should be after the start address


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61969.201122.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190524/5a9ac82f/attachment.bin>


More information about the llvm-commits mailing list