Author Topic: Help debugging with GDB...  (Read 130 times)

Offline PaulR

  • Single posting newcomer
  • *
  • Posts: 5
Help debugging with GDB...
« on: August 10, 2018, 06:07:39 pm »
Hi

I am building an existing C + C++ project via shell scripts in MSYS2 and attempting to debug using Code::Blocks (svn 11313).
  • Code::Blocks is successfully executing the resultant exe (which works along with several .dlls, all built with a debug config).
  • GDB is successfully attaching to the process. There are no warnings about symbols not being found and I am able to pause and continue execution.
However, when I pause and continue I get the following message:
Code: [Select]
Trying to interrupt process with pid: 1488; child pid: 1488 gdb pid: 6664
In ?? () ()
Continuing...

... and the call stack is empty too with ?? 0 as the current function.

In the C::B project I have added all header and source files from the exe source and the dll sources. I have added the Qt include path to the "Additional debugger search directories" too, since it uses that.

Could somebody please explain the schoolboy error I am making here?

Thanks in advance for any assistance.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Help debugging with GDB...
« Reply #1 on: August 10, 2018, 07:53:50 pm »
1. Make sure you're not stripping symbols.
2. Make sure you're able to debug simple hello world type of application
3. When paused execute the "info shared" command and see if all modules have symbols.
(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 PaulR

  • Single posting newcomer
  • *
  • Posts: 5
Re: Help debugging with GDB...
« Reply #2 on: August 10, 2018, 08:17:08 pm »
Thanks very much for the reply.

1: I'll check the build scripts for this.
2: Yes, everything is fine with debugging (breakpoints/call stack)
3: The modules I am interested in changing code for all have read symbols (no [ * ] next to them).

I checked "Debug->Information->Targets and files" and for the local exec file, there is a long list of addresses in the results - including the entry point and the modules checked in #3, so this probably indicates something is wrong with that file too I assume.

Offline PaulR

  • Single posting newcomer
  • *
  • Posts: 5
Re: Help debugging with GDB...
« Reply #3 on: August 10, 2018, 08:43:02 pm »
Hmm, it looks like I need to make a full Qt debug build to get some files to make the exe build correctly in debug. I'm not interested in debugging the main exe though, just the code for a few of the dlls. Is this possible?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 10967
    • Travis build status
Re: Help debugging with GDB...
« Reply #4 on: August 10, 2018, 10:37:50 pm »
Yes, it should be possible to debug if you have symbols only for part of your app. Keep in mind that mixing dlls compiled with vc++ and mingw doesn't work well, because gdb doesn't know how to read the symbols produced by vc++.
(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 PaulR

  • Single posting newcomer
  • *
  • Posts: 5
Re: Help debugging with GDB...
« Reply #5 on: August 10, 2018, 11:58:26 pm »
Aaahhh, success!! In addition to not showing info symptoms, the exe was crashing when I tried setting a breakpoint (it would pause, but no highlighting of the line, no info or other sign that the breakpoint was reached) and tried continuing.

It turns out that the issue was I was using the 64 bit GDB in MSYS2. Setting the debugger to use the 32 bit one works!

Thanks for helping eliminate possibilities!