-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
- Loading branch information
Showing
4 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters