Author Topic: Unresolved problem with GDB and shared objects  (Read 3363 times)

Offline NickyB

  • Single posting newcomer
  • *
  • Posts: 2
Unresolved problem with GDB and shared objects
« on: September 02, 2011, 05:58:03 pm »
Hello all,

I've been using Code::Blocks on and off for quite some time now, and it's been doing well. I've had only one "small" issue so far and haven't figured it out yet.

I'm currently developing an extension for a program, that I need to compile as .so under Linux and .dll under Windows. The host executable does not provide debugging information (symbols) under neither Windows or Linux.

On Windows, everything is fine. I compile the dll, put it alongside my executable, the executable loads the dll, and whenever a crash occurs, gdb nicely shows me where in my code I went wrong. Also, when I run the debugger, the application will open a window of it's own.

On Linux, the whole executable is a pain in the butt. The executable is a bit old, so the only way to run it is to point LD_LIBRARY_PATH to older versions of compiled libraries (libc, libm, ld). If I don't do this, the executable (which is a console application by the way) will segfault upon initializing and I haven't found any other way to solve it. If I compile my shared object as-is, it will compile fine but will throw me a bunch of errors when the program tries to load my shared object. I've resolved this by using older header files of gcc (2.95) that match the other compiled libraries. The application runs fine with the shared object, and everything just works.

... except the debugger. For some reason, I can't get the executable to run in a terminal like it's supposed to. I can set the application log to the Debugger Log tab (and that works perfectly), but whenever I run it, gdb just freezes and I cannot pass any command to it until the application has stopped. I also can't "Stop debugging", since gdb isn't responding to anything I or CodeBlocks itself does. Whenever a crash does occur, no debugging information is shown (also because the symbol info isn't read during init?).

Any help would be greatly appreciated.

Software Info:
Debian Sid x64, up to date.
CodeBlocks svn 7440 (Aug 31).
Everything GCC related plus multilib (the host app and shared object are 32 bit).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12123
    • Travis build status
Re: Unresolved problem with GDB and shared objects
« Reply #1 on: September 03, 2011, 12:42:16 am »
Have you tried command line GDB?
If it does work there it is a C::B problem (probably resolved in the debuggers branch).
If it doesn't work it is a setup or GDB problem.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline NickyB

  • Single posting newcomer
  • *
  • Posts: 2
Re: Unresolved problem with GDB and shared objects
« Reply #2 on: September 03, 2011, 04:32:25 pm »
Doesn't work using the commandline gdb either. I think it's an issue with the application. The application (a game) expects optional input from the user. Maybe that's why it locks up. Is there any workaround for it?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12123
    • Travis build status
Re: Unresolved problem with GDB and shared objects
« Reply #3 on: September 03, 2011, 10:37:56 pm »
Then talk to the GDB developers/support, we can't do anything if GDB fails.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]