On Thu, Feb 18, 2010 at 6:13 AM, edan <eda...@gmail.com> wrote:

> We have a core dump here:
> #0  0xf749b0d9 in std::string::size () from /usr/lib/libstdc++.so.6
> #1  0x0822119c in bd::Header::ByteSize ()
> #2  0x082323b3 in
> google::protobuf::internal::WireFormat::MessageSizeNoVirtual<bd::Header> ()
> #3  0x082257cd in bd::Request::ByteSize ()
> #4  0x08233773 in
> google::protobuf::internal::WireFormat::MessageSizeNoVirtual<bd::Request> ()
> #5  0x082258b8 in bd::Data::ByteSize ()
> #6  0x08233797 in
> google::protobuf::internal::WireFormat::MessageSizeNoVirtual<bd::Data> ()
> #7  0x0822598e in bd::Main::ByteSize ()
> Question #1: Any clue what could cause this?  If bd::Request defines a
> "repeated bd::Header" field and this core dump is already in
> bd::Header::ByteSize, does that mean there must be at least one bd::Header
> in the repeated list, or could it be empty still (never added anything)?

Yes, there must be at least one bd::Header.  Or at least the code thinks
there is one.

Things to consider:

- Do you use the "hard-core" memory management methods of RepeatedPtrField,
like AddAllocated()?  If so, investigate these calls to make sure that the
pointers are valid and the ownership transfer is being respected.

- Is it possible that your code tried to delete a sub-object of a message
(e.g. a bd::Header that was embedded in a bd::Request) without first
obtaining ownership?

> (gdb) p *pb_pip_thread_data->bd_pb_data_msg.main_msg_hnd
> Attempt to dereference a generic pointer.
> (gdb) p *(bd::Main *)pb_pip_thread_data->bd_pb_data_msg.main_msg_hnd
> A syntax error in expression, near
> `)pb_pip_thread_data->bd_pb_data_msg.main_msg_hnd'.

In gdb you have to put single-quotes around scoped C++ names, e.g.:

  p *('bd::Main' *)pb_pip_thread_data->bd_pb_data_msg.main_msg_hnd

I don't know why gdb requires this.

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to