FAQ
Hello All,

I'm using gdb (7.6) to debug my Go program. I followed the instructions
here making sure to compile my binary with the debug flags:
http://golang.org/doc/gdb

When I invoke "info locals" on my breakpoint I notice that the first page
of variables takes a while to show up and the second page completely locks
up. Gdb appears to be spending alot of time pretty printing the local
variables.

After playing around with my version of the runtime-gdb.py script I realize
that the problem is solved if I adjust the following section of the
StringTypePrinter:

         def to_string(self):
                 l = int(self.val['len'])
                 return self.val['str'].string("utf-8", "ignore", l)

If I change it like the following to bound the length of the strings it
tries to render then gdb no longer locks up consuming 100% of one of my
CPUs:

         def to_string(self):
                 l = int(self.val['len'])
                 if l < 102400 and l > -1:

                 return self.val['str'].string("utf-8", "ignore", l)

                 return self.val['len']

However, when I do this I notice that many of my strings are pretty printed
with extremely large numbers indicating their length. Even after I step
over a line that initializes the variable the string will sometimes fall
into the final return in the to_string() above and report that its length
is > 6 MB when I know for certain this cannot be the case.

Has anyone else run into this problem?

Thanks,
Chris

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/6956a7e5-0183-4ad2-a7d6-120fa30e5bcd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Chris McGee at Oct 16, 2013 at 1:10 pm
    I have raised the following issue about the pretty printer problem:
    https://code.google.com/p/go/issues/detail?id=6598

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Chris McGee at Oct 16, 2013 at 1:19 pm
    Also, I have raised this issue about strange uninitialized string problems,
    which might be a different problem:
    https://code.google.com/p/go/issues/detail?id=6599

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 16, '13 at 3:14a
activeOct 16, '13 at 1:19p
posts3
users1
websitegolang.org

1 user in discussion

Chris McGee: 3 posts

People

Translate

site design / logo © 2021 Grokbase