Results 1 to 5 of 5

Thread: sigsegv issue with std::string vars generated with slice

  1. #1
    Jaime Silva is offline Registered User
    Name: Jaime Silva
    Organization: Ingenieria de Software Bancario
    Project: Monitor our middleware platform
    Join Date
    Apr 2011
    Posts
    5

    sigsegv issue with std::string vars generated with slice

    Hello, have an issue with global static variables generated by slice2cpp

    when i create my .ice and compiled with slice, some .cpp file is generated with a list of global variables of type

    static const ::std::string __mymodule__myclass__mymethod_name = "mymethod";


    when i run in linux, my server fails with SIGSEGV in

    #0 IceDelegateM::mymodule::myclass::mymethod (this=0x810f1f0, id=...,
    flgRegister=0, prxInstance=..., __context=0x0) at mymodule.cpp:1199
    #1 0xf794f96b in IceProxy::mymodule::myclass::mymethod (this=0x8111840,
    id=..., flgRegister=0, prxInstance=..., __ctx=0x0) at mymodule.cpp:145
    #2 0xf79675c8 in IceProxy::mymodule::myclass::mymethod (this=0x8111840,
    id=..., flgRegister=0, prxInstance=...) at ./mymodule.h:196
    #3 0xf7969a63 in Server::run (this=0xf6a28358, argc=2, argv=0xffffd784)
    at Server.cpp:141
    #4 0x009a55a8 in Ice::Application::doMain(int, char**, Ice::InitializationData const&) () from /usr/lib/libIce.so.34
    #5 0x009a6577 in Ice::Application::main(int, char**, Ice::InitializationData const&) () from /usr/lib/libIce.so.34
    #6 0xf796b3f1 in InstanceThread::run (this=0x8105960) at Server.cpp:259
    #7 0x0031d7ce in ?? () from /usr/lib/libIceUtil.so.34
    #8 0x002a1832 in start_thread () from /lib/libpthread.so.0
    #9 0x0021fe0e in clone () from /lib/libc.so.6
    (gdb)

    the reason is those static const variables generated by slice remains NULL in runtime

    (gdb) p __mymodule__myclass__mymethod_name
    $3 = {static npos = 4294967295,
    _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x0}}
    (gdb)


    I read this suppose to be a compiler/linker issue, so any hint will be apreciated to assure those static variables will initialize correctly, like some flag to compile a dynamic library with ice on it. I made lot of changes, like dlopen or link static, research compiler and linker flags. Nothing works and drive me crazy.

    My program is a legacy C server and links with ICe by a dinamic library written in C++ with Ice methodology.

    In Windows all works fine.
    linux info:

    uname -a
    Linux myserver 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

    ice 3.4.2

    gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)


    Thanks and regards
    Last edited by Jaime Silva; 08-11-2011 at 01:29 PM.
    Ingenieria de Software Bancario (ISBAN)
    Madrid-Spain

  2. #2
    xdm's Avatar
    xdm
    xdm is online now ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    Hi,

    seems that C++ static initialization is failing for some reason, are you compiling your code with gcc? If that is the case try to use g++ instead.

  3. #3
    Jaime Silva is offline Registered User
    Name: Jaime Silva
    Organization: Ingenieria de Software Bancario
    Project: Monitor our middleware platform
    Join Date
    Apr 2011
    Posts
    5
    well, we cannot compile our server because strict style required by g++.

    however i made a little main() only to call the ICE based lib and the behavior is the same with g++
    Ingenieria de Software Bancario (ISBAN)
    Madrid-Spain

  4. #4
    xdm's Avatar
    xdm
    xdm is online now ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    Can you attach a simple test case to reproduce the problem.

    Regard,
    Jose

  5. #5
    Jaime Silva is offline Registered User
    Name: Jaime Silva
    Organization: Ingenieria de Software Bancario
    Project: Monitor our middleware platform
    Join Date
    Apr 2011
    Posts
    5
    Solved!
    I install the samples from Ice and made a makefile to generate a dinamic library (Icegrid I think).
    Some flags in the linker make the difference and copy one of your sample makefiles to create my own makefile to compile my code.
    Thank you for your support!
    Ingenieria de Software Bancario (ISBAN)
    Madrid-Spain

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. std::max issue on Debian
    By g00fy in forum Bug Reports
    Replies: 1
    Last Post: 06-15-2008, 12:59 PM
  2. session using std::wstring instead of std::string
    By Andrew in forum Help Center
    Replies: 2
    Last Post: 01-23-2008, 08:06 AM
  3. std::string in interface
    By dthompson in forum Help Center
    Replies: 1
    Last Post: 06-21-2006, 04:49 PM
  4. Casting char* to std::string
    By inmmat in forum Help Center
    Replies: 5
    Last Post: 06-10-2006, 01:43 PM
  5. Intializing members of a slice generated class
    By Venkat Seeth in forum Help Center
    Replies: 3
    Last Post: 02-22-2005, 12:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •