[openrtm-users 03062] Re: Segmentation fault in cdrStream::marshalString

Geoffrey Biggs geoffrey.biggs @ aist.go.jp
2014年 7月 16日 (水) 09:58:47 JST


This segfault is probably caused by incorrect use of the CORBA string data
type.

The TimedString data type uses a CORBA (omniORB) string data type for its
"data" member. You need to be careful about ownership of memory when
putting strings into it. Usually, you use CORBA::string_dup() rather than
passing a raw pointer. See the StringIO example included with OpenRTM for
how to work with strings.

Geoff


On 15 July 2014 20:30, <attila.bernath @ sztaki.hu> wrote:

> Dear All, I have a simple example that tries to use the Streaming API, but
> segfaults. Program received signal SIGSEGV, Segmentation fault.
> 0x00007ffff72af9d8 in cdrStream::marshalString (this=0x7fffffffe370,
> s=0x7ffff79718b4 "", bounded=0) at /usr/include/omniORB4/cdrStream.h:590
> 590
> pd_ncs_c->marshalString(*this,pd_tcs_c,bounded,0,s); The code (sorry, I
> don't
> see how to attach a file):
> ********************************************************** #include
> #include
> #include #include using std::cout; using std::cerr; using std::endl; using
> std::stringstream; using std::string; int main(int argc, char **argv) { //
> srand(123); RTC::TimedString data; // const char* c = "hu"; // data.data =
> c;
> std::cout << data.data << std::endl; cdrMemoryStream os; std::cerr << "Hi"
> <<
> std::endl; data >>= os; std::cerr << "Hi2" << std::endl; }
> ********************************************************** I was trying to
> dig deeper and debug the omniorb code, but I did not find a good way: is
> there any? Thanks! Attila
>
> _______________________________________________
> openrtm-users mailing list
> openrtm-users @ openrtm.org
> http://www.openrtm.org/mailman/listinfo/openrtm-users
>
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
URL: <http://www.openrtm.org/pipermail/openrtm-users/attachments/20140716/5b341f5f/attachment.html>


More information about the openrtm-users mailing list