【core】protobuf debugstring()接口core

protobuf 输出空的对象的debugstring()出core
[New LWP 6591]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Core was generated by `/home/root/luowenjie/output/yscl-v2x'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x76dd6ba0 in std::operator==<char, std::char_traits<char>, std::allocator<char> > (__rhs=<optimized out>, __lhs=...)
    at /opt/fslc-framebuffer/2.4.4/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/include/c++/7.3.0/bits/basic_string.h:6033
6033	/opt/fslc-framebuffer/2.4.4/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/include/c++/7.3.0/bits/basic_string.h: No such file or directory.
[Current thread is 1 (Thread 0x764a7de0 (LWP 6605))]
(gdb) bt
#0  0x76dd6ba0 in std::operator==<char, std::char_traits<char>, std::allocator<char> > (__rhs=<optimized out>, __lhs=...)
    at /opt/fslc-framebuffer/2.4.4/sysroots/armv7at2hf-neon-fslc-linux-gnueabi/usr/include/c++/7.3.0/bits/basic_string.h:6033
#1  google::protobuf::TextFormat::Printer::Print (this=this@entry=0x764a73a8, message=..., generator=generator@entry=0x764a7334) at google/protobuf/text_format.cc:1907
#2  0x76dd6cde in google::protobuf::TextFormat::Printer::Print (this=this@entry=0x764a73a8, message=..., output=output@entry=0x764a736c)
    at google/protobuf/text_format.cc:1813
#3  0x76dd6d40 in google::protobuf::TextFormat::Printer::PrintToString (this=this@entry=0x764a73a8, message=..., output=output@entry=0x764a7420)
    at google/protobuf/text_format.cc:1796
#4  0x76dd6db8 in google::protobuf::Message::DebugString[abi:cxx11]() const (this=this@entry=0x76979cc4 <baidu::pavaro::v2x::Manager::instance()::_inst+28>)
    at google/protobuf/text_format.cc:87
protobuf源码位置

在这里插入图片描述

解决方式:

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Java中,使用protobuf的ByteString类型可以方便地处理字节数据。通过调用ByteString.copyFrom(byte\[\] bytes)方法,可以将Java中的byte类型的数据转换成protobuf的ByteString类型。这样就可以将Java中的byte类型的数据放入protobuf中定义的bytes类型的对象中了。\[1\] 在生成protobuf的Java类后,bytes字段会被转换成ByteString类型。在生成的Java代码中,可以看到对应字段的setter方法会接受ByteString类型的参数。例如,可以使用setData(com.google.protobuf.ByteString value)方法将ByteString类型的数据设置到对应的字段中。\[2\] 如果想在Java代码中传输byte类型的数据,直接将byte类型的数据放入protobuf定义的bytes类型的对象中是不可行的。需要通过protobuf的API进行转换。可以使用ByteString.copyFrom(byte\[\] bytes)方法将byte数组转换成ByteString类型,然后将其设置到对应的字段中。例如,可以使用MessageBase.newBuilder().setData(ByteString.copyFrom(b))来设置byte数组b到MessageBase对象的bytes字段中。\[3\] #### 引用[.reference_title] - *1* *2* *3* [Java中protobuf的ByteString与byte数组互转](https://blog.csdn.net/yaomian1999/article/details/127169463)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值