aboutsummaryrefslogtreecommitdiff
path: root/src/debug/dwarf/testdata
diff options
context:
space:
mode:
authorThan McIntosh <thanm@google.com>2019-01-18 15:16:11 -0500
committerThan McIntosh <thanm@google.com>2019-03-15 17:33:46 +0000
commitc135dfbf1842993aa2fd4c293b2476ce4733daf7 (patch)
tree7f66e8ae126664969d145c3bdd823de3506eec1c /src/debug/dwarf/testdata
parent6e63b15567cb67059153bbcd787ed0d2f64dbcf3 (diff)
downloadgo-c135dfbf1842993aa2fd4c293b2476ce4733daf7.tar.xz
debug/dwarf: more graceful handling of unsupported types
Enhance the type decoder to do a better job handling unknown type tags. DWARF has a number of type DIEs that this package doesn't handle (things like "pointer to member" types in C++); avoid crashing for such types, but instead return a placeholder "UnsupportedType" object (this idea suggested by Austin). This provides a compromise between implementing the entire kitchen sink and simply returning an error outright on any unknown type DIE. Fixes #29601. Change-Id: I2eeffa094c86ef3a2c358ee42e8e629d74cec2ed Reviewed-on: https://go-review.googlesource.com/c/go/+/158797 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/debug/dwarf/testdata')
-rw-r--r--src/debug/dwarf/testdata/cppunsuptypes.cc34
-rw-r--r--src/debug/dwarf/testdata/cppunsuptypes.elfbin0 -> 3920 bytes
2 files changed, 34 insertions, 0 deletions
diff --git a/src/debug/dwarf/testdata/cppunsuptypes.cc b/src/debug/dwarf/testdata/cppunsuptypes.cc
new file mode 100644
index 0000000000..e9281c7dec
--- /dev/null
+++ b/src/debug/dwarf/testdata/cppunsuptypes.cc
@@ -0,0 +1,34 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// cppunsuptypes.elf built with g++ 7.3
+// g++ -g -c -o cppunsuptypes.elf cppunsuptypes.cc
+
+int i = 3;
+double d = 3;
+
+// anonymous reference type
+int &culprit = i;
+
+// named reference type
+typedef double &dref;
+dref dr = d;
+
+// incorporated into another type
+typedef struct {
+ dref q;
+ int &r;
+} hasrefs;
+
+hasrefs hr = { d, i };
+
+// This code is intended to trigger a DWARF "pointer to member" type DIE
+struct CS { int dm; };
+
+int foo()
+{
+ int CS::* pdm = &CS::dm;
+ CS cs = {42};
+ return cs.*pdm;
+}
diff --git a/src/debug/dwarf/testdata/cppunsuptypes.elf b/src/debug/dwarf/testdata/cppunsuptypes.elf
new file mode 100644
index 0000000000..e955512ecd
--- /dev/null
+++ b/src/debug/dwarf/testdata/cppunsuptypes.elf
Binary files differ