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, 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
>
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 <rtm/idl/ExtendedDataTypesSkel.h> #include <rtm/idl/BasicDataTypeSkel.h> #include <iostream> #include <sstream>
using std::cout; using std::cerr; using std::endl; using std::stringstream; using std::string;
int main(int argc, char **argv) {
****************************************************
I was trying to dig deeper and debug the omniorb code, but I did not find a good way: is there any?
Thanks!
Attila