[llvm] 1fd9ba9 - Add missing test for 35fd37177b9b201f26390fe963767be548c8c2e9

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 15:44:23 PDT 2023


Author: David Blaikie
Date: 2023-03-14T22:43:53Z
New Revision: 1fd9ba9a616b6c9b75f592f65eb1005037c044ab

URL: https://github.com/llvm/llvm-project/commit/1fd9ba9a616b6c9b75f592f65eb1005037c044ab
DIFF: https://github.com/llvm/llvm-project/commit/1fd9ba9a616b6c9b75f592f65eb1005037c044ab.diff

LOG: Add missing test for 35fd37177b9b201f26390fe963767be548c8c2e9

Added: 
    llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid
    llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid.dwp
    llvm/test/tools/llvm-symbolizer/split-dwarf-dwp-invalid.test

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid b/llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid
new file mode 100755
index 0000000000000..38464cc7671e2
Binary files /dev/null and b/llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid 
diff er

diff  --git a/llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid.dwp b/llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid.dwp
new file mode 100644
index 0000000000000..06b7196408355
Binary files /dev/null and b/llvm/test/tools/llvm-symbolizer/Inputs/split-dwarf-dwp-invalid.dwp 
diff er

diff  --git a/llvm/test/tools/llvm-symbolizer/split-dwarf-dwp-invalid.test b/llvm/test/tools/llvm-symbolizer/split-dwarf-dwp-invalid.test
new file mode 100644
index 0000000000000..7554573cc5165
--- /dev/null
+++ b/llvm/test/tools/llvm-symbolizer/split-dwarf-dwp-invalid.test
@@ -0,0 +1,33 @@
+RUN: llvm-symbolizer --dwp=%p/Inputs/split-dwarf-dwp-invalid.dwp \
+RUN:     --obj=%p/Inputs/split-dwarf-dwp-invalid \
+RUN:     0x0000000000001140 0x0000000000001130 0x0000000000001130 \
+RUN:     2>&1 | FileCheck %s
+
+The test contains a hand-modified dwp file containing an invalid DWARF version
+in the second-queried CU.
+
+This ensures llvm-symbolizer doesn't crash when trying to access the invalid CU
+a second time (the first time works fine, the second fails the sorted search
+because of a null entry that can't be sorted/compared)
+
+One warning rather than two would be good here, but we put the CUs in an
+offset-sorted list, so a null entry in that list makes it impossible to sort
+(since it has no offset), so on failure we don't put anything in the list,
+which means next time it's queried it is parsed again and fails and warns
+again. We could make the list a pair of {offset, pointer} but that'd require
+fixing up a bunch of clients probably (possibly by providing a filter iterator
+that skips the null entries, keeping those only as an implementation detail?) -
+or perhaps just have a separate list of offsets that have failed to parse
+previously?
+
+CHECK: warning: DWARF unit at offset 0x00000000 has unsupported version 255, supported are 2-5
+CHECK: warning: DWARF unit at offset 0x00000000 has unsupported version 255, supported are 2-5
+
+CHECK: other()
+CHECK: /usr/local/google/home/blaikie/dev/scratch/other.cpp:1:16
+
+CHECK: main
+CHECK: /usr/local/google/home/blaikie/dev/scratch/test.cpp:5:0
+
+CHECK: main
+CHECK: /usr/local/google/home/blaikie/dev/scratch/test.cpp:5:0


        


More information about the llvm-commits mailing list