From 04b08da9af0c450d645ab7389d1467308cfc2db8 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 4 Mar 2013 21:27:36 +0100 Subject: Imported Upstream version 1.1~hg20130304 --- src/pkg/runtime/runtime-gdb.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/pkg/runtime/runtime-gdb.py') 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 -- cgit v1.2.3