summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/runtime-gdb.py
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-03-04 21:27:36 +0100
committerMichael Stapelberg <michael@stapelberg.de>2013-03-04 21:27:36 +0100
commit04b08da9af0c450d645ab7389d1467308cfc2db8 (patch)
treedb247935fa4f2f94408edc3acd5d0d4f997aa0d8 /src/pkg/runtime/runtime-gdb.py
parent917c5fb8ec48e22459d77e3849e6d388f93d3260 (diff)
downloadgolang-8a38527ecb7e0f900b0ed6217a6891cf4e5a22a4.tar.gz
Imported Upstream version 1.1~hg20130304upstream/1.1_hg20130304
Diffstat (limited to 'src/pkg/runtime/runtime-gdb.py')
-rw-r--r--src/pkg/runtime/runtime-gdb.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/pkg/runtime/runtime-gdb.py b/src/pkg/runtime/runtime-gdb.py
index 629c39e98..eff9a4003 100644
--- a/src/pkg/runtime/runtime-gdb.py
+++ b/src/pkg/runtime/runtime-gdb.py
@@ -149,8 +149,8 @@ goobjfile.pretty_printers.extend([makematcher(k) for k in vars().values() if has
#
# For reference, this is what we're trying to do:
-# eface: p *(*(struct 'runtime.commonType'*)'main.e'->type_->data)->string
-# iface: p *(*(struct 'runtime.commonType'*)'main.s'->tab->Type->data)->string
+# eface: p *(*(struct 'runtime.rtype'*)'main.e'->type_->data)->string
+# iface: p *(*(struct 'runtime.rtype'*)'main.s'->tab->Type->data)->string
#
# interface types can't be recognized by their name, instead we check
# if they have the expected fields. Unfortunately the mapping of
@@ -186,8 +186,7 @@ def lookup_type(name):
except:
pass
-_rctp_type = gdb.lookup_type("struct runtime.commonType").pointer()
-_rtp_type = gdb.lookup_type("struct runtime._type").pointer()
+_rctp_type = gdb.lookup_type("struct runtime.rtype").pointer()
def iface_commontype(obj):
if is_iface(obj):
@@ -196,18 +195,13 @@ def iface_commontype(obj):
go_type_ptr = obj['_type']
else:
return
-
- # sanity check: reflection type description ends in a loop.
- tt = go_type_ptr['_type'].cast(_rtp_type).dereference()['_type']
- if tt != tt.cast(_rtp_type).dereference()['_type']:
- return
- return go_type_ptr['ptr'].cast(_rctp_type).dereference()
+ return go_type_ptr.cast(_rctp_type).dereference()
def iface_dtype(obj):
"Decode type of the data field of an eface or iface struct."
- # known issue: dtype_name decoded from runtime.commonType is "nested.Foo"
+ # known issue: dtype_name decoded from runtime.rtype is "nested.Foo"
# but the dwarf table lists it as "full/path/to/nested.Foo"
dynamic_go_type = iface_commontype(obj)
@@ -381,6 +375,7 @@ class GoroutineCmd(gdb.Command):
def invoke(self, arg, from_tty):
goid, cmd = arg.split(None, 1)
+ goid = gdb.parse_and_eval(goid)
pc, sp = find_goroutine(int(goid))
if not pc:
print "No such goroutine: ", goid