3 May 2012 00:04
Re: GDB problem
No I'm not sure whether inlining and optimization are off. I used go build without any parameter.
Thanks
Andy
--
On Wed, May 2, 2012 at 10:48 PM, Alexander Sychev <santucco-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi,On Sun, Apr 29, 2012 at 4:00 PM, Andy W. Song <wsongcn <at> gmail.com> wrote:
Hi go-nuts,I'm trying to debug my program using GDB but have some issues.GDB can pretty prints a whole slice, but when I try to print an element list(gdb) print a[0]I get error message:Structure has no component named operator[]GDB just uses the pretty-printing mechanism for slices, but slice is actually a structure.You should print element list of slice like a.array[0]Another even stranger problem is in below program:func (d Darts) CommonPrefixSearch(key []rune /*Key_type*/, nodePos int) (results []ResultPair) {b := d.Base[nodePos]var p intfor i := 0; i < len(key); i++ {p = bn := d.Base[p]if b == d.Check[p] && n < 0 {results = append(results, ResultPair{i, d.ValuePool[-n-1]})}p = b + int(key[i]) + 1// p could be bigger than the indexif p >= len(d.Check) {return results}if b == d.Check[p] {b = d.Base[p]} else {return results}}p = bn := d.Base[p]if b == d.Check[p] && n < 0 {results = append(results, ResultPair{len(key), d.ValuePool[-n-1]})}return results}When I try to print p, n or b in the for loop I gotNo symbol "p" in current context.Any idea?Are you sure inlining and optimisation are switched off ?ThanksAndy-----------------------------------------------------------------有志者,事竟成,破釜沉舟,百二秦关终属楚苦心人,天不负,卧薪尝胆,三千越甲可吞吴
---------------------------------------------------------------
有志者,事竟成,破釜沉舟,百二秦关终属楚
苦心人,天不负,卧薪尝胆,三千越甲可吞吴
RSS Feed