[PATCH] D110621: [llvm-locstats] Report a warnning if overflow was detected by llvm-dwarfdump

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 05:09:53 PDT 2021


djtodoro created this revision.
djtodoro added a reviewer: dblaikie.
djtodoro added projects: LLVM, debug-info.
Herald added a reviewer: jhenderson.
Herald added a subscriber: cmtice.
djtodoro requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.

Catch the warning that llvm-dwarfdump detected due to an overflow in statistics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110621

Files:
  llvm/test/tools/llvm-dwarfdump/X86/locstats-bytes-overflow.yaml
  llvm/utils/llvm-locstats/llvm-locstats.py


Index: llvm/utils/llvm-locstats/llvm-locstats.py
===================================================================
--- llvm/utils/llvm-locstats/llvm-locstats.py
+++ llvm/utils/llvm-locstats/llvm-locstats.py
@@ -179,6 +179,9 @@
                   universal_newlines = True)
   cmd_stdout, cmd_stderr = subproc.communicate()
 
+  if "field overflows" in cmd_stderr:
+    print('warning: There is an overflow detected by llvm-dwarfdump backend.')
+
   # Get the JSON and parse it.
   json_parsed = None
 
Index: llvm/test/tools/llvm-dwarfdump/X86/locstats-bytes-overflow.yaml
===================================================================
--- llvm/test/tools/llvm-dwarfdump/X86/locstats-bytes-overflow.yaml
+++ llvm/test/tools/llvm-dwarfdump/X86/locstats-bytes-overflow.yaml
@@ -1,4 +1,7 @@
-# RUN: yaml2obj %s | llvm-dwarfdump --statistics - 2>&1 | FileCheck %s
+# RUN: yaml2obj %s -o %t.o
+# RUN: llvm-dwarfdump --statistics %t.o 2>&1 | FileCheck %s
+# RUN: %llvm-locstats %t.o 2>&1 | FileCheck %s --check-prefix=LOCSTATS
+# RUN: rm %t.o
 
 ## Check that we are covering the situation when a stat field overflows.
 ##
@@ -22,6 +25,7 @@
 ##             [0x0000000000000003, 0x0000000000000005): DW_OP_reg2 RCX)
 
 # CHECK: warning:  this field overflows
+# LOCSTATS: warning: There is an overflow detected by llvm-dwarfdump backend.
 
 --- !ELF
 FileHeader:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110621.375530.patch
Type: text/x-patch
Size: 1363 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210928/75b283ad/attachment.bin>


More information about the llvm-commits mailing list