Search Results

Search found 5 results on 1 pages for 'bbazso'.

Page 1/1 | 1 

  • How does symbol binding work for shared libraries in linux

    - by bbazso
    When compiling a cpp program with g++ -O0 I noticed that my binary does not contain the symbol for the empty string (basic_string): _S_empty_rep_storage When I do compile this same program with -O2 I notice that the aforementioned symbol is indeed contained within the binary as follows (using nm on the bin): 00000000006029a0 V _ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4 My application uses several .so (dynamic libraries) and when my aplication loads I notice that several of these .so files bind as follows (I set LD_DEBUG=all and ran my program): 28596: binding file /home/bbazso/usr/local/lib/mydynamiclib.so [0] to /usr/lib64/libstdc++.so.6 [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4] 28596: binding file /home/bbazso/usr/local/lib/mydynamiclib.so [0] to /home/bbazso/workspace/mytestapplication [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4] 28596: binding file /home/bbazso/workspace/mytestapplication [0] to /usr/lib64/libstdc++.so.6 [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4]** But I also noticed that one of my .so only binds as follows: 28087: binding file /home/bbazso/usr/local/lib/anotherdynamiclib.so [0] to /usr/lib64/libstdc++.so.6 [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4] but never binds to the binary (mytestapplication) as shown above for the mydynamiclib.so. So I was wondering what this actually means? Does this mean that anotherdynamiclib.so will use a different symbol for the empty string above than the rest of the application? I guess what I'm really asking is how does symbol binding work in the context of the example above? Thanks!

    Read the article

  • C++ Program Always Crashes While doing a std::string assign

    - by bbazso
    I have been trying to debug a crash in my application that crashes (i.e. asserts a * glibc detected free(): invalid pointer: 0x000000000070f0c0 **) while I'm trying to do a simple assign to a string. Note that I'm compiling on a linux system with gcc 4.2.4 with an optimization level set to -O2. With -O0 the application no longer crashes. E.g. std::string abc; abc = "testString"; but if I changed the code as follows it no longer crashes std::string abc("testString"); So again I scratched my head! But the interesting pattern was that the crash moved later on in the application, AGAIN at another string. I found it weird that the application was continuously crashing on a string assign. A typical crash backtrace would look as follows: #0 0x00007f2c2663bfb5 in raise () from /lib64/libc.so.6 (gdb) bt #0 0x00007f2c2663bfb5 in raise () from /lib64/libc.so.6 #1 0x00007f2c2663dbc3 in abort () from /lib64/libc.so.6 #2 0x00000000004d8cb7 in people_streamingserver_sighandler (signum=6) at src/peoplestreamingserver.cpp:487 #3 <signal handler called> #4 0x00007f2c2663bfb5 in raise () from /lib64/libc.so.6 #5 0x00007f2c2663dbc3 in abort () from /lib64/libc.so.6 #6 0x00007f2c26680ce0 in ?? () from /lib64/libc.so.6 #7 0x00007f2c270ca7a0 in std::string::assign (this=0x7f2c21bc8d20, __str=<value optimized out>) at /home/bbazso/ThirdParty/sources/gcc-4.2.4/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:238 #8 0x00007f2c21bd874a in PEOPLESProtocol::GetStreamName (this=<value optimized out>, pRawPath=0x2342fd8 "rtmp://127.0.0.1/mp4:pop.mp4", lStreamName=@0x7f2c21bc8d20) at /opt/trx-HEAD/gcc/4.2.4/lib/gcc/x86_64-pc-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/basic_string.h:491 #9 0x00007f2c21bd9daa in PEOPLESProtocol::SignalProtocolCreated (pProtocol=0x233a4e0, customParameters=@0x7f2c21bc8de0) at peoplestreamer/src/peoplesprotocol.cpp:240 This was really weird behavior and so I started to poke around further in my application to see if there was some sort of memory corruption (either heap or stack) error that could be occurring that could be causing this weird behavior. I even checked for ptr corruptions and came up empty handed. In addition to visual inspection of the code I also tried the following tools: Valgrind using both memcheck and exp-ptrcheck electric fence libsafe I compiled with -fstack-protector-all in gcc I tried MALLOC_CHECK_ set to 2 I ran my code through lint checks as well as cppcheck (to check for mistakes) And I stepped through the code using gdb So I tried a lot of stuff and still came up empty handed. So I was wondering if it could be something like a linker issue or a library issue of some sort that could be causing this problem. Are there any know issues with the std::string that make is susceptible to crashing in -O2 or maybe it has nothing to do with the optimization level? But the only pattern that I can see thus far in my problem is that it always seems to crash on a string and so I was wondering if anyone knew of any issues that my be causing this type of behavior. Thanks a lot!

    Read the article

  • Eclipse’s Ctrl+click does not work and indexer does not seem to update?

    - by bbazso
    I am running Eclipse IDE for C/C++ Developers (Ganymede) and I have recently encountered a problem with it. I can no longer get Ctrl+click navigation to work! I went to my project and tried to rebuild the index, but the rebuild command of the indexer does not work either. I did not do anything to my knowledge that may have caused this bug and so I was wondering if it could be a corrupt index or something else weird like that. Any help on this matter would be greatly appreciated. Thanks!

    Read the article

  • Is it possible to create a null function that will not produce warnings?

    - by bbazso
    I have a logger in a c++ application that uses defines as follows: #define FINEST(...) Logger::Log(FINEST, _FILE, __LINE, __func, __VA_ARGS_) However what I would like to do is to be able to switch off these logs since they have a serious performance impact on my system. And, it's not sufficient to simply have my Logger not write to the system log. I really need to get rid of the code produced by the logs. In order to do this, I changed the define to: #define FINEST(...) Which works, but this produces a whole bunch of warning in my code since variables are unused now. So what I would like to have is a sort of NULL FUNCTION that would not actually exist, but would not produce warnings for the unused variables. So, said another way, I would like it to compile with no warnings (i.e. the compiler thinks that the variables are used for a function) but the function does not actually exist in the application (i.e. produces no performance hit). Is this possible? Thanks!

    Read the article

  • What's the purpose of the unnamed namespace?

    - by bbazso
    In a .cpp file, if I decare a constant as follows: namespace { const int UDP_PORT_MIN = 1024; const int UDP_PORT_MAX = 65535; } vs. just: const int UDP_PORT_MIN = 1024; const int UDP_PORT_MAX = 65535; What's the difference between these two? I often see constant definitions declared in an unnamed namespace, so I was wondering what's the purpose of the unnamed namespace in this context?

    Read the article

1